Merge lp:~cando/zeitgeist-datasources/xchat_dataprovider into lp:zeitgeist-datasources/0.8

Proposed by Stefano Candori
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
Reviewer Review Type Date Requested Status
Manish Sinha (मनीष सिन्हा) distcheck build Approve
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+45712@code.launchpad.net

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,manifestation and mimetype.

To post a comment you must log in.
Revision history for this message
Stefano Candori (cando) wrote :

Other doubt: should the dataprovider send also message events???
IMHO it would be only an unuseful flooding...what do you think?

Revision history for this message
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://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
> 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://seilo.geekyogre.com

Revision history for this message
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://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
> > 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://seilo.geekyogre.com
>
>
> https://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
> You are the owner of lp:~cando/zeitgeist-dataproviders/xchat_dataprovider.
>

Revision history for this message
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://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
> > > 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://seilo.geekyogre.com
> >
> >
> >
> https://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
> > You are the owner of
> lp:~cando/zeitgeist-dataproviders/xchat_dataprovider.
> >
>
> --
>
> https://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
> 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://seilo.geekyogre.com

Revision history for this message
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://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
>> > > 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://seilo.geekyogre.com
>> >
>> >
>> >
>> https://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
>> > You are the owner of
>> lp:~cando/zeitgeist-dataproviders/xchat_dataprovider.
>> >
>>
>> --
>>
>> https://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
>> 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://seilo.geekyogre.com
>

--
This is me doing some advertisement for my blog http://seilo.geekyogre.com

Revision history for this message
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!

review: Approve
104. By Stefano Candori

Add message event support

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Work perfectly.

review: Approve (implemenatation)
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Scratch that earlier approve. make distcheck fails

Making all in xchat
make[2]: Entering directory `/home/manish/code/xchat_dataprovider/zeitgeist-dataproviders-0.1.0/_build/xchat'
  CC zeitgeist_dataprovider_la-zeitgeist-dataprovider.lo
../../xchat/zeitgeist-dataprovider.c:22: fatal error: xchat-plugin.h: No such file or directory
compilation terminated.
make[2]: *** [zeitgeist_dataprovider_la-zeitgeist-dataprovider.lo] Error 1
make[2]: Leaving directory `/home/manish/code/xchat_dataprovider/zeitgeist-dataproviders-0.1.0/_build/xchat'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/manish/code/xchat_dataprovider/zeitgeist-dataproviders-0.1.0/_build'
make: *** [distcheck] Error 1

review: Needs Fixing (distcheck)
Revision history for this message
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/manish/code/xchat_dataprovider/zeitgeist-dataproviders-0.1.0/_build/xchat'
> CC zeitgeist_dataprovider_la-zeitgeist-dataprovider.lo
> ../../xchat/zeitgeist-dataprovider.c:22: fatal error: xchat-plugin.h: No
> such file or directory
> compilation terminated.
> make[2]: *** [zeitgeist_dataprovider_la-zeitgeist-dataprovider.lo] Error 1
> make[2]: Leaving directory
> `/home/manish/code/xchat_dataprovider/zeitgeist-dataproviders-0.1.0/_build/xchat'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory
> `/home/manish/code/xchat_dataprovider/zeitgeist-dataproviders-0.1.0/_build'
> make: *** [distcheck] Error 1
>
> --
>
> https://code.launchpad.net/~cando/zeitgeist-dataproviders/xchat_dataprovider/+merge/45712
> 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

Revision history for this message
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

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Tried. It works

review: Approve (distcheck build)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2010-12-09 12:54:26 +0000
+++ configure.ac 2011-01-11 00:22:15 +0000
@@ -65,7 +65,7 @@
65AC_MSG_RESULT($all_plugins)65AC_MSG_RESULT($all_plugins)
6666
67# The full list of plugins67# The full list of plugins
68allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs tomboy telepathy"68allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs tomboy telepathy xchat"
69# currently disabled = "epiphany"69# currently disabled = "epiphany"
7070
71# npapi-plugin has a template Makefile.am, but don't use it directly71# npapi-plugin has a template Makefile.am, but don't use it directly
@@ -225,6 +225,12 @@
225 ;;225 ;;
226 telepathy)226 telepathy)
227 ;;227 ;;
228 xchat)
229 if test "${HAVE_LIBZG}" != "yes" ; then
230 plugin_error_or_ignore "libzeitgeist not found"
231 continue
232 fi
233 ;;
228 *)234 *)
229 plugin_error_or_ignore "${plugin} is not handled"235 plugin_error_or_ignore "${plugin} is not handled"
230 continue236 continue
@@ -314,6 +320,10 @@
314 AC_CONFIG_FILES([telepathy/Makefile])320 AC_CONFIG_FILES([telepathy/Makefile])
315 continue 2321 continue 2
316 ;;322 ;;
323 xchat)
324 AC_CONFIG_FILES([xchat/Makefile])
325 continue 2
326 ;;
317 *)327 *)
318 AC_MSG_ERROR([cannot configure ${allowed_plugin}])328 AC_MSG_ERROR([cannot configure ${allowed_plugin}])
319 continue 2329 continue 2
320330
=== added directory 'xchat'
=== added file 'xchat/Makefile.am'
--- xchat/Makefile.am 1970-01-01 00:00:00 +0000
+++ xchat/Makefile.am 2011-01-11 00:22:15 +0000
@@ -0,0 +1,35 @@
1EXTRA_DIST = xchat-plugin.h
2
3xchatpluginbinarydir = $(libdir)/xchat/plugins
4xchatpluginbinary_LTLIBRARIES = zeitgeist_dataprovider.la
5
6zeitgeist_dataprovider_la_SOURCES = \
7 zeitgeist-dataprovider.c
8zeitgeist_dataprovider_la_CFLAGS = \
9 -Wl,--export-dynamic -Wall -O1 -shared -fPIC \
10 $(ZEITGEIST_CFLAGS) \
11 $(NULL)
12
13zeitgeist_dataprovider_la_LIBADD = \
14 $(ZEITGEIST_LIBS) \
15 $(NULL)
16zeitgeist_dataprovider_la_LDFLAGS = \
17 -module -avoid-version \
18 $(NULL)
19
20# we want to allow also local install
21XCHAT_PLUGIN_HOME_DIR = ~/.xchat2
22
23PLUGIN_FILES = ./.libs/zeitgeist_dataprovider.so
24
25local-install:
26 mkdir -p $(XCHAT_PLUGIN_HOME_DIR)
27 cp $(PLUGIN_FILES) $(XCHAT_PLUGIN_HOME_DIR)
28
29local-uninstall:
30 for f in $(PLUGIN_FILES); \
31 do \
32 echo remove $$f; \
33 rm -f $(XCHAT_PLUGIN_HOME_DIR)/$$f; \
34 done
35
036
=== added file 'xchat/xchat-plugin.h'
--- xchat/xchat-plugin.h 1970-01-01 00:00:00 +0000
+++ xchat/xchat-plugin.h 2011-01-11 00:22:15 +0000
@@ -0,0 +1,334 @@
1/* You can distribute this header with your plugins for easy compilation */
2#ifndef XCHAT_PLUGIN_H
3#define XCHAT_PLUGIN_H
4
5#include <time.h>
6
7#define XCHAT_IFACE_MAJOR 1
8#define XCHAT_IFACE_MINOR 9
9#define XCHAT_IFACE_MICRO 11
10#define XCHAT_IFACE_VERSION ((XCHAT_IFACE_MAJOR * 10000) + \
11 (XCHAT_IFACE_MINOR * 100) + \
12 (XCHAT_IFACE_MICRO))
13
14#define XCHAT_PRI_HIGHEST 127
15#define XCHAT_PRI_HIGH 64
16#define XCHAT_PRI_NORM 0
17#define XCHAT_PRI_LOW (-64)
18#define XCHAT_PRI_LOWEST (-128)
19
20#define XCHAT_FD_READ 1
21#define XCHAT_FD_WRITE 2
22#define XCHAT_FD_EXCEPTION 4
23#define XCHAT_FD_NOTSOCKET 8
24
25#define XCHAT_EAT_NONE 0 /* pass it on through! */
26#define XCHAT_EAT_XCHAT 1 /* don't let xchat see this event */
27#define XCHAT_EAT_PLUGIN 2 /* don't let other plugins see this event */
28#define XCHAT_EAT_ALL (XCHAT_EAT_XCHAT|XCHAT_EAT_PLUGIN) /* don't let anything see this event */
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef struct _xchat_plugin xchat_plugin;
35typedef struct _xchat_list xchat_list;
36typedef struct _xchat_hook xchat_hook;
37#ifndef PLUGIN_C
38typedef struct _xchat_context xchat_context;
39#endif
40
41#ifndef PLUGIN_C
42struct _xchat_plugin
43{
44 /* these are only used on win32 */
45 xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
46 const char *name,
47 int pri,
48 int (*callback) (char *word[], char *word_eol[], void *user_data),
49 const char *help_text,
50 void *userdata);
51 xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
52 const char *name,
53 int pri,
54 int (*callback) (char *word[], char *word_eol[], void *user_data),
55 void *userdata);
56 xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
57 const char *name,
58 int pri,
59 int (*callback) (char *word[], void *user_data),
60 void *userdata);
61 xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
62 int timeout,
63 int (*callback) (void *user_data),
64 void *userdata);
65 xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
66 int fd,
67 int flags,
68 int (*callback) (int fd, int flags, void *user_data),
69 void *userdata);
70 void *(*xchat_unhook) (xchat_plugin *ph,
71 xchat_hook *hook);
72 void (*xchat_print) (xchat_plugin *ph,
73 const char *text);
74 void (*xchat_printf) (xchat_plugin *ph,
75 const char *format, ...);
76 void (*xchat_command) (xchat_plugin *ph,
77 const char *command);
78 void (*xchat_commandf) (xchat_plugin *ph,
79 const char *format, ...);
80 int (*xchat_nickcmp) (xchat_plugin *ph,
81 const char *s1,
82 const char *s2);
83 int (*xchat_set_context) (xchat_plugin *ph,
84 xchat_context *ctx);
85 xchat_context *(*xchat_find_context) (xchat_plugin *ph,
86 const char *servname,
87 const char *channel);
88 xchat_context *(*xchat_get_context) (xchat_plugin *ph);
89 const char *(*xchat_get_info) (xchat_plugin *ph,
90 const char *id);
91 int (*xchat_get_prefs) (xchat_plugin *ph,
92 const char *name,
93 const char **string,
94 int *integer);
95 xchat_list * (*xchat_list_get) (xchat_plugin *ph,
96 const char *name);
97 void (*xchat_list_free) (xchat_plugin *ph,
98 xchat_list *xlist);
99 const char * const * (*xchat_list_fields) (xchat_plugin *ph,
100 const char *name);
101 int (*xchat_list_next) (xchat_plugin *ph,
102 xchat_list *xlist);
103 const char * (*xchat_list_str) (xchat_plugin *ph,
104 xchat_list *xlist,
105 const char *name);
106 int (*xchat_list_int) (xchat_plugin *ph,
107 xchat_list *xlist,
108 const char *name);
109 void * (*xchat_plugingui_add) (xchat_plugin *ph,
110 const char *filename,
111 const char *name,
112 const char *desc,
113 const char *version,
114 char *reserved);
115 void (*xchat_plugingui_remove) (xchat_plugin *ph,
116 void *handle);
117 int (*xchat_emit_print) (xchat_plugin *ph,
118 const char *event_name, ...);
119 int (*xchat_read_fd) (xchat_plugin *ph,
120 void *src,
121 char *buf,
122 int *len);
123 time_t (*xchat_list_time) (xchat_plugin *ph,
124 xchat_list *xlist,
125 const char *name);
126 char *(*xchat_gettext) (xchat_plugin *ph,
127 const char *msgid);
128 void (*xchat_send_modes) (xchat_plugin *ph,
129 const char **targets,
130 int ntargets,
131 int modes_per_line,
132 char sign,
133 char mode);
134 char *(*xchat_strip) (xchat_plugin *ph,
135 const char *str,
136 int len,
137 int flags);
138 void (*xchat_free) (xchat_plugin *ph,
139 void *ptr);
140};
141#endif
142
143
144xchat_hook *
145xchat_hook_command (xchat_plugin *ph,
146 const char *name,
147 int pri,
148 int (*callback) (char *word[], char *word_eol[], void *user_data),
149 const char *help_text,
150 void *userdata);
151
152xchat_hook *
153xchat_hook_server (xchat_plugin *ph,
154 const char *name,
155 int pri,
156 int (*callback) (char *word[], char *word_eol[], void *user_data),
157 void *userdata);
158
159xchat_hook *
160xchat_hook_print (xchat_plugin *ph,
161 const char *name,
162 int pri,
163 int (*callback) (char *word[], void *user_data),
164 void *userdata);
165
166xchat_hook *
167xchat_hook_timer (xchat_plugin *ph,
168 int timeout,
169 int (*callback) (void *user_data),
170 void *userdata);
171
172xchat_hook *
173xchat_hook_fd (xchat_plugin *ph,
174 int fd,
175 int flags,
176 int (*callback) (int fd, int flags, void *user_data),
177 void *userdata);
178
179void *
180xchat_unhook (xchat_plugin *ph,
181 xchat_hook *hook);
182
183void
184xchat_print (xchat_plugin *ph,
185 const char *text);
186
187void
188xchat_printf (xchat_plugin *ph,
189 const char *format, ...);
190
191void
192xchat_command (xchat_plugin *ph,
193 const char *command);
194
195void
196xchat_commandf (xchat_plugin *ph,
197 const char *format, ...);
198
199int
200xchat_nickcmp (xchat_plugin *ph,
201 const char *s1,
202 const char *s2);
203
204int
205xchat_set_context (xchat_plugin *ph,
206 xchat_context *ctx);
207
208xchat_context *
209xchat_find_context (xchat_plugin *ph,
210 const char *servname,
211 const char *channel);
212
213xchat_context *
214xchat_get_context (xchat_plugin *ph);
215
216const char *
217xchat_get_info (xchat_plugin *ph,
218 const char *id);
219
220int
221xchat_get_prefs (xchat_plugin *ph,
222 const char *name,
223 const char **string,
224 int *integer);
225
226xchat_list *
227xchat_list_get (xchat_plugin *ph,
228 const char *name);
229
230void
231xchat_list_free (xchat_plugin *ph,
232 xchat_list *xlist);
233
234const char * const *
235xchat_list_fields (xchat_plugin *ph,
236 const char *name);
237
238int
239xchat_list_next (xchat_plugin *ph,
240 xchat_list *xlist);
241
242const char *
243xchat_list_str (xchat_plugin *ph,
244 xchat_list *xlist,
245 const char *name);
246
247int
248xchat_list_int (xchat_plugin *ph,
249 xchat_list *xlist,
250 const char *name);
251
252time_t
253xchat_list_time (xchat_plugin *ph,
254 xchat_list *xlist,
255 const char *name);
256
257void *
258xchat_plugingui_add (xchat_plugin *ph,
259 const char *filename,
260 const char *name,
261 const char *desc,
262 const char *version,
263 char *reserved);
264
265void
266xchat_plugingui_remove (xchat_plugin *ph,
267 void *handle);
268
269int
270xchat_emit_print (xchat_plugin *ph,
271 const char *event_name, ...);
272
273char *
274xchat_gettext (xchat_plugin *ph,
275 const char *msgid);
276
277void
278xchat_send_modes (xchat_plugin *ph,
279 const char **targets,
280 int ntargets,
281 int modes_per_line,
282 char sign,
283 char mode);
284
285char *
286xchat_strip (xchat_plugin *ph,
287 const char *str,
288 int len,
289 int flags);
290
291void
292xchat_free (xchat_plugin *ph,
293 void *ptr);
294
295#if !defined(PLUGIN_C) && defined(WIN32)
296#ifndef XCHAT_PLUGIN_HANDLE
297#define XCHAT_PLUGIN_HANDLE (ph)
298#endif
299#define xchat_hook_command ((XCHAT_PLUGIN_HANDLE)->xchat_hook_command)
300#define xchat_hook_server ((XCHAT_PLUGIN_HANDLE)->xchat_hook_server)
301#define xchat_hook_print ((XCHAT_PLUGIN_HANDLE)->xchat_hook_print)
302#define xchat_hook_timer ((XCHAT_PLUGIN_HANDLE)->xchat_hook_timer)
303#define xchat_hook_fd ((XCHAT_PLUGIN_HANDLE)->xchat_hook_fd)
304#define xchat_unhook ((XCHAT_PLUGIN_HANDLE)->xchat_unhook)
305#define xchat_print ((XCHAT_PLUGIN_HANDLE)->xchat_print)
306#define xchat_printf ((XCHAT_PLUGIN_HANDLE)->xchat_printf)
307#define xchat_command ((XCHAT_PLUGIN_HANDLE)->xchat_command)
308#define xchat_commandf ((XCHAT_PLUGIN_HANDLE)->xchat_commandf)
309#define xchat_nickcmp ((XCHAT_PLUGIN_HANDLE)->xchat_nickcmp)
310#define xchat_set_context ((XCHAT_PLUGIN_HANDLE)->xchat_set_context)
311#define xchat_find_context ((XCHAT_PLUGIN_HANDLE)->xchat_find_context)
312#define xchat_get_context ((XCHAT_PLUGIN_HANDLE)->xchat_get_context)
313#define xchat_get_info ((XCHAT_PLUGIN_HANDLE)->xchat_get_info)
314#define xchat_get_prefs ((XCHAT_PLUGIN_HANDLE)->xchat_get_prefs)
315#define xchat_list_get ((XCHAT_PLUGIN_HANDLE)->xchat_list_get)
316#define xchat_list_free ((XCHAT_PLUGIN_HANDLE)->xchat_list_free)
317#define xchat_list_fields ((XCHAT_PLUGIN_HANDLE)->xchat_list_fields)
318#define xchat_list_str ((XCHAT_PLUGIN_HANDLE)->xchat_list_str)
319#define xchat_list_int ((XCHAT_PLUGIN_HANDLE)->xchat_list_int)
320#define xchat_list_time ((XCHAT_PLUGIN_HANDLE)->xchat_list_time)
321#define xchat_list_next ((XCHAT_PLUGIN_HANDLE)->xchat_list_next)
322#define xchat_plugingui_add ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_add)
323#define xchat_plugingui_remove ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_remove)
324#define xchat_emit_print ((XCHAT_PLUGIN_HANDLE)->xchat_emit_print)
325#define xchat_gettext ((XCHAT_PLUGIN_HANDLE)->xchat_gettext)
326#define xchat_send_modes ((XCHAT_PLUGIN_HANDLE)->xchat_send_modes)
327#define xchat_strip ((XCHAT_PLUGIN_HANDLE)->xchat_strip)
328#define xchat_free ((XCHAT_PLUGIN_HANDLE)->xchat_free)
329#endif
330
331#ifdef __cplusplus
332}
333#endif
334#endif
0335
=== added file 'xchat/zeitgeist-dataprovider.c'
--- xchat/zeitgeist-dataprovider.c 1970-01-01 00:00:00 +0000
+++ xchat/zeitgeist-dataprovider.c 2011-01-11 00:22:15 +0000
@@ -0,0 +1,157 @@
1/*
2 * zeitgeist-dataprovider.c
3 * This file is part of Zeitgeist dataprovider for XChat.
4 *
5 * Copyright (C) 2011 - Stefano Candori <stefano.candori@gmail.com>
6 *
7 * Zeitgeist dataprovider for XChat is free software;
8 * you can redistribute it and/or modify it under the terms of the GNU Lesser
9 * General Public License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
11 *
12 * Zeitgeist dataprovider for XChat is distributed in the hope that
13 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include "xchat-plugin.h"
23#include <zeitgeist.h>
24
25
26#define PNAME "Zeitgeist"
27#define PDESC "Inform Zeitgeist about your activity"
28#define PVERSION "0.1"
29
30static xchat_plugin *ph = NULL; /* plugin handle */
31static ZeitgeistLog *zg_log = NULL; /* Zeitgeist-daemon hanlde*/
32
33static void send_event_to_zeitgeist(char *url_, char* text_, const char* ev_interpretation)
34{
35 /* type is 0 for PART event, 1 for JOIN event */
36 const char *url, *origin, *mimetype, *text;
37 const char *interpretation = NULL;
38 const char *manifestation = NULL;
39 ZeitgeistEvent *event;
40
41 url = url_;
42 origin = url;
43 mimetype = "text/plain"; //?
44 text = text_;
45 interpretation = ZEITGEIST_NMO_IMMESSAGE;
46 manifestation = ZEITGEIST_NFO_SOFTWARE_SERVICE;
47
48 event = zeitgeist_event_new_full (
49 ev_interpretation,
50 ZEITGEIST_ZG_USER_ACTIVITY,
51 "application://xchat.desktop",
52 zeitgeist_subject_new_full (
53 url,
54 interpretation,
55 manifestation,
56 mimetype,
57 origin,
58 text,
59 "net"),
60 NULL);
61
62 /*g_debug ("URL: %s, origin: %s, mimeType: %s, text: %s, interpretation: %s",
63 url,
64 origin,
65 mimetype,
66 text,
67 ev_interpretation);*/
68
69 zeitgeist_log_insert_events_no_reply (zg_log, event, NULL);
70}
71
72static int join_cb(char *word[], void *userdata)
73{
74 const char *server = xchat_get_info(ph, "host");
75 const char *channel = word[2];
76 char *url, *text;
77
78 url = g_strconcat("irc://", server, "/", channel, NULL);
79 text = g_strconcat("You joined ", channel, NULL);
80
81 send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_ACCESS_EVENT);
82
83 return XCHAT_EAT_NONE;
84}
85
86static int part_cb(char *word[], char* word_eol[], void *userdata)
87{
88 const char *server = xchat_get_info(ph, "host");
89 const char *channel = word[3];
90 char *url, *text;
91
92 url = g_strconcat("irc://", server, "/", channel, NULL);
93 text = g_strconcat("You parted from ", channel, NULL);
94
95 send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_LEAVE_EVENT);
96
97 return XCHAT_EAT_NONE;
98}
99
100static int message_cb(char *word[], void *userdata)
101{
102 const char *server = xchat_get_info(ph, "host");
103 const char *channel = xchat_get_info(ph, "channel");
104 char *url, *text;
105
106 url = g_strconcat("irc://", server, "/", channel, NULL);
107 text = g_strconcat(channel, ": you sent a message: ", word[2], NULL);
108
109 send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_SEND_EVENT);
110
111 return XCHAT_EAT_NONE;
112}
113
114static int priv_message_cb(char *word[], void *userdata)
115{
116 const char *server = xchat_get_info(ph, "host");
117 const char *channel = xchat_get_info(ph, "channel");
118 char *url, *text;
119
120 url = g_strconcat("irc://", server, "/", channel, NULL);
121 text = g_strconcat(channel, ": you received a message from ", word[1],": ", word[2], NULL);
122
123 send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_RECEIVE_EVENT);
124
125 return XCHAT_EAT_NONE;
126}
127
128void xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved)
129{
130 *name = PNAME;
131 *desc = PDESC;
132 *version = PVERSION;
133}
134
135int xchat_plugin_init(xchat_plugin *plugin_handle,
136 char **plugin_name,
137 char **plugin_desc,
138 char **plugin_version,
139 char *arg)
140{
141 ph = plugin_handle;
142
143 *plugin_name = PNAME;
144 *plugin_desc = PDESC;
145 *plugin_version = PVERSION;
146
147 zg_log = zeitgeist_log_new();
148
149 xchat_hook_print(ph, "You Join", XCHAT_PRI_NORM, join_cb, 0);
150 xchat_hook_print(ph, "Your Message", XCHAT_PRI_NORM, message_cb, 0);
151 xchat_hook_print(ph, "Channel Msg Hilight", XCHAT_PRI_NORM, priv_message_cb, 0);
152 xchat_hook_server(ph, "PART", XCHAT_PRI_NORM, part_cb, 0);
153
154 xchat_print(ph, "Zeitgeist plugin loaded\n");
155
156 return 1;
157}

Subscribers

People subscribed via source and target branches