Compare commits

...
31 Commits
Author SHA1 Message Date
deepend 9b49e77201 change logo. 2026-12-05 08:26:10 -06:00
deepend-tildeclub 5cfb186b11 Merge pull request #479 from ZoiteChat/fix-issue-454+468
Fix issue 454+468
2026-12-05 07:57:27 -06:00
deepend-tildeclub 185d5c461c Merge pull request #478 from ZoiteChat/fix-issue-466
fix issue #466
2026-12-05 07:45:12 -06:00
deepend 35ad1ba987 fix issue 454 and 468 2026-12-05 07:43:41 -06:00
deepend 23a4066adb fix issue #466 2026-12-05 07:33:29 -06:00
deepend-tildeclub c7ae5a2f86 Merge pull request #476 from kobaz/master
Fix 25s startup hang with notification daemons (dbus/etc)  that ignore GetAll
2026-12-05 03:52:59 -06:00
deepend-tildeclub a15b23e489 Merge pull request #473 from B4reMetal/fix-dblclick-color-codes
Fix double click selection including color codes in copy
2026-12-05 03:43:42 -06:00
deepend-tildeclub 5fb27b8732 Merge pull request #472 from B4reMetal/fix-dblclick-copy
Fix double-click copy of a word at the end of a line
2026-12-05 03:43:12 -06:00
deepend-tildeclub 666b9b43bf Merge pull request #467 from gourdcaptain/chimera-fix
Add #define _POSIX_SOURCE for LLVM + musl C environments
2026-12-05 03:34:23 -06:00
Gourd f4f515d212 Fix building on Chimera Linux (and other similar operating systems)
zoitechat references kill, popen, pclose, gmtime_r, and localtime_r
which are POSIX-only functions that need #define _POSIX_SOURCE to
build with LLVM or musl C, one of the two.
2026-12-04 22:16:32 -05:00
deepend-tildeclub 84ffab7158 Merge pull request #477 from ZoiteChat/dependabot/submodules/flatpak/shared-modules-34add58
ci: bump flatpak/shared-modules from `d1ab132` to `34add58`
2026-12-04 19:43:04 -06:00
deepend-tildeclub b7b73ecf28 Merge pull request #381 from ZoiteChat/sysinfo-update
bring sysinfo into 2026
2026-12-04 19:41:24 -06:00
deepend 3394faae04 Windows boot drive capacity 2026-12-04 19:24:34 -06:00
deepend 38e7a5c763 linux boot drive capacity 2026-12-04 19:23:49 -06:00
deepend 81709c7235 fix macOS build/resource ownership 2026-12-04 18:30:22 -06:00
deepend 5c8036ad80 improve hardware probes+ legacy cleanup 2026-12-04 18:29:17 -06:00
deepend 27f5730f50 fix CPU frequency+linux memory fallback 2026-12-04 18:28:37 -06:00
deepend 487b7d8721 Windows fixed volume reporting 2026-12-04 18:27:33 -06:00
deepend 594e997a0d fix Linux storage reporting 2026-12-04 18:26:41 -06:00
deepend 4db044814c preserve storage privacy+preference 2026-12-04 18:25:54 -06:00
deepend 42efb59ee0 fix release+refresh hardware caches 2026-12-04 18:24:57 -06:00
deepend 3abcb33d4f share formatting and array helpers 2026-12-04 18:23:36 -06:00
deepend 96117decd6 fix build warnings 2026-12-04 17:36:12 -06:00
deepend d1a14ef56c fix application crash + other fixes 2026-12-04 17:36:11 -06:00
deepend 225fb8621c enable storage information 2026-12-04 17:36:11 -06:00
deepend 3318b641f3 fix Win32 IP Helper includes for sysinfo 2026-12-04 17:36:11 -06:00
deepend b01f6a3b42 bring sysinfo into 2026 2026-12-04 17:36:10 -06:00
dependabot[bot] 2cc7b77893 ci: bump flatpak/shared-modules from d1ab132 to 34add58
Bumps [flatpak/shared-modules](https://github.com/flathub/shared-modules) from `d1ab132` to `34add58`.
- [Commits](https://github.com/flathub/shared-modules/compare/d1ab132e6480acefc5c510ee13d8d586d36cab19...34add58f536223b780a3c9f077980cdaa51fc81f)

---
updated-dependencies:
- dependency-name: flatpak/shared-modules
  dependency-version: 34add58f536223b780a3c9f077980cdaa51fc81f
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-30 18:36:51 +00:00
Mark Murawski 1b8f80d892 Fix 25s startup hang with notification daemons that ignore GetAll
notification_backend_init() created its org.freedesktop.Notifications
proxy synchronously with G_DBUS_PROXY_FLAGS_NONE, which makes GDBus call
Properties.GetAll and wait for the reply. Some notification daemons
(e.g. awesome's naughty) never answer that call, so the UI thread
blocked until the 25 second D-Bus default timeout expired, leaving the
main window mapped but unpainted.

The proxy is only used for GetCapabilities and Notify, so create it with
DO_NOT_LOAD_PROPERTIES and DO_NOT_CONNECT_SIGNALS.
2026-11-28 00:31:22 -05:00
BareMetal 046de8beee Don't include color code digits in double-click word selection 2026-11-22 08:30:52 -07:00
BareMetal faa26a3922 Fix double-click copy of a word at the end of a line 2026-11-21 22:01:30 -07:00
38 changed files with 2506 additions and 282 deletions

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

+8 -42
View File
@@ -1,46 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="900px" height="900px" viewBox="0 0 900 900" version="1.1">
<defs>
<linearGradient id="linear0" gradientUnits="userSpaceOnUse" x1="14.94" y1="500" x2="893.400024" y2="500" gradientTransform="matrix(0.990818,0,0,0.899663,0,0.168452)">
<stop offset="0" style="stop-color:rgb(0.392157%,63.137255%,98.431373%);stop-opacity:1;"/>
<stop offset="1" style="stop-color:rgb(0%,27.843137%,73.72549%);stop-opacity:1;"/>
</linearGradient>
<linearGradient id="linear1" gradientUnits="userSpaceOnUse" x1="14.94" y1="533.090027" x2="823" y2="533.090027" gradientTransform="matrix(0.990818,0,0,0.899663,0,0.168452)">
<stop offset="0" style="stop-color:rgb(0%,27.843137%,73.72549%);stop-opacity:1;"/>
<stop offset="1" style="stop-color:rgb(0.392157%,63.137255%,98.431373%);stop-opacity:1;"/>
</linearGradient>
<filter id="alpha" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
<feColorMatrix type="matrix" in="SourceGraphic" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
</filter>
<mask id="mask0">
<g filter="url(#alpha)">
<rect x="0" y="0" width="900" height="900" style="fill:rgb(0%,0%,0%);fill-opacity:0.301961;stroke:none;"/>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128" height="128" viewBox="0 0 128 128">
<title>ZoiteChat</title>
<g id="upper" inkscape:groupmode="layer" inkscape:label="Upper hex">
<path fill="#d88b31" d="M36 8H92Q97 8 100 13L123 54Q128 63 123 72L113 89H49L95 48V35H16L28 13Q31 8 36 8Z"/>
</g>
</mask>
<clipPath id="clip1">
<rect x="0" y="0" width="900" height="900"/>
</clipPath>
<g id="surface6" clip-path="url(#clip1)">
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 807.664062 446.90625 C 807.664062 254.1875 635.601562 97.953125 423.355469 97.953125 C 299.296875 97.953125 188.988281 151.347656 118.71875 234.1875 C 185.085938 129.585938 309.460938 59.160156 451.960938 59.160156 C 664.214844 59.160156 836.269531 215.394531 836.269531 408.113281 C 836.269531 488.183594 806.546875 561.945312 756.597656 620.828125 C 789.078125 569.628906 807.664062 510.242188 807.664062 446.90625 Z M 807.664062 446.90625 "/>
</g>
<mask id="mask1">
<g filter="url(#alpha)">
<rect x="0" y="0" width="900" height="900" style="fill:rgb(0%,0%,0%);fill-opacity:0.501961;stroke:none;"/>
<g id="lower" inkscape:groupmode="layer" inkscape:label="Lower hex">
<path fill="#a8492b" d="M15 49H77L31 90V103H104L100 111Q97 120 90 120H36Q31 120 28 115L5 74Q0 64 5 54L8 49Z"/>
</g>
</mask>
<image id="image9" width="314" height="273" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAToAAAERCAYAAADrKWupAAAABmJLR0QA/wD/AP+gvaeTAAAdRElEQVR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ZCwkrBeDUR3bMbsKxf7V+O8nEnOV3NHCh9IWFcIooOh+8rF4epHNbdBJ2ElYV0diO64jN1Xrq29y1rD4nD1KHNzJKwrBdEdkzn3lYvHEx5VciSsKwLRHY9r7Cu3d0hYVw6iOxZznNxFe1f9kYR1pSC648DJXdNDwroREN2x4OSu6SFh3QCI7hhwctf0kLBuCES3fzi5a3pIWDcGots3nNw1PSSsGwTR7RcS1ukhYd0oiG6fkLDOBwnrBkF0+4WEdVqyeTkTHQnrykF0+4OEdXqyhPVJJ1E9arjkSFgXBtHtCxLW6ekTPtiQ9ZPOwwcS1hWA6PYDCev0ZOGDX0byoLqSy8IHq+ZIWK8MotsHJKzTU2rv+qFaclbJtQ1ZP4uE9eoguu1DwjofXe1dUXJZJZeFDySsC4Po9gEJ67R0tXdlnQ8xeChJjoT1CiC6bUPCOj1D2rt854OXXVxGQsJ6ZRDddiFhnZ6+7V0mOS+4KLkYPpCwXhFEt01IWKdnSLine truncated
<clipPath id="clip2">
<rect x="0" y="0" width="900" height="900"/>
</clipPath>
<g id="surface10" clip-path="url(#clip2)">
<use xlink:href="#image9" transform="matrix(1.581172,0,0,1.435704,208.067513,213.172682)"/>
</g>
</defs>
<g id="surface2">
<path style=" stroke:none;fill-rule:nonzero;fill:url(#linear0);" d="M 207.476562 790.304688 C 214.847656 775.902344 220.566406 761.195312 224.71875 746.339844 C 98.894531 677.074219 14.804688 551.554688 14.804688 408.183594 C 14.804688 189.945312 209.648438 13.023438 450 13.023438 C 690.351562 13.023438 885.195312 189.945312 885.195312 408.183594 C 885.195312 626.425781 690.351562 803.34375 450 803.34375 C 417.175781 803.34375 385.199219 800.023438 354.457031 793.761719 C 297.789062 857.851562 209.816406 892.078125 120.78125 886.34375 C 156.996094 862.296875 187.226562 829.847656 207.476562 790.296875 Z M 207.476562 790.304688 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:url(#linear1);" d="M 207.476562 790.304688 C 214.820312 775.984375 220.496094 761.347656 224.648438 746.582031 C 98.875 677.453125 14.804688 552.058594 14.804688 408.824219 C 14.804688 266.605469 97.683594 141.980469 221.972656 72.5625 C 178.703125 133.902344 153.617188 206.828125 153.617188 285.074219 C 153.617188 502.964844 348.144531 679.59375 588.109375 679.59375 C 671.449219 679.59375 749.296875 658.273438 815.433594 621.332031 C 738.210938 730.792969 603.082031 803.34375 449.296875 803.34375 C 416.679688 803.34375 384.914062 800.058594 354.355469 793.871094 C 297.691406 857.898438 209.757812 892.078125 120.769531 886.34375 C 156.984375 862.296875 187.214844 829.847656 207.46875 790.296875 Z M 207.476562 790.304688 "/>
<use xlink:href="#surface6" mask="url(#mask0)"/>
<use xlink:href="#surface10" mask="url(#mask1)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 677.402344 225.28125 L 259.328125 225.28125 L 220.765625 309.644531 L 467.875 309.644531 L 220.765625 579.972656 L 638.898438 579.972656 L 677.402344 495.550781 L 430.363281 495.550781 L 677.402344 225.273438 Z M 677.402344 225.28125 "/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 615 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+9 -53
View File
@@ -1,56 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 908.34 1000">
<defs>
<style>
.cls-1 {
fill: url(#linear-gradient-2);
}
.cls-2 {
fill: #fff;
}
.cls-3 {
isolation: isolate;
}
.cls-4 {
opacity: .3;
}
.cls-5 {
mix-blend-mode: multiply;
opacity: .5;
}
.cls-6 {
fill: url(#linear-gradient);
}
</style>
<linearGradient id="linear-gradient" x1="14.94" y1="500" x2="893.4" y2="500" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#01a1fb"/>
<stop offset="1" stop-color="#0047bc"/>
</linearGradient>
<linearGradient id="linear-gradient-2" x1="14.94" y1="533.09" x2="823" y2="533.09" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#0047bc"/>
<stop offset="1" stop-color="#01a1fb"/>
</linearGradient>
</defs>
<g class="cls-3">
<g id="Layer_1" data-name="Layer 1">
<g>
<g>
<path class="cls-6" d="m209.4,878.26c7.44-16.01,13.21-32.36,17.4-48.87C99.81,752.4,14.94,612.88,14.94,453.52c0-242.58,196.65-439.23,439.23-439.23,242.58,0,439.23,196.65,439.23,439.23,0,242.58-196.65,439.23-439.23,439.23-33.13,0-65.4-3.69-96.43-10.65-57.19,71.24-145.98,109.28-235.84,102.91,36.55-26.73,67.06-62.8,87.5-106.76Z"/>
<path class="cls-1" d="m209.4,878.26c7.41-15.92,13.14-32.19,17.33-48.6C99.79,752.82,14.94,613.44,14.94,454.23c0-158.08,83.65-296.6,209.09-373.76-43.67,68.18-68.99,149.24-68.99,236.21,0,242.19,196.33,438.52,438.52,438.52,84.11,0,162.68-23.7,229.43-64.76-77.94,121.67-214.32,202.31-369.53,202.31-32.92,0-64.98-3.65-95.82-10.53-57.19,71.17-145.94,109.16-235.75,102.79,36.55-26.73,67.06-62.8,87.5-106.76Z"/>
<g class="cls-4">
<path class="cls-2" d="m815.15,496.56c0-214.21-173.66-387.87-387.87-387.87-125.21,0-236.54,59.35-307.46,151.43,66.98-116.27,192.51-194.55,336.33-194.55,214.22,0,387.87,173.66,387.87,387.87,0,89-30,170.99-80.41,236.44,32.78-56.91,51.54-122.92,51.54-193.32Z"/>
</g>
</g>
<g>
<image class="cls-5" width="316" height="274" transform="translate(209.32 236.76) scale(1.59)" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAToAAAERCAYAAADrKWupAAAACXBIWXMAAAbrAAAG6wFMMZ5KAAAcZ0lEQVR4nO2diVYbybJFU0iMBuy+9///8L3XbaAZhIa33F1ph44ja1LNufdatRACD4jiEJEnTmYAAFg6q4l/fVP//wHAMBzP+VemJi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1nmA0C0PHNbu8RzWfSFU2xYih8M6MAjdssBh7Z465kNsWZ8c8wGHdQIgdMsBh7V7PPPBjpF8mErOMx++47BOA4RuGeCwdk8q3rUzIhcrubKW9QWHdXwQuvmDw9ofVfEuFTmvkvPMBxzWgUHolgEOa7dUxbu85IMaDymRw2EdAYRu3uCwdk+TeNdzomXVMRIc1pFB6OYLDmv31I13vZih4JTDquYDDuuIIHTzBIe1e5rEu14qZuWsyG1F5HBYRwChmx84rN3TZgNNjXjputyHsy6H+TASCN28wGHtj6YbaGq7+mQqORzWiYHQzQ8cLine truncated
<path class="cls-2" d="m683.68,250.22h-421.95l-38.92,93.77h249.4l-249.4,300.48h422.01l38.86-93.84h-249.33l249.33-300.42Z"/>
</g>
</g>
</g>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128" height="128" viewBox="0 0 128 128">
<title>ZoiteChat</title>
<g id="upper" inkscape:groupmode="layer" inkscape:label="Upper hex">
<path fill="#d88b31" d="M36 8H92Q97 8 100 13L123 54Q128 63 123 72L113 89H49L95 48V35H16L28 13Q31 8 36 8Z"/>
</g>
<g id="lower" inkscape:groupmode="layer" inkscape:label="Lower hex">
<path fill="#a8492b" d="M15 49H77L31 90V103H104L100 111Q97 120 90 120H36Q31 120 28 115L5 74Q0 64 5 54L8 49Z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 615 B

+1 -1
View File
@@ -67,7 +67,7 @@ option('with-python', type: 'string', value: 'python3',
description: 'Python scripting plugin. value is pkg-config name to use or "false"'
)
option('with-sysinfo', type: 'boolean',
description: 'System information plugin, requires libpci on Unix'
description: 'System information plugin (optional libpci for PCI names on Unix)'
)
option('with-upd', type: 'boolean',
description: 'Update plugin, Windows only'
Binary file not shown.
+30 -16
View File
@@ -285,13 +285,15 @@ char *decrypt_raw_message(const char *message, const char *key) {
return NULL;
}
static gboolean have_echo_message(void) {
return g_strcmp0(zoitechat_get_info(ph, "echo-message"), "1") == 0;
}
/**
* Called when a message is to be sent.
*/
static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
char *prefix;
enum fish_mode mode;
char *message;
GString *command;
GSList *encrypted_list, *encrypted_item;
@@ -309,15 +311,15 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
return ZOITECHAT_EAT_NONE;
}
/* Get prefix for own nick if any */
prefix = get_my_own_prefix();
/* Let the decrypted server echo display the message when available. */
if (!have_echo_message()) {
char *prefix = get_my_own_prefix();
char *message = g_strconcat("[", fish_modes[mode], "] ", word_eol[1], NULL);
/* Add encrypted flag */
message = g_strconcat("[", fish_modes[mode], "] ", word_eol[1], NULL);
/* Display message */
zoitechat_emit_print(ph, "Your Message", zoitechat_get_info(ph, "nick"), message, prefix, NULL);
g_free(message);
zoitechat_emit_print(ph, "Your Message", zoitechat_get_info(ph, "nick"), message, prefix, NULL);
g_free(message);
g_free(prefix);
}
/* Send encrypted messages */
encrypted_item = encrypted_list;
@@ -328,7 +330,6 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
encrypted_item = encrypted_item->next;
}
g_free(prefix);
g_string_free(command, TRUE);
g_slist_free_full(encrypted_list, g_free);
@@ -412,6 +413,14 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
return ZOITECHAT_EAT_NONE;
sender = irc_prefix_get_nick(prefix);
/* A reflected outgoing key exchange is not a request from the peer. */
if (irc_nick_cmp(sender, zoitechat_get_info(ph, "nick")) == 0 &&
irc_nick_cmp(word[3], sender) != 0 &&
(!strcmp(dh_message, ":DH1080_INIT") || !strcmp(dh_message, ":DH1080_FINISH"))) {
g_free(sender);
return ZOITECHAT_EAT_ALL;
}
query_ctx = find_context_on_network(sender);
if (query_ctx)
g_assert(zoitechat_set_context(ph, query_ctx) == 1);
@@ -950,7 +959,6 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
const char *target = word[2];
const char *notice = word_eol[3];
char *notice_flag;
enum fish_mode mode;
GString *command;
GSList *encrypted_list, *encrypted_item;
@@ -976,8 +984,11 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
return ZOITECHAT_EAT_ALL;
}
notice_flag = g_strconcat("[", fish_modes[mode], "] ", notice, NULL);
zoitechat_emit_print(ph, "Notice Send", target, notice_flag);
if (!have_echo_message()) {
char *notice_flag = g_strconcat("[", fish_modes[mode], "] ", notice, NULL);
zoitechat_emit_print(ph, "Notice Send", target, notice_flag);
g_free(notice_flag);
}
/* Send encrypted messages */
encrypted_item = encrypted_list;
@@ -987,7 +998,6 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
encrypted_item = encrypted_item->next;
}
g_free(notice_flag);
g_string_free(command, TRUE);
g_slist_free_full(encrypted_list, g_free);
@@ -1039,6 +1049,9 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
g_string_free(command, TRUE);
g_slist_free_full(encrypted_list, g_free);
if (have_echo_message())
return ZOITECHAT_EAT_ALL;
query_ctx = find_context_on_network(target);
if (query_ctx) {
g_assert(zoitechat_set_context(ph, query_ctx) == 1);
@@ -1079,7 +1092,8 @@ static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
return ZOITECHAT_EAT_ALL;
}
zoitechat_emit_print(ph, "Your Action", zoitechat_get_info(ph, "nick"), word_eol[2], NULL);
if (!have_echo_message())
zoitechat_emit_print(ph, "Your Action", zoitechat_get_info(ph, "nick"), word_eol[2], NULL);
/* Send encrypted messages */
encrypted_item = encrypted_list;
+4 -2
View File
@@ -376,8 +376,10 @@ def reload_name(name):
def change_cwd(path):
old_cwd = os.getcwd()
os.chdir(path)
yield
os.chdir(old_cwd)
try:
yield
finally:
os.chdir(old_cwd)
def autoload():
+78
View File
@@ -88,3 +88,81 @@ sysinfo_format_disk (guint64 total, guint64 free)
g_free (used_fmt);
return ret;
}
char *
sysinfo_format_usage (guint64 total, guint64 available)
{
guint64 used;
char *used_fmt;
char *total_fmt;
char *result;
double percent;
if (total == 0)
{
return NULL;
}
if (available > total)
{
available = total;
}
used = total - available;
percent = ((double) used / (double) total) * 100.0;
used_fmt = g_format_size_full (used, G_FORMAT_SIZE_IEC_UNITS);
total_fmt = g_format_size_full (total, G_FORMAT_SIZE_IEC_UNITS);
result = g_strdup_printf ("%s / %s used (%.0f%%)", used_fmt, total_fmt, percent);
g_free (used_fmt);
g_free (total_fmt);
return result;
}
char *
sysinfo_join_ptr_array (GPtrArray *items, const char *separator)
{
GString *joined;
guint i;
if (!items || items->len == 0)
{
return NULL;
}
joined = g_string_new (NULL);
for (i = 0; i < items->len; i++)
{
const char *item = g_ptr_array_index (items, i);
if (i != 0)
{
g_string_append (joined, separator);
}
g_string_append (joined, item);
}
return g_string_free (joined, FALSE);
}
void
sysinfo_ptr_array_add_unique (GPtrArray *items, const char *value, gboolean ignore_case)
{
guint i;
if (!value || value[0] == '\0')
{
return;
}
for (i = 0; i < items->len; i++)
{
const char *existing = g_ptr_array_index (items, i);
if (ignore_case ? g_ascii_strcasecmp (existing, value) == 0 :
g_strcmp0 (existing, value) == 0)
{
return;
}
}
g_ptr_array_add (items, g_strdup (value));
}
+3
View File
@@ -24,5 +24,8 @@
char *sysinfo_format_uptime(gint64 uptime);
char *sysinfo_format_memory(guint64 totalmem, guint64 freemem);
char *sysinfo_format_disk(guint64 total, guint64 free);
char *sysinfo_format_usage (guint64 total, guint64 available);
char *sysinfo_join_ptr_array (GPtrArray *items, const char *separator);
void sysinfo_ptr_array_add_unique (GPtrArray *items, const char *value, gboolean ignore_case);
#endif
+51 -34
View File
@@ -6,50 +6,67 @@ sysinfo_sources = [
sysinfo_deps = [
libgio_dep,
zoitechat_plugin_dep,
common_sysinfo_deps,
]
sysinfo_includes = []
sysinfo_cargs = ['-DHAVE_CONFIG_H']
system = host_machine.system()
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'darwin' or system == 'freebsd'
sysinfo_includes += 'shared'
sysinfo_sources += [
'shared/df.c'
]
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'freebsd'
libpci = dependency('libpci', required: false, method: 'pkg-config')
if libpci.found()
sysinfo_deps += libpci
sysinfo_cargs += '-DHAVE_LIBPCI'
sysinfo_sources += 'unix/pci.c'
picidsdir = libpci.get_variable(pkgconfig : 'idsdir')
pciids = join_paths(picidsdir, 'pci.ids')
sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
endif
if get_option('gtk-frontend')
sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22')
endif
sysinfo_includes += 'unix'
sysinfo_sources += [
'unix/backend.c',
'unix/match.c',
'unix/parse.c',
]
elif system == 'darwin'
add_languages('objc')
sysinfo_sources += 'osx/backend.m'
if system == 'linux'
if get_option('gtk-frontend')
sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22')
endif
elif system == 'windows'
libpci = dependency('libpci', required: false, method: 'pkg-config')
if libpci.found()
sysinfo_deps += libpci
sysinfo_cargs += '-DHAVE_LIBPCI'
endif
sysinfo_includes += 'unix'
sysinfo_sources += ['unix/modern-backend.c', 'unix/storage.c', 'unix/memory.c']
elif system == 'freebsd' or system == 'gnu' or system.startswith('gnu/')
sysinfo_includes += ['shared', 'unix']
sysinfo_sources += [
'win32/backend.c',
'../../src/common/sysinfo/win32/backend.c'
'shared/df.c',
'unix/backend.c',
'unix/match.c',
'unix/parse.c',
]
libpci = dependency('libpci', required: false, method: 'pkg-config')
if libpci.found()
sysinfo_deps += libpci
sysinfo_cargs += '-DHAVE_LIBPCI'
sysinfo_sources += 'unix/pci.c'
picidsdir = libpci.get_variable(pkgconfig: 'idsdir')
pciids = join_paths(picidsdir, 'pci.ids')
sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
endif
if get_option('gtk-frontend')
sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22')
endif
elif system == 'darwin'
sysinfo_includes += 'shared'
sysinfo_sources += 'shared/df.c'
add_languages('objc')
sysinfo_deps += dependency('appleframeworks', modules: ['Cocoa', 'IOKit'])
sysinfo_sources += 'osx/backend.m'
elif system == 'windows'
cc = meson.get_compiler('c')
sysinfo_deps += [
cc.find_library('advapi32', required: true),
cc.find_library('dxgi', required: true),
cc.find_library('dxguid', required: true),
cc.find_library('iphlpapi', required: true),
cc.find_library('winmm', required: true),
]
sysinfo_sources += 'win32/backend.c'
else
error('sysinfo: Unknown system?')
endif
+30 -15
View File
@@ -23,6 +23,8 @@
*/
#import <Cocoa/Cocoa.h>
#include <IOKit/IOKitLib.h>
#include <string.h>
#include <sys/sysctl.h>
#include <mach/mach.h>
@@ -38,6 +40,7 @@
#include "format.h"
#include "df.h"
#include "sysinfo-backend.h"
static char *
get_os (void)
@@ -48,10 +51,7 @@ get_os (void)
return NULL;
NSString *version = [systemversion objectForKey:@"ProductUserVisibleVersion"];
if (!version)
{
[build release];
return NULL;
}
NSDictionary *profiler = [NSDictionary dictionaryWithContentsOfFile:[@"~/Library/Preferences/com.apple.SystemProfiler.plist" stringByExpandingTildeInPath]];
NSDictionary *names = [profiler objectForKey:@"OS Names"];
@@ -65,18 +65,11 @@ get_os (void)
break;
}
}
[build release];
/* Dictionary values are borrowed; releasing them would over-release. */
if (!os_name)
{
[version release];
return NULL;
}
char *ret = g_strdup_printf ("%s %s", [os_name UTF8String], [version UTF8String]);
[version release];
return ret;
return g_strdup_printf ("%s %s", [os_name UTF8String], [version UTF8String]);
}
static char *
@@ -99,10 +92,19 @@ get_os_fallback (void)
return g_strdup_printf ("OS X %ld.%ld.%ld", version.majorVersion, version.minorVersion, version.patchVersion);
#endif
}
static char *os_str;
static char *gpu_str;
void
sysinfo_backend_reset_cache (void)
{
g_clear_pointer (&os_str, g_free);
g_clear_pointer (&gpu_str, g_free);
}
char *
sysinfo_backend_get_os(void)
{
static char *os_str = NULL;
if (!os_str)
{
os_str = get_os();
@@ -210,9 +212,14 @@ get_gpu(void)
}
const void *class = CFDictionaryGetValue(serviceDictionary, @"class-code");
if (!class || *(guint32*)CFDataGetBytePtr(class) != 0x30000) /* DISPLAY_VGA */
guint32 class_code = 0;
if (class && CFGetTypeID (class) == CFDataGetTypeID () &&
CFDataGetLength (class) >= sizeof (class_code))
memcpy (&class_code, CFDataGetBytePtr (class), sizeof (class_code));
if (GUINT32_FROM_LE (class_code) != 0x30000) /* DISPLAY_VGA */
{
CFRelease(serviceDictionary);
IOObjectRelease (serviceObject);
continue;
}
@@ -228,7 +235,9 @@ get_gpu(void)
}
CFRelease(serviceDictionary);
IOObjectRelease (serviceObject);
}
IOObjectRelease (entry_iterator);
if (gpu_list->len == 0)
{
@@ -250,13 +259,19 @@ get_gpu(void)
char *
sysinfo_backend_get_gpu(void)
{
static char *gpu_str = NULL;
if (!gpu_str)
gpu_str = get_gpu();
return g_strdup (gpu_str);
}
char *
sysinfo_backend_get_chipset (void)
{
/* No chipset detector exists in the legacy macOS backend. */
return NULL;
}
char *
sysinfo_backend_get_sound(void)
{
+1
View File
@@ -14,6 +14,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+2
View File
@@ -21,6 +21,8 @@
#ifndef SYSINFO_BACKEND_H
#define SYSINFO_BACKEND_H
/* Called on the same client thread as the getters. Safe to call repeatedly. */
void sysinfo_backend_reset_cache (void);
char *sysinfo_backend_get_os(void);
char *sysinfo_backend_get_disk(void);
char *sysinfo_backend_get_memory(void);
+40 -13
View File
@@ -40,8 +40,8 @@ static zoitechat_plugin *ph;
static char name[] = "Sysinfo";
static char desc[] = "Display info about your hardware and OS";
static char version[] = "1.0";
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|UI|OS|CPU|RAM|STORAGE|GPU|CHIPSET|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
static char version[] = "2.0";
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|UI|OS|CPU|RAM|MEMORY|STORAGE|DISK|GPU|VGA|CHIPSET|SOUND|NETWORK|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n /SYSINFO REFRESH - clear cached hardware information\n";
typedef struct
{
@@ -70,9 +70,9 @@ static hwinfo hwinfos[] = {
{"memory", "Memory", sysinfo_backend_get_memory},
{"storage", "Storage", sysinfo_backend_get_disk, TRUE},
{"gpu", "GPU", sysinfo_backend_get_gpu},
{"chipset", "CHIPSET", sysinfo_backend_get_chipset, TRUE},
{"chipset", "Chipset", sysinfo_backend_get_chipset, TRUE},
{"sound", "Sound", sysinfo_backend_get_sound, TRUE},
{"ethernet", "Ethernet", sysinfo_backend_get_network, TRUE},
{"ethernet", "Network", sysinfo_backend_get_network, TRUE},
{"uptime", "Uptime", sysinfo_backend_get_uptime},
{NULL, NULL},
};
@@ -115,14 +115,30 @@ print_summary (gboolean announce)
g_free (output);
}
static const char *
normalize_info_name (const char *info)
{
if (!g_ascii_strcasecmp (info, "ram"))
return "memory";
if (!g_ascii_strcasecmp (info, "disk"))
return "storage";
if (!g_ascii_strcasecmp (info, "vga"))
return "gpu";
if (!g_ascii_strcasecmp (info, "network"))
return "ethernet";
return info;
}
static void
print_info (char *info, gboolean announce)
{
const char *normalized = normalize_info_name (info);
int i;
for (i = 0; hwinfos[i].name != NULL; i++)
{
if (!g_ascii_strcasecmp (info, hwinfos[i].name))
if (!g_ascii_strcasecmp (normalized, hwinfos[i].name))
{
char *str = hwinfos[i].callback();
if (str)
@@ -176,19 +192,24 @@ sysinfo_set_pref (char *key, char *value)
return;
}
if (!strcmp (key, "announce"))
if (!g_ascii_strcasecmp (key, "announce"))
{
sysinfo_set_pref_real (key, value, DEFAULT_ANNOUNCE);
sysinfo_set_pref_real ("announce", value, DEFAULT_ANNOUNCE);
return;
}
else if (g_str_has_prefix (key, "hide_"))
else if (!g_ascii_strncasecmp (key, "hide_", 5))
{
const char *normalized = normalize_info_name (key + 5);
int i;
for (i = 0; hwinfos[i].name != NULL; i++)
{
if (!strcmp (key + 5, hwinfos[i].name))
if (!g_ascii_strcasecmp (normalized, hwinfos[i].name))
{
sysinfo_set_pref_real (key, value, hwinfos[i].def);
char canonical[32];
g_snprintf (canonical, sizeof (canonical), "hide_%s", hwinfos[i].name);
sysinfo_set_pref_real (canonical, value, hwinfos[i].def);
return;
}
}
@@ -220,10 +241,15 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
announce = FALSE;
cmd = word[2+offset];
if (!g_ascii_strcasecmp ("SET", cmd))
sysinfo_set_pref (word[3+offset], word_eol[4+offset]);
else if (!cmd || !cmd[0])
if (!cmd || !cmd[0])
print_summary (announce);
else if (!g_ascii_strcasecmp ("REFRESH", cmd))
{
sysinfo_backend_reset_cache ();
zoitechat_print (ph, _("Sysinfo: Hardware cache cleared."));
}
else if (!g_ascii_strcasecmp ("SET", cmd))
sysinfo_set_pref (word[3+offset], word_eol[4+offset]);
else
print_info (cmd, announce);
@@ -248,6 +274,7 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
int
zoitechat_plugin_deinit (void)
{
sysinfo_backend_reset_cache ();
zoitechat_command (ph, "MENU DEL \"Window/Send System Info\"");
zoitechat_command (ph, "MENU DEL \"Window/Display System Info\"");
zoitechat_printf (ph, _("%s plugin unloaded\n"), name);
+6
View File
@@ -175,6 +175,12 @@ char *sysinfo_backend_get_uptime(void)
return sysinfo_format_uptime (uptime);
}
/* The legacy Unix backend does not cache hardware snapshots. */
void
sysinfo_backend_reset_cache (void)
{
}
char *sysinfo_backend_get_network(void)
{
char ethernet_card[bsize];
+104
View File
@@ -0,0 +1,104 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <string.h>
#include <glib.h>
#include "../format.h"
#include "memory.h"
enum
{
MEM_TOTAL, MEM_AVAILABLE, MEM_FREE, BUFFERS, CACHED,
S_RECLAIMABLE, SHMEM, SWAP_TOTAL, SWAP_FREE, FIELD_COUNT
};
static gboolean
parse_kib (const char *text, guint64 *value)
{
char *end;
guint64 parsed;
while (g_ascii_isspace (*text))
text++;
if (!g_ascii_isdigit (*text))
return FALSE;
errno = 0;
parsed = g_ascii_strtoull (text, &end, 10);
if (errno || parsed > G_MAXUINT64 / 1024)
return FALSE;
while (g_ascii_isspace (*end))
end++;
if (strncmp (end, "kB", 2) != 0)
return FALSE;
end += 2;
while (g_ascii_isspace (*end))
end++;
if (*end)
return FALSE;
*value = parsed;
return TRUE;
}
char *
sysinfo_linux_format_meminfo (const char *contents)
{
static const char *keys[FIELD_COUNT] = {
"MemTotal:", "MemAvailable:", "MemFree:", "Buffers:", "Cached:",
"SReclaimable:", "Shmem:", "SwapTotal:", "SwapFree:"
};
guint64 values[FIELD_COUNT] = {0};
gboolean present[FIELD_COUNT] = {FALSE};
char **lines;
guint i, j;
guint64 available;
char *memory;
gboolean estimated = FALSE;
if (!contents)
return NULL;
lines = g_strsplit (contents, "\n", -1);
for (i = 0; lines[i]; i++)
{
for (j = 0; j < FIELD_COUNT; j++)
{
if (g_str_has_prefix (lines[i], keys[j]))
{
present[j] = parse_kib (lines[i] + strlen (keys[j]), &values[j]);
break;
}
}
}
g_strfreev (lines);
if (!present[MEM_TOTAL] || !values[MEM_TOTAL])
return NULL;
if (present[MEM_AVAILABLE])
available = values[MEM_AVAILABLE];
else if (present[MEM_FREE])
{
/* Older kernels lack MemAvailable. This estimate excludes shared
* memory from the reclaimable-cache sum and is labelled as such. */
available = values[MEM_FREE] + values[BUFFERS] + values[CACHED] + values[S_RECLAIMABLE];
available -= MIN (available, values[SHMEM]);
estimated = TRUE;
}
else
return NULL;
available = MIN (available, values[MEM_TOTAL]);
memory = sysinfo_format_usage (values[MEM_TOTAL] * 1024, available * 1024);
if (memory && estimated)
{
char *labelled = g_strdup_printf ("%s (estimated available)", memory);
g_free (memory);
memory = labelled;
}
if (memory && present[SWAP_TOTAL] && present[SWAP_FREE] && values[SWAP_TOTAL])
{
char *swap = sysinfo_format_usage (values[SWAP_TOTAL] * 1024, values[SWAP_FREE] * 1024);
if (swap)
{
char *result = g_strdup_printf ("%s \xC2\xB7 Swap: %s", memory, swap);
g_free (memory);
g_free (swap);
return result;
}
}
return memory;
}
+8
View File
@@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef SYSINFO_LINUX_MEMORY_H
#define SYSINFO_LINUX_MEMORY_H
/* Parse a /proc/meminfo snapshot; the caller owns the returned string. */
char *sysinfo_linux_format_meminfo (const char *contents);
#endif
File diff suppressed because it is too large. Load diff
+20 -7
View File
@@ -51,12 +51,18 @@ static struct device *scan_device(struct pci_dev *p)
d = g_new0 (struct device, 1);
d->dev = p;
if (!pci_read_block(p, 0, d->config, how_much))
exit(1);
{
g_free (d);
return NULL;
}
if (how_much < 128 && (d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS)
{
/* For cardbus bridges, we need to fetch 64 bytes more to get the full standard header... */
if (!pci_read_block(p, 64, d->config+64, 64))
exit(1);
{
g_free (d);
return NULL;
}
how_much = 128;
}
d->config_cnt = how_much;
@@ -116,6 +122,14 @@ int pci_find_by_class(u16 *class, char *vendor, char *device)
}
pci_cleanup(pacc);
pacc = NULL;
/* Free the cached configuration buffers after libpci is done with them. */
while (first_dev)
{
d = first_dev;
first_dev = d->next;
g_free (d);
}
return nomatch;
}
@@ -142,8 +156,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
position = strstr(buffer, vendor);
position += 6;
g_strlcpy(vendorname, position, sizeof (vendorname));
position = strstr(vendorname, "\n");
*(position) = '\0';
g_strchomp (vendorname);
break;
}
}
@@ -155,9 +168,9 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
position += 6;
g_strlcpy(devicename, position, sizeof (devicename));
position = strstr(devicename, " (");
if (position == NULL)
position = strstr(devicename, "\n");
*(position) = '\0';
if (position)
*position = '\0';
g_strchomp (devicename);
cardfound = 1;
break;
}
+232
View File
@@ -0,0 +1,232 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Whole capacity of the disk backing the boot filesystem. */
#define _XOPEN_SOURCE 700
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <glib.h>
#include "../sysinfo-backend.h"
#include "storage.h"
static gboolean
read_capacity (const char *entry, guint64 *capacity)
{
char *path = g_build_filename (entry, "size", NULL);
char *contents = NULL;
char *end;
guint64 sectors;
gboolean valid = FALSE;
if (g_file_get_contents (path, &contents, NULL, NULL))
{
g_strstrip (contents);
if (g_ascii_isdigit (contents[0]))
{
errno = 0;
sectors = g_ascii_strtoull (contents, &end, 10);
/* Linux reports size in 512-byte sectors, including 4Kn disks. */
if (!errno && *end == '\0' && sectors && sectors <= G_MAXUINT64 / 512)
{
*capacity = sectors * 512;
valid = TRUE;
}
}
}
g_free (contents);
g_free (path);
return valid;
}
static gboolean
has_entry (const char *entry, const char *name)
{
char *path = g_build_filename (entry, name, NULL);
gboolean present = g_file_test (path, G_FILE_TEST_EXISTS);
g_free (path);
return present;
}
/* Resolve the kernel device link before walking from a partition to its
* parent. Never infer the parent by stripping digits from a device name. */
static gboolean
resolve_disk (const char *entry, char **disk, guint depth)
{
char *resolved = realpath (entry, NULL);
char *slaves = NULL;
GDir *dir = NULL;
const char *name;
gboolean valid = FALSE;
if (!resolved || depth >= 32)
goto done;
if (has_entry (resolved, "partition"))
{
char *parent = g_path_get_dirname (resolved);
valid = resolve_disk (parent, disk, depth + 1);
g_free (parent);
goto done;
}
/* Follow LUKS/LVM/MD layers. Multiple distinct underlying disks are
* ambiguous, so don't arbitrarily choose one of them. */
slaves = g_build_filename (resolved, "slaves", NULL);
dir = g_dir_open (slaves, 0, NULL);
if (dir && (name = g_dir_read_name (dir)) != NULL)
{
do
{
char *child = g_build_filename (slaves, name, NULL);
valid = resolve_disk (child, disk, depth + 1);
g_free (child);
if (!valid)
goto done;
} while ((name = g_dir_read_name (dir)) != NULL);
goto done;
}
name = strrchr (resolved, '/');
name = name ? name + 1 : resolved;
if (g_str_has_prefix (name, "loop") || g_str_has_prefix (name, "ram") ||
g_str_has_prefix (name, "zram") || g_str_has_prefix (name, "sr") ||
g_str_has_prefix (name, "fd") || g_str_has_prefix (name, "dm-") ||
g_str_has_prefix (name, "md") || !has_entry (resolved, "device"))
goto done;
if (!*disk)
*disk = g_strdup (resolved);
valid = strcmp (*disk, resolved) == 0;
done:
if (dir)
g_dir_close (dir);
g_free (slaves);
free (resolved);
return valid;
}
static guint
boot_mount_priority (const char *mountpoint)
{
if (strcmp (mountpoint, "/boot") == 0)
return 4;
if (strcmp (mountpoint, "/boot/efi") == 0)
return 3;
if (strcmp (mountpoint, "/efi") == 0)
return 2;
if (strcmp (mountpoint, "/") == 0)
return 1;
return 0;
}
static gboolean
valid_device_number (const char *id)
{
const char *p = id;
if (!g_ascii_isdigit (*p))
return FALSE;
while (g_ascii_isdigit (*p))
p++;
if (*p++ != ':' || !g_ascii_isdigit (*p))
return FALSE;
while (g_ascii_isdigit (*p))
p++;
return *p == '\0';
}
static char *
resolve_mount_device (const char *sysfs, const char *id, const char *source)
{
char *entry = NULL;
struct stat st;
/* Btrfs and some other filesystems expose a synthetic mount device
* number. Prefer a verified source block device in that case. */
if (valid_device_number (id))
{
entry = g_build_filename (sysfs, "dev", "block", id, NULL);
if (g_file_test (entry, G_FILE_TEST_EXISTS))
return entry;
g_free (entry);
}
if (g_str_has_prefix (source, "/dev/") && stat (source, &st) == 0 && S_ISBLK (st.st_mode))
{
char *number = g_strdup_printf ("%u:%u", (unsigned int) major (st.st_rdev),
(unsigned int) minor (st.st_rdev));
entry = g_build_filename (sysfs, "dev", "block", number, NULL);
g_free (number);
return entry;
}
/* A sandbox may hide /dev nodes but still expose kernel block names.
* Only accept a direct /dev/<name>, never guess a mapper/UUID alias. */
if (g_str_has_prefix (source, "/dev/") && source[5] &&
strcmp (source + 5, ".") != 0 && strcmp (source + 5, "..") != 0 &&
!strchr (source + 5, '/') && !strchr (source + 5, '\\'))
return g_build_filename (sysfs, "class", "block", source + 5, NULL);
return NULL;
}
char *
sysinfo_linux_boot_disk (const char *sysfs, const char *mountinfo)
{
char **lines = g_strsplit (mountinfo, "\n", -1);
char *entry = NULL, *disk = NULL, *result = NULL;
guint priority = 0, i;
guint64 capacity;
gboolean ambiguous = FALSE;
for (i = 0; lines[i]; i++)
{
char **fields = g_strsplit (lines[i], " ", -1);
guint count = g_strv_length (fields), rank, j;
if (count < 10 || !(rank = boot_mount_priority (fields[4])) || rank < priority)
{
g_strfreev (fields);
continue;
}
for (j = 6; j + 3 < count; j++)
if (strcmp (fields[j], "-") == 0)
{
char *candidate = resolve_mount_device (sysfs, fields[2], fields[j + 2]);
if (rank > priority)
{
g_free (entry);
entry = candidate;
priority = rank;
ambiguous = FALSE;
}
else
{
if (g_strcmp0 (entry, candidate) != 0)
ambiguous = TRUE;
g_free (candidate);
}
break;
}
g_strfreev (fields);
}
g_strfreev (lines);
if (!ambiguous && entry && resolve_disk (entry, &disk, 0) &&
read_capacity (disk, &capacity))
result = g_format_size (capacity);
g_free (disk);
g_free (entry);
return result;
}
char *
sysinfo_backend_get_disk (void)
{
char *mountinfo = NULL;
char *result;
/* The sandbox root is not the host boot filesystem. Without a trusted
* host mount table there is no reliable way to identify its boot disk. */
if (g_file_test ("/.flatpak-info", G_FILE_TEST_IS_REGULAR) ||
!g_file_get_contents ("/proc/self/mountinfo", &mountinfo, NULL, NULL))
return NULL;
result = sysinfo_linux_boot_disk ("/sys", mountinfo);
g_free (mountinfo);
return result;
}
+10
View File
@@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef SYSINFO_LINUX_STORAGE_H
#define SYSINFO_LINUX_STORAGE_H
#include <glib.h>
/* Returns the whole boot disk size, or NULL if it cannot be identified. */
char *sysinfo_linux_boot_disk (const char *sysfs, const char *mountinfo);
#endif
+692 -82
View File
@@ -1,28 +1,35 @@
/* ZoiteChat
* Copyright (c) 2011-2012 Berke Viktor.
/*
* Modern Windows SysInfo backend for ZoiteChat.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* Avoids WMI in the plugin hot path and uses native Win32/DXGI APIs.
*/
#include <stdio.h>
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#elif _WIN32_WINNT < 0x0601
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#endif
#include <winsock2.h>
#include <windows.h>
#include <wbemidl.h>
#include <winternl.h>
#include <dxgi.h>
#include <iphlpapi.h>
#include <ipifcons.h>
#include <mmsystem.h>
#include <winioctl.h>
#ifdef _MSC_VER
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "iphlpapi.lib")
#pragma comment(lib, "winmm.lib")
#endif
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
@@ -30,63 +37,502 @@
#include "config.h"
#endif
#include "../../../src/common/sysinfo/sysinfo.h"
#include "../format.h"
#include "../sysinfo-backend.h"
static char *get_memory_info (void);
#define SYSINFO_SEP " \xC2\xB7 "
char *
sysinfo_backend_get_sound (void)
typedef struct
{
return NULL;
char *os;
char *cpu;
char *gpu;
char *sound;
} WinStaticSnapshot;
/* Sysinfo callbacks and plugin teardown run on the client thread. */
static WinStaticSnapshot snapshot;
static gboolean os_initialized;
static gboolean cpu_initialized;
static gboolean gpu_initialized;
static gboolean sound_initialized;
void
sysinfo_backend_reset_cache (void)
{
g_clear_pointer (&snapshot.os, g_free);
g_clear_pointer (&snapshot.cpu, g_free);
g_clear_pointer (&snapshot.gpu, g_free);
g_clear_pointer (&snapshot.sound, g_free);
os_initialized = FALSE;
cpu_initialized = FALSE;
gpu_initialized = FALSE;
sound_initialized = FALSE;
}
char *
sysinfo_backend_get_network (void)
static char *wide_to_utf8 (const WCHAR *value);
static char *read_registry_string (HKEY root, const WCHAR *subkey, const WCHAR *value_name);
static gboolean read_registry_dword (HKEY root, const WCHAR *subkey, const WCHAR *value_name, DWORD *value);
static const char *get_native_arch (void);
static DWORD get_windows_build_number (void);
static char *build_os_string (void);
static DWORD count_physical_cores (void);
static char *build_cpu_string (void);
static char *build_gpu_string (void);
static char *build_sound_string (void);
static void ensure_os_snapshot (void);
static void ensure_cpu_snapshot (void);
static void ensure_gpu_snapshot (void);
static void ensure_sound_snapshot (void);
#define format_usage sysinfo_format_usage
#define join_ptr_array sysinfo_join_ptr_array
#define ptr_array_add_unique(items, value) sysinfo_ptr_array_add_unique ((items), (value), TRUE)
static gboolean adapter_looks_virtual (const char *name);
static char *
wide_to_utf8 (const WCHAR *value)
{
return NULL;
}
char *
sysinfo_backend_get_uptime (void)
{
return sysinfo_format_uptime (GetTickCount64 () / 1000);
}
char *
sysinfo_backend_get_disk (void)
{
guint64 hdd_capacity;
guint64 hdd_free_space;
sysinfo_get_hdd_info (&hdd_capacity, &hdd_free_space);
if (hdd_capacity != 0)
if (!value || value[0] == L'\0')
{
return sysinfo_format_disk(hdd_capacity, hdd_free_space);
return NULL;
}
return NULL;
return g_utf16_to_utf8 ((const gunichar2 *) value, -1, NULL, NULL, NULL);
}
static char *
read_registry_string (HKEY root, const WCHAR *subkey, const WCHAR *value_name)
{
HKEY key;
DWORD type = 0;
DWORD size = 0;
WCHAR *buffer;
char *result = NULL;
LONG status;
status = RegOpenKeyExW (root, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
if (status != ERROR_SUCCESS)
{
return NULL;
}
status = RegQueryValueExW (key, value_name, NULL, &type, NULL, &size);
if (status != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ) || size < sizeof (WCHAR))
{
RegCloseKey (key);
return NULL;
}
buffer = g_malloc0 ((gsize) size + sizeof (WCHAR));
status = RegQueryValueExW (key, value_name, NULL, &type, (LPBYTE) buffer, &size);
if (status == ERROR_SUCCESS)
{
result = wide_to_utf8 (buffer);
if (result)
{
g_strstrip (result);
}
}
g_free (buffer);
RegCloseKey (key);
return result;
}
static gboolean
read_registry_dword (HKEY root, const WCHAR *subkey, const WCHAR *value_name, DWORD *value)
{
HKEY key;
DWORD type = 0;
DWORD size = sizeof (*value);
LONG status;
status = RegOpenKeyExW (root, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
if (status != ERROR_SUCCESS)
{
return FALSE;
}
status = RegQueryValueExW (key, value_name, NULL, &type, (LPBYTE) value, &size);
RegCloseKey (key);
return status == ERROR_SUCCESS && type == REG_DWORD;
}
static const char *
get_native_arch (void)
{
SYSTEM_INFO info;
GetNativeSystemInfo (&info);
switch (info.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64:
return "x64";
case PROCESSOR_ARCHITECTURE_ARM64:
return "ARM64";
case PROCESSOR_ARCHITECTURE_INTEL:
return "x86";
default:
return "unknown-arch";
}
}
static DWORD
get_windows_build_number (void)
{
typedef LONG (WINAPI *RtlGetVersionFn) (PRTL_OSVERSIONINFOW);
HMODULE ntdll;
RtlGetVersionFn rtl_get_version;
RTL_OSVERSIONINFOW version;
DWORD build = 0;
ntdll = GetModuleHandleW (L"ntdll.dll");
if (ntdll)
{
rtl_get_version = (RtlGetVersionFn) GetProcAddress (ntdll, "RtlGetVersion");
if (rtl_get_version)
{
ZeroMemory (&version, sizeof (version));
version.dwOSVersionInfoSize = sizeof (version);
if (rtl_get_version (&version) == 0)
{
build = version.dwBuildNumber;
}
}
}
return build;
}
static char *
build_os_string (void)
{
static const WCHAR current_version_key[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
char *product;
char *display_version;
char *registry_build;
char *fixed_product = NULL;
char *result;
DWORD ubr = 0;
DWORD build;
guint64 parsed_build = 0;
product = read_registry_string (HKEY_LOCAL_MACHINE, current_version_key, L"ProductName");
display_version = read_registry_string (HKEY_LOCAL_MACHINE, current_version_key, L"DisplayVersion");
registry_build = read_registry_string (HKEY_LOCAL_MACHINE, current_version_key, L"CurrentBuildNumber");
read_registry_dword (HKEY_LOCAL_MACHINE, current_version_key, L"UBR", &ubr);
build = get_windows_build_number ();
if (registry_build)
{
parsed_build = g_ascii_strtoull (registry_build, NULL, 10);
if (parsed_build != 0)
{
build = (DWORD) parsed_build;
}
}
if (!product)
{
product = g_strdup (build >= 22000 ? "Windows 11" : "Windows");
}
else if (build >= 22000 && g_str_has_prefix (product, "Windows 10"))
{
fixed_product = g_strdup_printf ("Windows 11%s", product + strlen ("Windows 10"));
g_free (product);
product = fixed_product;
}
if (display_version && build != 0)
{
result = g_strdup_printf ("%s %s" SYSINFO_SEP "build %lu.%lu" SYSINFO_SEP "%s",
product, display_version, (unsigned long) build, (unsigned long) ubr, get_native_arch ());
}
else if (build != 0)
{
result = g_strdup_printf ("%s" SYSINFO_SEP "build %lu.%lu" SYSINFO_SEP "%s",
product, (unsigned long) build, (unsigned long) ubr, get_native_arch ());
}
else
{
result = g_strdup_printf ("%s" SYSINFO_SEP "%s", product, get_native_arch ());
}
g_free (product);
g_free (display_version);
g_free (registry_build);
return result;
}
static DWORD
count_physical_cores (void)
{
DWORD length = 0;
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX buffer;
BYTE *cursor;
BYTE *end;
DWORD cores = 0;
GetLogicalProcessorInformationEx (RelationProcessorCore, NULL, &length);
if (GetLastError () != ERROR_INSUFFICIENT_BUFFER || length == 0)
{
return 0;
}
buffer = g_malloc0 (length);
if (!GetLogicalProcessorInformationEx (RelationProcessorCore, buffer, &length))
{
g_free (buffer);
return 0;
}
cursor = (BYTE *) buffer;
end = cursor + length;
while (cursor < end)
{
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) cursor;
if (info->Size == 0)
{
break;
}
if (info->Relationship == RelationProcessorCore)
{
cores++;
}
cursor += info->Size;
}
g_free (buffer);
return cores;
}
static char *
build_cpu_string (void)
{
static const WCHAR cpu_key[] = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
char *name;
DWORD cores;
DWORD threads;
SYSTEM_INFO info;
char *result;
name = read_registry_string (HKEY_LOCAL_MACHINE, cpu_key, L"ProcessorNameString");
if (!name)
{
name = g_strdup ("Unknown CPU");
}
cores = count_physical_cores ();
threads = GetActiveProcessorCount (ALL_PROCESSOR_GROUPS);
if (threads == 0)
{
GetNativeSystemInfo (&info);
threads = info.dwNumberOfProcessors;
}
if (cores != 0)
{
result = g_strdup_printf ("%s" SYSINFO_SEP "%luC/%luT",
name, (unsigned long) cores, (unsigned long) threads);
}
else
{
/* Logical processor count cannot establish the physical core count. */
result = g_strdup_printf ("%s" SYSINFO_SEP "%luT", name, (unsigned long) threads);
}
g_free (name);
return result;
}
static char *
build_gpu_string (void)
{
IDXGIFactory1 *factory = NULL;
GPtrArray *adapters;
UINT index;
HRESULT hr;
char *result;
hr = CreateDXGIFactory1 (&IID_IDXGIFactory1, (void **) &factory);
if (FAILED (hr) || !factory)
{
return NULL;
}
adapters = g_ptr_array_new_with_free_func (g_free);
for (index = 0; ; index++)
{
IDXGIAdapter1 *adapter = NULL;
DXGI_ADAPTER_DESC1 desc;
char *name;
char *label;
hr = factory->lpVtbl->EnumAdapters1 (factory, index, &adapter);
if (hr == DXGI_ERROR_NOT_FOUND)
{
break;
}
if (FAILED (hr) || !adapter)
{
/* A failed enumeration is not another adapter. Retrying every
* index can freeze the client indefinitely after a device error. */
break;
}
ZeroMemory (&desc, sizeof (desc));
hr = adapter->lpVtbl->GetDesc1 (adapter, &desc);
adapter->lpVtbl->Release (adapter);
if (FAILED (hr) || (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE))
{
continue;
}
name = wide_to_utf8 (desc.Description);
if (!name)
{
continue;
}
g_strstrip (name);
if ((guint64) desc.DedicatedVideoMemory >= (512ULL * 1024ULL * 1024ULL))
{
char *vram = g_format_size_full ((guint64) desc.DedicatedVideoMemory, G_FORMAT_SIZE_IEC_UNITS);
label = g_strdup_printf ("%s (%s VRAM)", name, vram);
g_free (vram);
}
else
{
label = g_strdup (name);
}
ptr_array_add_unique (adapters, label);
g_free (label);
g_free (name);
}
factory->lpVtbl->Release (factory);
result = join_ptr_array (adapters, ", ");
g_ptr_array_free (adapters, TRUE);
return result;
}
static char *
build_sound_string (void)
{
UINT count;
UINT i;
GPtrArray *devices;
char *result;
count = waveOutGetNumDevs ();
if (count == 0)
{
return NULL;
}
devices = g_ptr_array_new_with_free_func (g_free);
for (i = 0; i < count; i++)
{
WAVEOUTCAPSW caps;
char *name;
ZeroMemory (&caps, sizeof (caps));
if (waveOutGetDevCapsW ((UINT_PTR) i, &caps, sizeof (caps)) != MMSYSERR_NOERROR)
{
continue;
}
name = wide_to_utf8 (caps.szPname);
if (name)
{
g_strstrip (name);
ptr_array_add_unique (devices, name);
g_free (name);
}
}
result = join_ptr_array (devices, ", ");
g_ptr_array_free (devices, TRUE);
return result;
}
static void
ensure_os_snapshot (void)
{
if (!os_initialized)
{
snapshot.os = build_os_string ();
os_initialized = TRUE;
}
}
static void
ensure_cpu_snapshot (void)
{
if (!cpu_initialized)
{
snapshot.cpu = build_cpu_string ();
cpu_initialized = TRUE;
}
}
static void
ensure_gpu_snapshot (void)
{
if (!gpu_initialized)
{
snapshot.gpu = build_gpu_string ();
gpu_initialized = TRUE;
}
}
static void
ensure_sound_snapshot (void)
{
if (!sound_initialized)
{
snapshot.sound = build_sound_string ();
sound_initialized = TRUE;
}
}
char *
sysinfo_backend_get_os (void)
{
ensure_os_snapshot ();
return g_strdup (snapshot.os);
}
char *
sysinfo_backend_get_cpu (void)
{
return sysinfo_get_cpu ();
}
char *
sysinfo_backend_get_memory (void)
{
/* Memory information is always loaded dynamically since it includes the current amount of free memory */
return get_memory_info ();
static const WCHAR cpu_key[] = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
DWORD mhz = 0;
ensure_cpu_snapshot ();
if (!snapshot.cpu)
return NULL;
/* The registry's reported MHz is not a guaranteed live or turbo clock. */
if (read_registry_dword (HKEY_LOCAL_MACHINE, cpu_key, L"~MHz", &mhz) && mhz && mhz <= 100000)
{
if (mhz >= 1000)
return g_strdup_printf ("%s" SYSINFO_SEP "reported %.2f GHz", snapshot.cpu, (double) mhz / 1000.0);
return g_strdup_printf ("%s" SYSINFO_SEP "reported %lu MHz", snapshot.cpu, (unsigned long) mhz);
}
return g_strdup (snapshot.cpu);
}
char *
sysinfo_backend_get_gpu (void)
{
return sysinfo_get_gpu ();
ensure_gpu_snapshot ();
return g_strdup (snapshot.gpu);
}
char *
sysinfo_backend_get_sound (void)
{
ensure_sound_snapshot ();
return g_strdup (snapshot.sound);
}
char *
@@ -96,43 +542,207 @@ sysinfo_backend_get_chipset (void)
}
char *
sysinfo_backend_get_os (void)
sysinfo_backend_get_memory (void)
{
return sysinfo_get_os ();
}
MEMORYSTATUSEX memory;
static char *get_memory_info (void)
{
MEMORYSTATUSEX meminfo = { 0 };
meminfo.dwLength = sizeof (meminfo);
if (!GlobalMemoryStatusEx (&meminfo))
ZeroMemory (&memory, sizeof (memory));
memory.dwLength = sizeof (memory);
if (!GlobalMemoryStatusEx (&memory))
{
return NULL;
}
return sysinfo_format_memory (meminfo.ullTotalPhys, meminfo.ullAvailPhys);
return format_usage ((guint64) memory.ullTotalPhys, (guint64) memory.ullAvailPhys);
}
static const char *sysinfo_detect_toolkit(void)
static gboolean
get_boot_disk_number (DWORD *number)
{
#if defined(USE_GTK_FRONTEND)
return "GTK3";
#else
return NULL;
#endif
WCHAR windows_dir[MAX_PATH];
WCHAR volume_path[MAX_PATH];
WCHAR volume_name[MAX_PATH];
UINT length;
HANDLE volume;
VOLUME_DISK_EXTENTS extents;
DWORD returned;
gboolean valid = FALSE;
/* Windows calls the volume containing Windows the boot volume. Resolve
* it to a volume GUID instead of assuming Windows is installed on C:. */
length = GetWindowsDirectoryW (windows_dir, G_N_ELEMENTS (windows_dir));
if (!length || length >= G_N_ELEMENTS (windows_dir) ||
!GetVolumePathNameW (windows_dir, volume_path, G_N_ELEMENTS (volume_path)) ||
GetDriveTypeW (volume_path) != DRIVE_FIXED ||
!GetVolumeNameForVolumeMountPointW (volume_path, volume_name, G_N_ELEMENTS (volume_name)))
return FALSE;
length = lstrlenW (volume_name);
if (!length || volume_name[length - 1] != L'\\')
return FALSE;
volume_name[length - 1] = L'\0';
volume = CreateFileW (volume_name, 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (volume == INVALID_HANDLE_VALUE)
return FALSE;
/* Refuse spanned volumes rather than choosing an arbitrary disk. */
if (DeviceIoControl (volume, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0,
&extents, sizeof (extents), &returned, NULL) && returned >= sizeof (extents) &&
extents.NumberOfDiskExtents == 1)
{
*number = extents.Extents[0].DiskNumber;
valid = TRUE;
}
CloseHandle (volume);
return valid;
}
char *
sysinfo_backend_get_disk (void)
{
DWORD number, returned, previous_mode = 0;
BOOL error_mode_changed;
DISK_GEOMETRY_EX geometry;
HANDLE disk;
char *path, *result = NULL;
error_mode_changed = SetThreadErrorMode (GetThreadErrorMode () | SEM_FAILCRITICALERRORS, &previous_mode);
if (get_boot_disk_number (&number))
{
/* The PhysicalDrive handle describes the complete disk, not a
* partition or filesystem. Request metadata access only. */
path = g_strdup_printf ("\\\\.\\PhysicalDrive%lu", (unsigned long) number);
disk = CreateFileA (path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
g_free (path);
if (disk != INVALID_HANDLE_VALUE)
{
if (DeviceIoControl (disk, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0,
&geometry, sizeof (geometry), &returned, NULL) &&
returned >= FIELD_OFFSET (DISK_GEOMETRY_EX, Data) && geometry.DiskSize.QuadPart > 0)
result = g_format_size ((guint64) geometry.DiskSize.QuadPart);
CloseHandle (disk);
}
}
if (error_mode_changed)
SetThreadErrorMode (previous_mode, NULL);
return result;
}
char *
sysinfo_backend_get_uptime (void)
{
return sysinfo_format_uptime ((gint64) (GetTickCount64 () / 1000ULL));
}
static gboolean
adapter_looks_virtual (const char *name)
{
char *lower;
gboolean result;
if (!name)
{
return FALSE;
}
lower = g_ascii_strdown (name, -1);
result = strstr (lower, "virtual") != NULL ||
strstr (lower, "hyper-v") != NULL ||
strstr (lower, "vmware") != NULL ||
strstr (lower, "virtualbox") != NULL ||
strstr (lower, "tap-windows") != NULL ||
strstr (lower, "wireguard") != NULL ||
strstr (lower, "vpn") != NULL;
g_free (lower);
return result;
}
char *
sysinfo_backend_get_network (void)
{
ULONG size = 16 * 1024;
ULONG status;
IP_ADAPTER_ADDRESSES *addresses;
IP_ADAPTER_ADDRESSES *adapter;
GPtrArray *physical;
GPtrArray *fallback;
GPtrArray *selected;
char *result;
addresses = g_malloc0 (size);
status = GetAdaptersAddresses (AF_UNSPEC,
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER,
NULL, addresses, &size);
if (status == ERROR_BUFFER_OVERFLOW)
{
g_free (addresses);
addresses = g_malloc0 (size);
status = GetAdaptersAddresses (AF_UNSPEC,
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER,
NULL, addresses, &size);
}
if (status != NO_ERROR)
{
g_free (addresses);
return NULL;
}
physical = g_ptr_array_new_with_free_func (g_free);
fallback = g_ptr_array_new_with_free_func (g_free);
for (adapter = addresses; adapter != NULL; adapter = adapter->Next)
{
char *description;
char *friendly;
const char *name;
const char *type;
char *label;
if (adapter->OperStatus != IfOperStatusUp || adapter->PhysicalAddressLength == 0)
{
continue;
}
if (adapter->IfType != IF_TYPE_ETHERNET_CSMACD && adapter->IfType != IF_TYPE_IEEE80211)
{
continue;
}
description = wide_to_utf8 (adapter->Description);
friendly = wide_to_utf8 (adapter->FriendlyName);
name = description && description[0] ? description : friendly;
if (!name)
{
g_free (description);
g_free (friendly);
continue;
}
type = adapter->IfType == IF_TYPE_IEEE80211 ? "Wi-Fi" : "Ethernet";
label = g_strdup_printf ("%s: %s", type, name);
ptr_array_add_unique (fallback, label);
if (!adapter_looks_virtual (name))
{
ptr_array_add_unique (physical, label);
}
g_free (label);
g_free (description);
g_free (friendly);
}
g_free (addresses);
selected = physical->len != 0 ? physical : fallback;
result = join_ptr_array (selected, ", ");
g_ptr_array_free (physical, TRUE);
g_ptr_array_free (fallback, TRUE);
return result;
}
char *
sysinfo_backend_get_ui (void)
{
const char *toolkit = sysinfo_detect_toolkit();
/* On Windows we don't have X11/Wayland. Keep it simple. */
if (toolkit)
{
return g_strdup_printf ("Windows / %s", toolkit);
}
#if defined(USE_GTK_FRONTEND)
return g_strdup ("Windows / GTK3");
#else
return g_strdup ("Windows");
#endif
}
+31
View File
@@ -300,6 +300,37 @@ char *xdir = NULL; /* utf-8 encoding */
#include <shlobj.h>
#endif
/* Resolve relative config paths before plugins can change the working directory. */
void
set_xdir (const char *path)
{
char *dir;
const char *root;
gsize len;
if (!*path || g_path_is_absolute (path)
#ifdef WIN32
|| (g_ascii_isalpha (path[0]) && path[1] == ':')
#endif
)
dir = g_strdup (path);
else
{
char *cwd = g_get_current_dir ();
dir = g_build_filename (cwd, path, NULL);
g_free (cwd);
}
/* Keep the existing trailing separator convention, but preserve roots. */
len = strlen (dir);
root = g_path_skip_root (dir);
if (len && G_IS_DIR_SEPARATOR (dir[len - 1]) && (!root || dir + len > root))
dir[len - 1] = '\0';
g_free (xdir);
xdir = dir;
}
char *
get_xdir (void)
{
+1
View File
@@ -36,6 +36,7 @@ int cfg_get_int (char *cfg, char *var);
int cfg_put_int (int fh, int value, char *var);
int cfg_get_color (char *cfg, char *var, guint16 *r, guint16 *g, guint16 *b);
int cfg_put_color (int fh, guint16 r, guint16 g, guint16 b, char *var);
void set_xdir (const char *path);
char *get_xdir (void);
int check_config_dir (void);
void load_default_config (void);
+4 -2
View File
@@ -3115,7 +3115,8 @@ cmd_notice (struct session *sess, char *tbuf, char *word[], char *word_eol[])
while ((split_text = split_up_text (sess, text + offset, cmd_length, split_text)))
{
sess->server->p_notice (sess->server, word[2], split_text);
EMIT_SIGNAL (XP_TE_NOTICESEND, sess, word[2], split_text, NULL, NULL, 0);
if (!sess->server->have_echo_message || split_text[0] == '\001')
EMIT_SIGNAL (XP_TE_NOTICESEND, sess, word[2], split_text, NULL, NULL, 0);
if (*split_text)
offset += strlen(split_text);
@@ -3124,7 +3125,8 @@ cmd_notice (struct session *sess, char *tbuf, char *word[], char *word_eol[])
}
sess->server->p_notice (sess->server, word[2], text + offset);
EMIT_SIGNAL (XP_TE_NOTICESEND, sess, word[2], text + offset, NULL, NULL, 0);
if (!sess->server->have_echo_message || text[offset] == '\001')
EMIT_SIGNAL (XP_TE_NOTICESEND, sess, word[2], text + offset, NULL, NULL, 0);
return TRUE;
}
+3
View File
@@ -1242,6 +1242,9 @@ zoitechat_get_info (zoitechat_plugin *ph, const char *id)
case 0x6de15a2e: /* network */
return server_get_network (sess->server, FALSE);
case 0xa089585f: /* echo-message */
return sess->server->have_echo_message ? "1" : "0";
case 0x339763: /* nick */
return sess->server->nick;
+18
View File
@@ -18,6 +18,7 @@
/* IRC RFC1459(+commonly used extensions) protocol implementation */
#define _POSIX_C_SOURCE 200809L
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -1305,6 +1306,19 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
}
#endif
/* Echoed notices are outgoing, not incoming notifications or CTCP replies. */
if (serv->have_echo_message && !serv->p_cmp (nick, serv->nick))
{
if (text[0] != '\001')
{
EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTICESEND, sess, word[3], text, NULL, NULL, 0,
tags_data->timestamp);
return;
}
if (serv->p_cmp (word[3], serv->nick))
return;
}
if (!ignore_check (word[1], IG_NOTI))
inbound_notice (serv, word[3], nick, text, ip, tags_data->identified, tags_data);
}
@@ -1334,6 +1348,10 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
text[len - 1] = 0;
}
text++;
/* Do not answer our own outgoing CTCP or DCC requests. */
if (serv->have_echo_message && !serv->p_cmp (nick, serv->nick) &&
serv->p_cmp (to, serv->nick) && g_ascii_strncasecmp (text, "ACTION ", 7))
return;
if (g_ascii_strncasecmp (text, "ACTION", 6) != 0)
flood_check (nick, ip, serv, sess, 0);
if (g_ascii_strncasecmp (text, "DCC ", 4) == 0)
+4
View File
@@ -21,6 +21,10 @@
* Inferno Nettverk A/S, Norway. All rights reserved.
*/
#ifndef WIN32
#define _POSIX_C_SOURCE 200809L
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+6 -8
View File
@@ -16,6 +16,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef WIN32
#define _POSIX_C_SOURCE 200809L
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -1215,21 +1219,15 @@ main (int argc, char *argv[])
if ((strcmp (argv[i], "-d") == 0 || strcmp (argv[i], "--cfgdir") == 0)
&& i + 1 < argc)
{
xdir = g_strdup (argv[i + 1]);
set_xdir (argv[i + 1]);
}
else if (strncmp (argv[i], "--cfgdir=", 9) == 0)
{
xdir = g_strdup (argv[i] + 9);
set_xdir (argv[i] + 9);
}
if (xdir != NULL)
{
if (xdir[strlen (xdir) - 1] == G_DIR_SEPARATOR)
{
xdir[strlen (xdir) - 1] = 0;
}
break;
}
}
}
@@ -92,8 +92,13 @@ notification_backend_init (const char **error)
char **capabilities;
guint i;
/* We never read properties or listen for signals. Loading properties makes
* proxy creation block on Properties.GetAll, which some notification
* daemons (e.g. awesome's naughty) never answer, freezing startup until
* the 25 second D-Bus timeout expires. */
fdo_notifications = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
NULL,
"org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
+44 -1
View File
@@ -2003,12 +2003,34 @@ gtk_xtext_word_select_char (const unsigned char *ch)
return g_unichar_isalnum (uc) || uc == '_' || uc == '-';
}
static int
gtk_xtext_color_code_len (const unsigned char *p, const unsigned char *lim)
{
const unsigned char *q = p + 1;
int n;
if (*p == ATTR_HEXCOLOR)
return 1 + hexcolor_parse ((const char *)q, (int)(lim - q), NULL, NULL, NULL);
if (*p != ATTR_COLOR)
return 0;
for (n = 0; n < 2 && q < lim && g_ascii_isdigit (*q); n++)
q++;
if (n && q + 1 < lim && *q == ',' && g_ascii_isdigit (q[1]))
{
q += 2;
if (q < lim && g_ascii_isdigit (*q))
q++;
}
return (int)(q - p);
}
static gboolean
gtk_xtext_get_word_select_range (GtkXText *xtext, int x, int y, textentry **ret_ent, int *ret_off, int *ret_len)
{
textentry *ent;
int offset;
unsigned char *start, *end;
unsigned char *start, *end, *p, *lim;
ent = gtk_xtext_find_char (xtext, x, y, &offset, NULL);
if (!ent || offset < 0 || offset >= ent->str_len)
@@ -2027,8 +2049,29 @@ gtk_xtext_get_word_select_range (GtkXText *xtext, int x, int y, textentry **ret_
start = prev;
}
/* The digits after a color code look like word characters, but they
are part of the code. Move the start past any code they belong to. */
lim = ent->str + ent->str_len;
for (p = ent->str; p < start; )
{
int n = gtk_xtext_color_code_len (p, lim);
if (!n)
{
p++;
continue;
}
if (p + n > start)
start = p + n;
p += n;
}
if (start > ent->str + offset)
return FALSE;
while (end && end < ent->str + ent->str_len && gtk_xtext_word_select_char (end))
end = g_utf8_find_next_char (end, ent->str + ent->str_len);
if (!end)
end = ent->str + ent->str_len;
if (ret_ent)
*ret_ent = ent;
+1 -4
View File
@@ -585,10 +585,7 @@ fe_args (int argc, char *argv[])
if (arg_cfgdir)
{
g_free (xdir);
xdir = g_strdup(arg_cfgdir);
if (xdir[strlen (xdir) - 1] == '/')
xdir[strlen (xdir) - 1] = 0;
set_xdir (arg_cfgdir);
g_free (arg_cfgdir);
}