updated on Sat Jan 14 12:12:45 UTC 2012
[aur-mirror.git] / xchat-xsys-noaudacious / no-audacious.patch
blob749234e7aa677536593b0196936cdaaebfbb5996
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
4 @@ -10,7 +10,6 @@
5 VER_PATCH = 0
6 CC = gcc
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
12 @@ -20,7 +19,7 @@
13 ALL : $(LIBRARY)
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
19 xsys.o : xsys.c
20 parse.o : parse.c
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
24 @@ -33,7 +33,6 @@
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
35 @@ -28,24 +28,17 @@
36 #include "parse.h"
37 #include "match.h"
38 #include "xsys.h"
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);
60 @@ -62,22 +55,17 @@
61 #if 0
62 static int hwmon_cb (char *word[], char *word_eol[], void *userdata);
63 #endif
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)
71 ph = plugin_handle;
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);
84 @@ -108,13 +96,6 @@
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);
87 #endif
88 - if (dbus_init())
89 - {
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);
93 - }
95 load_config();
97 xchat_printf(ph, "X-Sys %s Loaded Succesfully", VER_STRING);
98 @@ -122,11 +103,6 @@
99 return 1;
102 -static void xchat_plugin_deinit()
104 - /* blahblahblah */
107 static void save_config()
109 FILE *fp;
110 @@ -139,9 +115,7 @@
111 return;
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);
117 fclose(fp);
118 return;
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);
128 fclose(fp);
131 -static gboolean dbus_init(void)
133 - GError *error = NULL;
135 - connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
136 - if (connection == NULL)
137 - return FALSE;
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)
143 - return FALSE;
145 - return TRUE;
148 static int format_cb(char *word[], char *word_eol[], void *userdata)
150 if(*(word[2]) == '\0')
151 @@ -194,18 +149,6 @@
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);
159 - else
161 - strncpy(playing, word_eol[2], 42);
162 - save_config();
164 - return XCHAT_EAT_ALL;
167 static int percentages_cb(char *word[], char *word_eol[], void *userdata)
169 if(*(word[2]) == '\0')
170 @@ -221,21 +164,6 @@
171 return XCHAT_EAT_ALL;
174 -static int action_cb(char *word[], char *word_eol[], void *userdata)
176 - if(*(word[2]) == '\0')
177 - if (action != 0)
178 - xchat_printf(ph, "Now playing action currently enabled");
179 - else
180 - xchat_printf(ph, "Now playing action currently disabled");
181 - else
183 - action = atoi(word[2]);
184 - save_config();
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];
192 @@ -683,52 +611,3 @@
193 return XCHAT_EAT_ALL;
195 #endif
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);
214 - if (action != 0)
215 - flat_format_output(playing, title, format);
216 - else
217 - format_output(playing, title, format);
218 - strcat(title, "\017 ");
220 - if(len == -1)
221 - snprintf(length, 42, "%d:%02d/stream",
222 - ((pos/1000)-((pos/1000)%60))/60, (pos/1000)%60);
223 - else
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);
228 - if (action != 0)
229 - flat_format_output("length", length, format);
230 - else
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);
240 - else
241 - xchat_commandf(ph, "say %s", title);
243 - return XCHAT_EAT_ALL;