1 diff -uNr xsys-2.2.0.ORIG/Makefile xsys-2.2.0/Makefile
2 --- xsys-2.2.0.ORIG/Makefile 2008-01-30 11:53:56.000000000 +0000
3 +++ xsys-2.2.0/Makefile 2008-01-30 11:59:39.000000000 +0000
7 CFLAGS += -O2 -Wall -fPIC
8 -CFLAGS += $(shell pkg-config dbus-1 --cflags) $(shell pkg-config glib-2.0 --cflags)
9 CFLAGS += -DVER_MINOR=$(VER_MINOR) -DVER_MAJOR=$(VER_MAJOR) -DVER_PATCH=$(VER_PATCH) \
10 -DVER_STRING=\"$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)\" -DPCIIDS=\"$(PCIIDS)\" $(BUTTON)
11 LDFLAGS = $(CFLAGS) -shared
15 $(LIBRARY) : $(OBJECTS)
16 - $(CC) $(LDFLAGS) -o $(LIBRARY) $(OBJECTS) -lpci $(shell pkg-config dbus-1 --libs) $(shell pkg-config glib-2.0 --libs) -laudclient
17 + $(CC) $(LDFLAGS) -o $(LIBRARY) $(OBJECTS) -lpci
21 diff -uNr xsys-2.2.0.ORIG/parse.h xsys-2.2.0/parse.h
22 --- xsys-2.2.0.ORIG/parse.h 2008-01-30 11:53:56.000000000 +0000
23 +++ xsys-2.2.0/parse.h 2008-01-30 11:58:03.000000000 +0000
25 int xs_parse_video(char *vid_card);
26 int xs_parse_agpbridge(char *agp_bridge);
27 int xs_parse_ether(char *ethernet_card);
28 -int xs_parse_xmms_info(char **title, unsigned int *songtime, unsigned int *playtime);
29 int xs_parse_distro(char *name);
30 int xs_parse_hwmon_chip(char *chip);
31 int xs_parse_hwmon_temp(char *temp, unsigned int *sensor);
32 diff -uNr xsys-2.2.0.ORIG/xsys.c xsys-2.2.0/xsys.c
33 --- xsys-2.2.0.ORIG/xsys.c 2008-01-30 11:53:56.000000000 +0000
34 +++ xsys-2.2.0/xsys.c 2008-01-30 12:00:36.000000000 +0000
39 -#include <audacious/dbus.h>
40 -#include <audacious/audctrl.h>
42 static xchat_plugin *ph;
44 static char format[bsize] = "%B%1%B[%2]";
45 -static char playing[42] = "now_playing";
46 unsigned int percentages = 1;
47 -static unsigned int action = 0;
49 static void load_config();
50 static void save_config();
51 -static gboolean dbus_init(void);
53 static int format_cb (char *word[], char *word_eol[], void *userdata);
54 -static int playing_cb (char *word[], char *word_eol[], void *userdata);
55 static int percentages_cb (char *word[], char *word_eol[], void *userdata);
56 -static int action_cb (char *word[], char *word_eol[], void *userdata);
57 static int sysinfo_cb (char *word[], char *word_eol[], void *userdata);
58 static int xsys_cb (char *word[], char *word_eol[], void *userdata);
59 static int cpuinfo_cb (char *word[], char *word_eol[], void *userdata);
62 static int hwmon_cb (char *word[], char *word_eol[], void *userdata);
64 -static int np_cb (char *word[], char *word_eol[], void *userdata);
65 -static DBusGProxy *dbus_proxy = NULL;
66 -static DBusGConnection *connection = NULL;
68 int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name,
69 char **plugin_desc, char **plugin_version, char *arg)
72 *plugin_name = "X-Sys_2";
73 - *plugin_desc = "A sysinfo/audacious plugin";
74 + *plugin_desc = "A sysinfo plugin";
75 *plugin_version = VER_STRING;
77 xchat_hook_command(ph, "XSYS2FORMAT",XCHAT_PRI_NORM, format_cb, NULL, NULL);
78 - xchat_hook_command(ph, "PLAYING", XCHAT_PRI_NORM, playing_cb, NULL, NULL);
79 xchat_hook_command(ph, "PERCENTAGES",XCHAT_PRI_NORM, percentages_cb, NULL, NULL);
80 - xchat_hook_command(ph, "NPACTION", XCHAT_PRI_NORM, action_cb, NULL, NULL);
81 xchat_hook_command(ph, "SYSINFO", XCHAT_PRI_NORM, sysinfo_cb, NULL, (void *) 0);
82 xchat_hook_command(ph, "ESYSINFO", XCHAT_PRI_NORM, sysinfo_cb, NULL, (void *) 1);
83 xchat_hook_command(ph, "XSYS", XCHAT_PRI_NORM, xsys_cb, NULL, (void *) 0);
85 xchat_hook_command(ph, "HWMON", XCHAT_PRI_NORM, hwmon_cb, NULL, (void *) 0);
86 xchat_hook_command(ph, "EHWMON", XCHAT_PRI_NORM, hwmon_cb, NULL, (void *) 1);
90 - xchat_hook_command(ph, "NP", XCHAT_PRI_NORM, np_cb, NULL, (void *) 0);
91 - xchat_hook_command(ph, "ENP", XCHAT_PRI_NORM, np_cb, NULL, (void *) 1);
92 - xchat_printf(ph, "D-Bus MPRIS support initialized", VER_STRING);
97 xchat_printf(ph, "X-Sys %s Loaded Succesfully", VER_STRING);
102 -static void xchat_plugin_deinit()
107 static void save_config()
113 fprintf(fp, "format: %s\n", format);
114 - fprintf(fp, "playing: %s\n", playing);
115 fprintf(fp, "percentages: %i\n", percentages);
116 - fprintf(fp, "action: %i\n", action);
120 @@ -158,30 +132,11 @@
121 while(fgets(buffer, bsize, fp) != NULL)
123 find_match_char(buffer, "format", format);
124 - find_match_char(buffer, "playing", playing);
125 find_match_int(buffer, "percentages", &percentages);
126 - find_match_int(buffer, "action", &action);
131 -static gboolean dbus_init(void)
133 - GError *error = NULL;
135 - connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
136 - if (connection == NULL)
139 - dbus_proxy = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE,
140 - AUDACIOUS_DBUS_PATH,
141 - AUDACIOUS_DBUS_INTERFACE);
142 - if (dbus_proxy == NULL)
148 static int format_cb(char *word[], char *word_eol[], void *userdata)
150 if(*(word[2]) == '\0')
152 return XCHAT_EAT_ALL;
155 -static int playing_cb(char *word[], char *word_eol[], void *userdata)
157 - if(*(word[2]) == '\0')
158 - xchat_printf(ph, "Current playing string:\n%s", playing);
161 - strncpy(playing, word_eol[2], 42);
164 - return XCHAT_EAT_ALL;
167 static int percentages_cb(char *word[], char *word_eol[], void *userdata)
169 if(*(word[2]) == '\0')
171 return XCHAT_EAT_ALL;
174 -static int action_cb(char *word[], char *word_eol[], void *userdata)
176 - if(*(word[2]) == '\0')
178 - xchat_printf(ph, "Now playing action currently enabled");
180 - xchat_printf(ph, "Now playing action currently disabled");
183 - action = atoi(word[2]);
186 - return XCHAT_EAT_ALL;
189 static int sysinfo_cb(char *word[], char *word_eol[], void *userdata)
191 char sysinfo[bsize], buffer[bsize], cpu_model[bsize], cpu_cache[bsize], cpu_vendor[bsize];
193 return XCHAT_EAT_ALL;
197 -static int np_cb(char *word[], char *word_eol[], void *userdata)
199 - char *buffer = NULL, title[bsize], length[42];
200 - int pos, len, p = audacious_remote_get_playlist_pos(dbus_proxy);
202 - if (!audacious_remote_is_running(dbus_proxy))
204 - xchat_printf(ph, "Audacious is not currently running");
205 - return XCHAT_EAT_ALL;
208 - pos = audacious_remote_get_output_time(dbus_proxy);
209 - len = audacious_remote_get_playlist_time(dbus_proxy, p);
210 - buffer = decruft_filename(audacious_remote_get_playlist_title(dbus_proxy, p));
212 - strncpy(title, buffer, bsize);
215 - flat_format_output(playing, title, format);
217 - format_output(playing, title, format);
218 - strcat(title, "\017 ");
221 - snprintf(length, 42, "%d:%02d/stream",
222 - ((pos/1000)-((pos/1000)%60))/60, (pos/1000)%60);
224 - snprintf(length, 42, "%d:%02d/%d:%02d",
225 - ((pos/1000)-((pos/1000)%60))/60, (pos/1000)%60,
226 - ((len/1000)-((len/1000)%60))/60, (len/1000)%60);
229 - flat_format_output("length", length, format);
231 - format_output("length", length, format);
232 - strncat(title, length, bsize);
234 - if ((action != 0) && (long)userdata)
235 - xchat_printf(ph, "You are %s", title);
236 - else if (action != 0)
237 - xchat_commandf(ph, "me is %s", title);
238 - else if ((long)userdata)
239 - xchat_printf(ph, "%s", title);
241 - xchat_commandf(ph, "say %s", title);
243 - return XCHAT_EAT_ALL;