Merge lp:~cando/zeitgeist-datasources/xchat_dataprovider into lp:zeitgeist-datasources/0.8
- xchat_dataprovider
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 107 |
Proposed branch: | lp:~cando/zeitgeist-datasources/xchat_dataprovider |
Merge into: | lp:zeitgeist-datasources/0.8 |
Diff against target: |
578 lines (+537/-1) 4 files modified
configure.ac (+11/-1) xchat/Makefile.am (+35/-0) xchat/xchat-plugin.h (+334/-0) xchat/zeitgeist-dataprovider.c (+157/-0) |
To merge this branch: | bzr merge lp:~cando/zeitgeist-datasources/xchat_dataprovider |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Manish Sinha (मनीष सिन्हा) | distcheck build | Approve | |
Mikkel Kamstrup Erlandsen (community) | Approve | ||
Review via email: mp+45712@code.launchpad.net |
Commit message
Description of the change
In this branch i've added the xchat dataprovider.
It works flawlessy, but still i've some doubt regarding event and subject interpretation,
Stefano Candori (cando) wrote : | # |
Seif Lotfy (seif) wrote : | # |
We require send and receive events
On Mon, Jan 10, 2011 at 6:46 PM, Stefano Candori
<email address hidden>wrote:
> Other doubt: should the dataprovider send also message events???
> IMHO it would be only an unuseful flooding...what do you think?
> --
>
> https:/
> Your team Zeitgeist Data-Sources Team is requested to review the proposed
> merge of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider into
> lp:zeitgeist-dataproviders.
>
--
This is me doing some advertisement for my blog http://
Stefano Candori (cando) wrote : | # |
ok..so we need:
* join event
* part event
* send message
* private-receive message( i mean the messages where compare our nick)
2011/1/10 Seif Lotfy <email address hidden>
> We require send and receive events
>
> On Mon, Jan 10, 2011 at 6:46 PM, Stefano Candori
> <email address hidden>wrote:
>
> > Other doubt: should the dataprovider send also message events???
> > IMHO it would be only an unuseful flooding...what do you think?
> > --
> >
> >
> https:/
> > Your team Zeitgeist Data-Sources Team is requested to review the proposed
> > merge of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider into
> > lp:zeitgeist-dataproviders.
> >
>
>
>
> --
> This is me doing some advertisement for my blog http://
>
>
> https:/
> You are the owner of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider.
>
Seif Lotfy (seif) wrote : | # |
how do u join (acces_event)?
On Mon, Jan 10, 2011 at 7:01 PM, Stefano Candori
<email address hidden>wrote:
> ok..so we need:
> * join event
> * part event
> * send message
> * private-receive message( i mean the messages where compare our nick)
>
> 2011/1/10 Seif Lotfy <email address hidden>
>
> > We require send and receive events
> >
> > On Mon, Jan 10, 2011 at 6:46 PM, Stefano Candori
> > <email address hidden>wrote:
> >
> > > Other doubt: should the dataprovider send also message events???
> > > IMHO it would be only an unuseful flooding...what do you think?
> > > --
> > >
> > >
> >
> https:/
> > > Your team Zeitgeist Data-Sources Team is requested to review the
> proposed
> > > merge of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider into
> > > lp:zeitgeist-dataproviders.
> > >
> >
> >
> >
> > --
> > This is me doing some advertisement for my blog
> http://
> >
> >
> >
> https:/
> > You are the owner of
> lp:~cando/zeitgeist-dataproviders/xchat_dataprovider.
> >
>
> --
>
> https:/
> Your team Zeitgeist Data-Sources Team is requested to review the proposed
> merge of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider into
> lp:zeitgeist-dataproviders.
>
--
This is me doing some advertisement for my blog http://
Seif Lotfy (seif) wrote : | # |
OK those sound very fine... logging everything on a channel is BS
On Mon, Jan 10, 2011 at 7:05 PM, Seif Lotfy <email address hidden> wrote:
> how do u join (acces_event)?
>
>
> On Mon, Jan 10, 2011 at 7:01 PM, Stefano Candori <
> <email address hidden>> wrote:
>
>> ok..so we need:
>> * join event
>> * part event
>> * send message
>> * private-receive message( i mean the messages where compare our nick)
>>
>> 2011/1/10 Seif Lotfy <email address hidden>
>>
>> > We require send and receive events
>> >
>> > On Mon, Jan 10, 2011 at 6:46 PM, Stefano Candori
>> > <email address hidden>wrote:
>> >
>> > > Other doubt: should the dataprovider send also message events???
>> > > IMHO it would be only an unuseful flooding...what do you think?
>> > > --
>> > >
>> > >
>> >
>> https:/
>> > > Your team Zeitgeist Data-Sources Team is requested to review the
>> proposed
>> > > merge of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider into
>> > > lp:zeitgeist-dataproviders.
>> > >
>> >
>> >
>> >
>> > --
>> > This is me doing some advertisement for my blog
>> http://
>> >
>> >
>> >
>> https:/
>> > You are the owner of
>> lp:~cando/zeitgeist-dataproviders/xchat_dataprovider.
>> >
>>
>> --
>>
>> https:/
>> Your team Zeitgeist Data-Sources Team is requested to review the proposed
>> merge of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider into
>> lp:zeitgeist-dataproviders.
>>
>
>
>
> --
> This is me doing some advertisement for my blog http://
>
--
This is me doing some advertisement for my blog http://
Mikkel Kamstrup Erlandsen (kamstrup) wrote : | # |
Looks ok from a technical standpoint, and I think that the choices of manifestations and interpretations are reasonable within our current set of possible values (I don't think they are spot on, but they are as good as you can get with our current ontology).
You may want to put the logged messages in the past tense ala "You joined ..." and "You parted" (right now they are just "join" and "part").
Since we have textual contents in the log statements there's also a question of i18n of course, but that's ceretainly no blocker for this merge rq.
Nice work Stefano!
- 104. By Stefano Candori
-
Add message event support
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Work perfectly.
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Scratch that earlier approve. make distcheck fails
Making all in xchat
make[2]: Entering directory `/home/
CC zeitgeist_
../../xchat/
compilation terminated.
make[2]: *** [zeitgeist_
make[2]: Leaving directory `/home/
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/
make: *** [distcheck] Error 1
Stefano Candori (cando) wrote : | # |
ops...i'll check it tomorrow...i'm not an expert but maybe an EXTRA_DIST for
xchat-plugin.h should fix that...
2011/1/10 Manish Sinha (मनीष सिन्हा <email address hidden>
> Review: Needs Fixing distcheck
> Scratch that earlier approve. make distcheck fails
>
>
>
> Making all in xchat
> make[2]: Entering directory
> `/home/
> CC zeitgeist_
> ../../xchat/
> such file or directory
> compilation terminated.
> make[2]: *** [zeitgeist_
> make[2]: Leaving directory
> `/home/
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory
> `/home/
> make: *** [distcheck] Error 1
>
> --
>
> https:/
> You are the owner of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider
- 105. By Stefano Candori
-
Added private message received event and fixed distcheck for xchat data-provider
Stefano Candori (cando) wrote : | # |
ok manish,check it out.With EXTRA_DIST here 'make checkdist' terminates succesfully.
- 106. By Stefano Candori
-
Comment debug
- 107. By Stefano Candori
-
Quick fix on subject text in xchat_dataprovider
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Tried. It works
Preview Diff
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2010-12-09 12:54:26 +0000 |
3 | +++ configure.ac 2011-01-11 00:22:15 +0000 |
4 | @@ -65,7 +65,7 @@ |
5 | AC_MSG_RESULT($all_plugins) |
6 | |
7 | # The full list of plugins |
8 | -allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs tomboy telepathy" |
9 | +allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs tomboy telepathy xchat" |
10 | # currently disabled = "epiphany" |
11 | |
12 | # npapi-plugin has a template Makefile.am, but don't use it directly |
13 | @@ -225,6 +225,12 @@ |
14 | ;; |
15 | telepathy) |
16 | ;; |
17 | + xchat) |
18 | + if test "${HAVE_LIBZG}" != "yes" ; then |
19 | + plugin_error_or_ignore "libzeitgeist not found" |
20 | + continue |
21 | + fi |
22 | + ;; |
23 | *) |
24 | plugin_error_or_ignore "${plugin} is not handled" |
25 | continue |
26 | @@ -314,6 +320,10 @@ |
27 | AC_CONFIG_FILES([telepathy/Makefile]) |
28 | continue 2 |
29 | ;; |
30 | + xchat) |
31 | + AC_CONFIG_FILES([xchat/Makefile]) |
32 | + continue 2 |
33 | + ;; |
34 | *) |
35 | AC_MSG_ERROR([cannot configure ${allowed_plugin}]) |
36 | continue 2 |
37 | |
38 | === added directory 'xchat' |
39 | === added file 'xchat/Makefile.am' |
40 | --- xchat/Makefile.am 1970-01-01 00:00:00 +0000 |
41 | +++ xchat/Makefile.am 2011-01-11 00:22:15 +0000 |
42 | @@ -0,0 +1,35 @@ |
43 | +EXTRA_DIST = xchat-plugin.h |
44 | + |
45 | +xchatpluginbinarydir = $(libdir)/xchat/plugins |
46 | +xchatpluginbinary_LTLIBRARIES = zeitgeist_dataprovider.la |
47 | + |
48 | +zeitgeist_dataprovider_la_SOURCES = \ |
49 | + zeitgeist-dataprovider.c |
50 | +zeitgeist_dataprovider_la_CFLAGS = \ |
51 | + -Wl,--export-dynamic -Wall -O1 -shared -fPIC \ |
52 | + $(ZEITGEIST_CFLAGS) \ |
53 | + $(NULL) |
54 | + |
55 | +zeitgeist_dataprovider_la_LIBADD = \ |
56 | + $(ZEITGEIST_LIBS) \ |
57 | + $(NULL) |
58 | +zeitgeist_dataprovider_la_LDFLAGS = \ |
59 | + -module -avoid-version \ |
60 | + $(NULL) |
61 | + |
62 | +# we want to allow also local install |
63 | +XCHAT_PLUGIN_HOME_DIR = ~/.xchat2 |
64 | + |
65 | +PLUGIN_FILES = ./.libs/zeitgeist_dataprovider.so |
66 | + |
67 | +local-install: |
68 | + mkdir -p $(XCHAT_PLUGIN_HOME_DIR) |
69 | + cp $(PLUGIN_FILES) $(XCHAT_PLUGIN_HOME_DIR) |
70 | + |
71 | +local-uninstall: |
72 | + for f in $(PLUGIN_FILES); \ |
73 | + do \ |
74 | + echo remove $$f; \ |
75 | + rm -f $(XCHAT_PLUGIN_HOME_DIR)/$$f; \ |
76 | + done |
77 | + |
78 | |
79 | === added file 'xchat/xchat-plugin.h' |
80 | --- xchat/xchat-plugin.h 1970-01-01 00:00:00 +0000 |
81 | +++ xchat/xchat-plugin.h 2011-01-11 00:22:15 +0000 |
82 | @@ -0,0 +1,334 @@ |
83 | +/* You can distribute this header with your plugins for easy compilation */ |
84 | +#ifndef XCHAT_PLUGIN_H |
85 | +#define XCHAT_PLUGIN_H |
86 | + |
87 | +#include <time.h> |
88 | + |
89 | +#define XCHAT_IFACE_MAJOR 1 |
90 | +#define XCHAT_IFACE_MINOR 9 |
91 | +#define XCHAT_IFACE_MICRO 11 |
92 | +#define XCHAT_IFACE_VERSION ((XCHAT_IFACE_MAJOR * 10000) + \ |
93 | + (XCHAT_IFACE_MINOR * 100) + \ |
94 | + (XCHAT_IFACE_MICRO)) |
95 | + |
96 | +#define XCHAT_PRI_HIGHEST 127 |
97 | +#define XCHAT_PRI_HIGH 64 |
98 | +#define XCHAT_PRI_NORM 0 |
99 | +#define XCHAT_PRI_LOW (-64) |
100 | +#define XCHAT_PRI_LOWEST (-128) |
101 | + |
102 | +#define XCHAT_FD_READ 1 |
103 | +#define XCHAT_FD_WRITE 2 |
104 | +#define XCHAT_FD_EXCEPTION 4 |
105 | +#define XCHAT_FD_NOTSOCKET 8 |
106 | + |
107 | +#define XCHAT_EAT_NONE 0 /* pass it on through! */ |
108 | +#define XCHAT_EAT_XCHAT 1 /* don't let xchat see this event */ |
109 | +#define XCHAT_EAT_PLUGIN 2 /* don't let other plugins see this event */ |
110 | +#define XCHAT_EAT_ALL (XCHAT_EAT_XCHAT|XCHAT_EAT_PLUGIN) /* don't let anything see this event */ |
111 | + |
112 | +#ifdef __cplusplus |
113 | +extern "C" { |
114 | +#endif |
115 | + |
116 | +typedef struct _xchat_plugin xchat_plugin; |
117 | +typedef struct _xchat_list xchat_list; |
118 | +typedef struct _xchat_hook xchat_hook; |
119 | +#ifndef PLUGIN_C |
120 | +typedef struct _xchat_context xchat_context; |
121 | +#endif |
122 | + |
123 | +#ifndef PLUGIN_C |
124 | +struct _xchat_plugin |
125 | +{ |
126 | + /* these are only used on win32 */ |
127 | + xchat_hook *(*xchat_hook_command) (xchat_plugin *ph, |
128 | + const char *name, |
129 | + int pri, |
130 | + int (*callback) (char *word[], char *word_eol[], void *user_data), |
131 | + const char *help_text, |
132 | + void *userdata); |
133 | + xchat_hook *(*xchat_hook_server) (xchat_plugin *ph, |
134 | + const char *name, |
135 | + int pri, |
136 | + int (*callback) (char *word[], char *word_eol[], void *user_data), |
137 | + void *userdata); |
138 | + xchat_hook *(*xchat_hook_print) (xchat_plugin *ph, |
139 | + const char *name, |
140 | + int pri, |
141 | + int (*callback) (char *word[], void *user_data), |
142 | + void *userdata); |
143 | + xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph, |
144 | + int timeout, |
145 | + int (*callback) (void *user_data), |
146 | + void *userdata); |
147 | + xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph, |
148 | + int fd, |
149 | + int flags, |
150 | + int (*callback) (int fd, int flags, void *user_data), |
151 | + void *userdata); |
152 | + void *(*xchat_unhook) (xchat_plugin *ph, |
153 | + xchat_hook *hook); |
154 | + void (*xchat_print) (xchat_plugin *ph, |
155 | + const char *text); |
156 | + void (*xchat_printf) (xchat_plugin *ph, |
157 | + const char *format, ...); |
158 | + void (*xchat_command) (xchat_plugin *ph, |
159 | + const char *command); |
160 | + void (*xchat_commandf) (xchat_plugin *ph, |
161 | + const char *format, ...); |
162 | + int (*xchat_nickcmp) (xchat_plugin *ph, |
163 | + const char *s1, |
164 | + const char *s2); |
165 | + int (*xchat_set_context) (xchat_plugin *ph, |
166 | + xchat_context *ctx); |
167 | + xchat_context *(*xchat_find_context) (xchat_plugin *ph, |
168 | + const char *servname, |
169 | + const char *channel); |
170 | + xchat_context *(*xchat_get_context) (xchat_plugin *ph); |
171 | + const char *(*xchat_get_info) (xchat_plugin *ph, |
172 | + const char *id); |
173 | + int (*xchat_get_prefs) (xchat_plugin *ph, |
174 | + const char *name, |
175 | + const char **string, |
176 | + int *integer); |
177 | + xchat_list * (*xchat_list_get) (xchat_plugin *ph, |
178 | + const char *name); |
179 | + void (*xchat_list_free) (xchat_plugin *ph, |
180 | + xchat_list *xlist); |
181 | + const char * const * (*xchat_list_fields) (xchat_plugin *ph, |
182 | + const char *name); |
183 | + int (*xchat_list_next) (xchat_plugin *ph, |
184 | + xchat_list *xlist); |
185 | + const char * (*xchat_list_str) (xchat_plugin *ph, |
186 | + xchat_list *xlist, |
187 | + const char *name); |
188 | + int (*xchat_list_int) (xchat_plugin *ph, |
189 | + xchat_list *xlist, |
190 | + const char *name); |
191 | + void * (*xchat_plugingui_add) (xchat_plugin *ph, |
192 | + const char *filename, |
193 | + const char *name, |
194 | + const char *desc, |
195 | + const char *version, |
196 | + char *reserved); |
197 | + void (*xchat_plugingui_remove) (xchat_plugin *ph, |
198 | + void *handle); |
199 | + int (*xchat_emit_print) (xchat_plugin *ph, |
200 | + const char *event_name, ...); |
201 | + int (*xchat_read_fd) (xchat_plugin *ph, |
202 | + void *src, |
203 | + char *buf, |
204 | + int *len); |
205 | + time_t (*xchat_list_time) (xchat_plugin *ph, |
206 | + xchat_list *xlist, |
207 | + const char *name); |
208 | + char *(*xchat_gettext) (xchat_plugin *ph, |
209 | + const char *msgid); |
210 | + void (*xchat_send_modes) (xchat_plugin *ph, |
211 | + const char **targets, |
212 | + int ntargets, |
213 | + int modes_per_line, |
214 | + char sign, |
215 | + char mode); |
216 | + char *(*xchat_strip) (xchat_plugin *ph, |
217 | + const char *str, |
218 | + int len, |
219 | + int flags); |
220 | + void (*xchat_free) (xchat_plugin *ph, |
221 | + void *ptr); |
222 | +}; |
223 | +#endif |
224 | + |
225 | + |
226 | +xchat_hook * |
227 | +xchat_hook_command (xchat_plugin *ph, |
228 | + const char *name, |
229 | + int pri, |
230 | + int (*callback) (char *word[], char *word_eol[], void *user_data), |
231 | + const char *help_text, |
232 | + void *userdata); |
233 | + |
234 | +xchat_hook * |
235 | +xchat_hook_server (xchat_plugin *ph, |
236 | + const char *name, |
237 | + int pri, |
238 | + int (*callback) (char *word[], char *word_eol[], void *user_data), |
239 | + void *userdata); |
240 | + |
241 | +xchat_hook * |
242 | +xchat_hook_print (xchat_plugin *ph, |
243 | + const char *name, |
244 | + int pri, |
245 | + int (*callback) (char *word[], void *user_data), |
246 | + void *userdata); |
247 | + |
248 | +xchat_hook * |
249 | +xchat_hook_timer (xchat_plugin *ph, |
250 | + int timeout, |
251 | + int (*callback) (void *user_data), |
252 | + void *userdata); |
253 | + |
254 | +xchat_hook * |
255 | +xchat_hook_fd (xchat_plugin *ph, |
256 | + int fd, |
257 | + int flags, |
258 | + int (*callback) (int fd, int flags, void *user_data), |
259 | + void *userdata); |
260 | + |
261 | +void * |
262 | +xchat_unhook (xchat_plugin *ph, |
263 | + xchat_hook *hook); |
264 | + |
265 | +void |
266 | +xchat_print (xchat_plugin *ph, |
267 | + const char *text); |
268 | + |
269 | +void |
270 | +xchat_printf (xchat_plugin *ph, |
271 | + const char *format, ...); |
272 | + |
273 | +void |
274 | +xchat_command (xchat_plugin *ph, |
275 | + const char *command); |
276 | + |
277 | +void |
278 | +xchat_commandf (xchat_plugin *ph, |
279 | + const char *format, ...); |
280 | + |
281 | +int |
282 | +xchat_nickcmp (xchat_plugin *ph, |
283 | + const char *s1, |
284 | + const char *s2); |
285 | + |
286 | +int |
287 | +xchat_set_context (xchat_plugin *ph, |
288 | + xchat_context *ctx); |
289 | + |
290 | +xchat_context * |
291 | +xchat_find_context (xchat_plugin *ph, |
292 | + const char *servname, |
293 | + const char *channel); |
294 | + |
295 | +xchat_context * |
296 | +xchat_get_context (xchat_plugin *ph); |
297 | + |
298 | +const char * |
299 | +xchat_get_info (xchat_plugin *ph, |
300 | + const char *id); |
301 | + |
302 | +int |
303 | +xchat_get_prefs (xchat_plugin *ph, |
304 | + const char *name, |
305 | + const char **string, |
306 | + int *integer); |
307 | + |
308 | +xchat_list * |
309 | +xchat_list_get (xchat_plugin *ph, |
310 | + const char *name); |
311 | + |
312 | +void |
313 | +xchat_list_free (xchat_plugin *ph, |
314 | + xchat_list *xlist); |
315 | + |
316 | +const char * const * |
317 | +xchat_list_fields (xchat_plugin *ph, |
318 | + const char *name); |
319 | + |
320 | +int |
321 | +xchat_list_next (xchat_plugin *ph, |
322 | + xchat_list *xlist); |
323 | + |
324 | +const char * |
325 | +xchat_list_str (xchat_plugin *ph, |
326 | + xchat_list *xlist, |
327 | + const char *name); |
328 | + |
329 | +int |
330 | +xchat_list_int (xchat_plugin *ph, |
331 | + xchat_list *xlist, |
332 | + const char *name); |
333 | + |
334 | +time_t |
335 | +xchat_list_time (xchat_plugin *ph, |
336 | + xchat_list *xlist, |
337 | + const char *name); |
338 | + |
339 | +void * |
340 | +xchat_plugingui_add (xchat_plugin *ph, |
341 | + const char *filename, |
342 | + const char *name, |
343 | + const char *desc, |
344 | + const char *version, |
345 | + char *reserved); |
346 | + |
347 | +void |
348 | +xchat_plugingui_remove (xchat_plugin *ph, |
349 | + void *handle); |
350 | + |
351 | +int |
352 | +xchat_emit_print (xchat_plugin *ph, |
353 | + const char *event_name, ...); |
354 | + |
355 | +char * |
356 | +xchat_gettext (xchat_plugin *ph, |
357 | + const char *msgid); |
358 | + |
359 | +void |
360 | +xchat_send_modes (xchat_plugin *ph, |
361 | + const char **targets, |
362 | + int ntargets, |
363 | + int modes_per_line, |
364 | + char sign, |
365 | + char mode); |
366 | + |
367 | +char * |
368 | +xchat_strip (xchat_plugin *ph, |
369 | + const char *str, |
370 | + int len, |
371 | + int flags); |
372 | + |
373 | +void |
374 | +xchat_free (xchat_plugin *ph, |
375 | + void *ptr); |
376 | + |
377 | +#if !defined(PLUGIN_C) && defined(WIN32) |
378 | +#ifndef XCHAT_PLUGIN_HANDLE |
379 | +#define XCHAT_PLUGIN_HANDLE (ph) |
380 | +#endif |
381 | +#define xchat_hook_command ((XCHAT_PLUGIN_HANDLE)->xchat_hook_command) |
382 | +#define xchat_hook_server ((XCHAT_PLUGIN_HANDLE)->xchat_hook_server) |
383 | +#define xchat_hook_print ((XCHAT_PLUGIN_HANDLE)->xchat_hook_print) |
384 | +#define xchat_hook_timer ((XCHAT_PLUGIN_HANDLE)->xchat_hook_timer) |
385 | +#define xchat_hook_fd ((XCHAT_PLUGIN_HANDLE)->xchat_hook_fd) |
386 | +#define xchat_unhook ((XCHAT_PLUGIN_HANDLE)->xchat_unhook) |
387 | +#define xchat_print ((XCHAT_PLUGIN_HANDLE)->xchat_print) |
388 | +#define xchat_printf ((XCHAT_PLUGIN_HANDLE)->xchat_printf) |
389 | +#define xchat_command ((XCHAT_PLUGIN_HANDLE)->xchat_command) |
390 | +#define xchat_commandf ((XCHAT_PLUGIN_HANDLE)->xchat_commandf) |
391 | +#define xchat_nickcmp ((XCHAT_PLUGIN_HANDLE)->xchat_nickcmp) |
392 | +#define xchat_set_context ((XCHAT_PLUGIN_HANDLE)->xchat_set_context) |
393 | +#define xchat_find_context ((XCHAT_PLUGIN_HANDLE)->xchat_find_context) |
394 | +#define xchat_get_context ((XCHAT_PLUGIN_HANDLE)->xchat_get_context) |
395 | +#define xchat_get_info ((XCHAT_PLUGIN_HANDLE)->xchat_get_info) |
396 | +#define xchat_get_prefs ((XCHAT_PLUGIN_HANDLE)->xchat_get_prefs) |
397 | +#define xchat_list_get ((XCHAT_PLUGIN_HANDLE)->xchat_list_get) |
398 | +#define xchat_list_free ((XCHAT_PLUGIN_HANDLE)->xchat_list_free) |
399 | +#define xchat_list_fields ((XCHAT_PLUGIN_HANDLE)->xchat_list_fields) |
400 | +#define xchat_list_str ((XCHAT_PLUGIN_HANDLE)->xchat_list_str) |
401 | +#define xchat_list_int ((XCHAT_PLUGIN_HANDLE)->xchat_list_int) |
402 | +#define xchat_list_time ((XCHAT_PLUGIN_HANDLE)->xchat_list_time) |
403 | +#define xchat_list_next ((XCHAT_PLUGIN_HANDLE)->xchat_list_next) |
404 | +#define xchat_plugingui_add ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_add) |
405 | +#define xchat_plugingui_remove ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_remove) |
406 | +#define xchat_emit_print ((XCHAT_PLUGIN_HANDLE)->xchat_emit_print) |
407 | +#define xchat_gettext ((XCHAT_PLUGIN_HANDLE)->xchat_gettext) |
408 | +#define xchat_send_modes ((XCHAT_PLUGIN_HANDLE)->xchat_send_modes) |
409 | +#define xchat_strip ((XCHAT_PLUGIN_HANDLE)->xchat_strip) |
410 | +#define xchat_free ((XCHAT_PLUGIN_HANDLE)->xchat_free) |
411 | +#endif |
412 | + |
413 | +#ifdef __cplusplus |
414 | +} |
415 | +#endif |
416 | +#endif |
417 | |
418 | === added file 'xchat/zeitgeist-dataprovider.c' |
419 | --- xchat/zeitgeist-dataprovider.c 1970-01-01 00:00:00 +0000 |
420 | +++ xchat/zeitgeist-dataprovider.c 2011-01-11 00:22:15 +0000 |
421 | @@ -0,0 +1,157 @@ |
422 | +/* |
423 | + * zeitgeist-dataprovider.c |
424 | + * This file is part of Zeitgeist dataprovider for XChat. |
425 | + * |
426 | + * Copyright (C) 2011 - Stefano Candori <stefano.candori@gmail.com> |
427 | + * |
428 | + * Zeitgeist dataprovider for XChat is free software; |
429 | + * you can redistribute it and/or modify it under the terms of the GNU Lesser |
430 | + * General Public License as published by the Free Software Foundation; either |
431 | + * version 3 of the License, or (at your option) any later version. |
432 | + * |
433 | + * Zeitgeist dataprovider for XChat is distributed in the hope that |
434 | + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
435 | + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
436 | + * See the GNU Lesser General Public License for more details. |
437 | + * |
438 | + * You should have received a copy of the GNU Lesser General Public |
439 | + * License along with this library; if not, write to the Free Software |
440 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
441 | + */ |
442 | + |
443 | +#include "xchat-plugin.h" |
444 | +#include <zeitgeist.h> |
445 | + |
446 | + |
447 | +#define PNAME "Zeitgeist" |
448 | +#define PDESC "Inform Zeitgeist about your activity" |
449 | +#define PVERSION "0.1" |
450 | + |
451 | +static xchat_plugin *ph = NULL; /* plugin handle */ |
452 | +static ZeitgeistLog *zg_log = NULL; /* Zeitgeist-daemon hanlde*/ |
453 | + |
454 | +static void send_event_to_zeitgeist(char *url_, char* text_, const char* ev_interpretation) |
455 | +{ |
456 | + /* type is 0 for PART event, 1 for JOIN event */ |
457 | + const char *url, *origin, *mimetype, *text; |
458 | + const char *interpretation = NULL; |
459 | + const char *manifestation = NULL; |
460 | + ZeitgeistEvent *event; |
461 | + |
462 | + url = url_; |
463 | + origin = url; |
464 | + mimetype = "text/plain"; //? |
465 | + text = text_; |
466 | + interpretation = ZEITGEIST_NMO_IMMESSAGE; |
467 | + manifestation = ZEITGEIST_NFO_SOFTWARE_SERVICE; |
468 | + |
469 | + event = zeitgeist_event_new_full ( |
470 | + ev_interpretation, |
471 | + ZEITGEIST_ZG_USER_ACTIVITY, |
472 | + "application://xchat.desktop", |
473 | + zeitgeist_subject_new_full ( |
474 | + url, |
475 | + interpretation, |
476 | + manifestation, |
477 | + mimetype, |
478 | + origin, |
479 | + text, |
480 | + "net"), |
481 | + NULL); |
482 | + |
483 | + /*g_debug ("URL: %s, origin: %s, mimeType: %s, text: %s, interpretation: %s", |
484 | + url, |
485 | + origin, |
486 | + mimetype, |
487 | + text, |
488 | + ev_interpretation);*/ |
489 | + |
490 | + zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); |
491 | +} |
492 | + |
493 | +static int join_cb(char *word[], void *userdata) |
494 | +{ |
495 | + const char *server = xchat_get_info(ph, "host"); |
496 | + const char *channel = word[2]; |
497 | + char *url, *text; |
498 | + |
499 | + url = g_strconcat("irc://", server, "/", channel, NULL); |
500 | + text = g_strconcat("You joined ", channel, NULL); |
501 | + |
502 | + send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_ACCESS_EVENT); |
503 | + |
504 | + return XCHAT_EAT_NONE; |
505 | +} |
506 | + |
507 | +static int part_cb(char *word[], char* word_eol[], void *userdata) |
508 | +{ |
509 | + const char *server = xchat_get_info(ph, "host"); |
510 | + const char *channel = word[3]; |
511 | + char *url, *text; |
512 | + |
513 | + url = g_strconcat("irc://", server, "/", channel, NULL); |
514 | + text = g_strconcat("You parted from ", channel, NULL); |
515 | + |
516 | + send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_LEAVE_EVENT); |
517 | + |
518 | + return XCHAT_EAT_NONE; |
519 | +} |
520 | + |
521 | +static int message_cb(char *word[], void *userdata) |
522 | +{ |
523 | + const char *server = xchat_get_info(ph, "host"); |
524 | + const char *channel = xchat_get_info(ph, "channel"); |
525 | + char *url, *text; |
526 | + |
527 | + url = g_strconcat("irc://", server, "/", channel, NULL); |
528 | + text = g_strconcat(channel, ": you sent a message: ", word[2], NULL); |
529 | + |
530 | + send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_SEND_EVENT); |
531 | + |
532 | + return XCHAT_EAT_NONE; |
533 | +} |
534 | + |
535 | +static int priv_message_cb(char *word[], void *userdata) |
536 | +{ |
537 | + const char *server = xchat_get_info(ph, "host"); |
538 | + const char *channel = xchat_get_info(ph, "channel"); |
539 | + char *url, *text; |
540 | + |
541 | + url = g_strconcat("irc://", server, "/", channel, NULL); |
542 | + text = g_strconcat(channel, ": you received a message from ", word[1],": ", word[2], NULL); |
543 | + |
544 | + send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_RECEIVE_EVENT); |
545 | + |
546 | + return XCHAT_EAT_NONE; |
547 | +} |
548 | + |
549 | +void xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved) |
550 | +{ |
551 | + *name = PNAME; |
552 | + *desc = PDESC; |
553 | + *version = PVERSION; |
554 | +} |
555 | + |
556 | +int xchat_plugin_init(xchat_plugin *plugin_handle, |
557 | + char **plugin_name, |
558 | + char **plugin_desc, |
559 | + char **plugin_version, |
560 | + char *arg) |
561 | +{ |
562 | + ph = plugin_handle; |
563 | + |
564 | + *plugin_name = PNAME; |
565 | + *plugin_desc = PDESC; |
566 | + *plugin_version = PVERSION; |
567 | + |
568 | + zg_log = zeitgeist_log_new(); |
569 | + |
570 | + xchat_hook_print(ph, "You Join", XCHAT_PRI_NORM, join_cb, 0); |
571 | + xchat_hook_print(ph, "Your Message", XCHAT_PRI_NORM, message_cb, 0); |
572 | + xchat_hook_print(ph, "Channel Msg Hilight", XCHAT_PRI_NORM, priv_message_cb, 0); |
573 | + xchat_hook_server(ph, "PART", XCHAT_PRI_NORM, part_cb, 0); |
574 | + |
575 | + xchat_print(ph, "Zeitgeist plugin loaded\n"); |
576 | + |
577 | + return 1; |
578 | +} |
Other doubt: should the dataprovider send also message events???
IMHO it would be only an unuseful flooding...what do you think?