Merge lp:~wyuka/zeitgeist-datasources/purple into lp:zeitgeist-datasources/0.8
- purple
- Merge into trunk
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~wyuka/zeitgeist-datasources/purple | ||||
Merge into: | lp:zeitgeist-datasources/0.8 | ||||
Diff against target: |
857 lines (+821/-1) 3 files modified
configure.ac (+21/-1) purple/Makefile.am (+35/-0) purple/zeitgeist_dataprovider.c (+765/-0) |
||||
To merge this branch: | bzr merge lp:~wyuka/zeitgeist-datasources/purple | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michal Hruby (community) | code | Needs Fixing | |
Manish Sinha (मनीष सिन्हा) | license | Needs Fixing | |
Review via email: mp+65605@code.launchpad.net |
Commit message
Added a datasource for libpurple
Description of the change
Added a datasource for libpurple, the library used by Pidgin and Adium.
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
This would take some time as we need to make sure that the ontology are proper and does correspond to telepathy's data-source ontology perfectly to avoid any issues
Michal Hruby (mhr3) wrote : | # |
First of all, I really don't think logging every sent and received url is a good idea, I'd get rid of all of that. (anyway if the user clicks on the url, it'll be logged by the browser dataproviders). @manish: objections?
Second, signed-on/off are not too interesting either imo, at very least they shouldn't be USER_ACTIVITY.
Let's get to something more specific (line numbers as seen in LP's diff):
681 727: libzg has method (zeitgeist_
...,686,...: storage parameter for ZeitgeistSubject is often wrong, local files are never "net".
Other than that there are a couple of leaks:
619: account_uri
671, 717: file
672, 718: parent
I'm no purple plugin expert, but I'd say you should disconnect the signals in the unload method.
Michal Hruby (mhr3) wrote : | # |
Oh and all instances g_file_get_uri leak as well.
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
@Michal
I see there is anyway not harm in logging all the sent and received URLs. The use-case can be "I sent you the URL of _some_random_
Unmerged revisions
- 152. By Tirtha Chatterjee
-
add events logging for purple
Preview Diff
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2011-06-04 21:51:56 +0000 | |||
3 | +++ configure.ac 2011-06-23 01:16:19 +0000 | |||
4 | @@ -65,7 +65,7 @@ | |||
5 | 65 | AC_MSG_NOTICE([Requested to enable all plugins: ${all_plugins}]) | 65 | AC_MSG_NOTICE([Requested to enable all plugins: ${all_plugins}]) |
6 | 66 | 66 | ||
7 | 67 | # The full list of plugins | 67 | # The full list of plugins |
9 | 68 | allowed_plugins="bzr chrome eog geany gedit vim emacs tomboy telepathy xchat rhythmbox firefox-40-libzg totem-libzg firefox-36-libzg" | 68 | allowed_plugins="bzr chrome eog geany purple gedit vim emacs tomboy telepathy xchat rhythmbox firefox-40-libzg totem-libzg firefox-36-libzg" |
10 | 69 | # currently disabled = "epiphany" | 69 | # currently disabled = "epiphany" |
11 | 70 | 70 | ||
12 | 71 | # npapi-plugin has a template Makefile.am, but don't use it directly | 71 | # npapi-plugin has a template Makefile.am, but don't use it directly |
13 | @@ -180,6 +180,22 @@ | |||
14 | 180 | continue | 180 | continue |
15 | 181 | fi | 181 | fi |
16 | 182 | ;; | 182 | ;; |
17 | 183 | purple) | ||
18 | 184 | if test "${HAVE_LIBZG}" != "yes" ; then | ||
19 | 185 | plugin_error_or_ignore "libzeitgeist not found" | ||
20 | 186 | continue | ||
21 | 187 | fi | ||
22 | 188 | if test "x$HAVE_GTK" = "xno"; then | ||
23 | 189 | plugin_error_or_ignore "You need to install gtk development headers" | ||
24 | 190 | continue | ||
25 | 191 | fi | ||
26 | 192 | PKG_CHECK_MODULES(PURPLE, purple >= 2.0.0, | ||
27 | 193 | [HAVE_PURPLE=yes], [HAVE_PURPLE=no]) | ||
28 | 194 | if test "${HAVE_PURPLE}" != "yes" ; then | ||
29 | 195 | plugin_error_or_ignore "libpurple headers not found" | ||
30 | 196 | continue | ||
31 | 197 | fi | ||
32 | 198 | ;; | ||
33 | 183 | npapi-plugin) | 199 | npapi-plugin) |
34 | 184 | if test "${HAVE_LIBZG}" != "yes" ; then | 200 | if test "${HAVE_LIBZG}" != "yes" ; then |
35 | 185 | plugin_error_or_ignore "libzeitgeist not found" | 201 | plugin_error_or_ignore "libzeitgeist not found" |
36 | @@ -321,6 +337,10 @@ | |||
37 | 321 | AC_CONFIG_FILES([geany/Makefile]) | 337 | AC_CONFIG_FILES([geany/Makefile]) |
38 | 322 | continue 2 | 338 | continue 2 |
39 | 323 | ;; | 339 | ;; |
40 | 340 | purple) | ||
41 | 341 | AC_CONFIG_FILES([purple/Makefile]) | ||
42 | 342 | continue 2 | ||
43 | 343 | ;; | ||
44 | 324 | gedit) | 344 | gedit) |
45 | 325 | AC_CONFIG_FILES([gedit/Makefile]) | 345 | AC_CONFIG_FILES([gedit/Makefile]) |
46 | 326 | continue 2 | 346 | continue 2 |
47 | 327 | 347 | ||
48 | === added directory 'purple' | |||
49 | === added file 'purple/Makefile.am' | |||
50 | --- purple/Makefile.am 1970-01-01 00:00:00 +0000 | |||
51 | +++ purple/Makefile.am 2011-06-23 01:16:19 +0000 | |||
52 | @@ -0,0 +1,35 @@ | |||
53 | 1 | purpleplugindir = $(libdir)/purple-2/ | ||
54 | 2 | purpleplugin_LTLIBRARIES = zeitgeist_dataprovider.la | ||
55 | 3 | |||
56 | 4 | zeitgeist_dataprovider_la_SOURCES = \ | ||
57 | 5 | zeitgeist_dataprovider.c | ||
58 | 6 | zeitgeist_dataprovider_la_CFLAGS = \ | ||
59 | 7 | -fPIC -Wall -std=c99 \ | ||
60 | 8 | $(ZEITGEIST_CFLAGS) \ | ||
61 | 9 | $(PURPLE_CFLAGS) \ | ||
62 | 10 | $(NULL) | ||
63 | 11 | |||
64 | 12 | zeitgeist_dataprovider_la_LIBADD = \ | ||
65 | 13 | $(ZEITGEIST_LIBS) \ | ||
66 | 14 | $(PURPLE_LIBS) \ | ||
67 | 15 | $(NULL) | ||
68 | 16 | zeitgeist_dataprovider_la_LDFLAGS = \ | ||
69 | 17 | -module -avoid-version \ | ||
70 | 18 | $(NULL) | ||
71 | 19 | |||
72 | 20 | # we want to allow also local install | ||
73 | 21 | PURPLE_PLUGIN_HOME_DIR = ~/.purple/plugins | ||
74 | 22 | |||
75 | 23 | PLUGIN_FILES = zeitgeist_dataprovider.so | ||
76 | 24 | |||
77 | 25 | local-install: | ||
78 | 26 | mkdir -p $(PURPLE_PLUGIN_HOME_DIR) | ||
79 | 27 | cp $(PLUGIN_FILES) $(PURPLE_PLUGIN_HOME_DIR) | ||
80 | 28 | |||
81 | 29 | local-uninstall: | ||
82 | 30 | for f in $(PLUGIN_FILES); \ | ||
83 | 31 | do \ | ||
84 | 32 | echo remove $$f; \ | ||
85 | 33 | rm -f $(PURPLE_PLUGIN_HOME_DIR)/$$f; \ | ||
86 | 34 | done | ||
87 | 35 | |||
88 | 0 | 36 | ||
89 | === added file 'purple/zeitgeist_dataprovider.c' | |||
90 | --- purple/zeitgeist_dataprovider.c 1970-01-01 00:00:00 +0000 | |||
91 | +++ purple/zeitgeist_dataprovider.c 2011-06-23 01:16:19 +0000 | |||
92 | @@ -0,0 +1,765 @@ | |||
93 | 1 | /* | ||
94 | 2 | * zeitgeist-dataprovider.c | ||
95 | 3 | * This file is part of Zeitgeist dataprovider for libpurple. | ||
96 | 4 | * | ||
97 | 5 | * Copyright (C) 2011 - Tirtha Chatterjee <tirtha.p.chatterjee@gmail.com> | ||
98 | 6 | * | ||
99 | 7 | * Zeitgeist dataprovider for XChat is free software; | ||
100 | 8 | * you can redistribute it and/or modify it under the terms of the GNU Lesser | ||
101 | 9 | * General Public License as published by the Free Software Foundation; either | ||
102 | 10 | * version 3 of the License, or (at your option) any later version. | ||
103 | 11 | * | ||
104 | 12 | * Zeitgeist dataprovider for XChat is distributed in the hope that | ||
105 | 13 | * it will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
106 | 14 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
107 | 15 | * See the GNU Lesser General Public License for more details. | ||
108 | 16 | * | ||
109 | 17 | * You should have received a copy of the GNU Lesser General Public | ||
110 | 18 | * License along with this library; if not, write to the Free Software | ||
111 | 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
112 | 20 | */ | ||
113 | 21 | |||
114 | 22 | #define ZEITGEIST_NCO_CONTACT_GROUP "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#ContactGroup" | ||
115 | 23 | #define ZEITGEIST_NCO_CONTACT "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact" | ||
116 | 24 | |||
117 | 25 | #define PURPLE_PLUGINS | ||
118 | 26 | |||
119 | 27 | #define ZEITGEIST_ID "core-zeitgeist" | ||
120 | 28 | |||
121 | 29 | #include <stdio.h> | ||
122 | 30 | |||
123 | 31 | #include "cipher.h" | ||
124 | 32 | #include "connection.h" | ||
125 | 33 | #include "conversation.h" | ||
126 | 34 | #include "core.h" | ||
127 | 35 | #include "debug.h" | ||
128 | 36 | #include "ft.h" | ||
129 | 37 | #include "signals.h" | ||
130 | 38 | #include "version.h" | ||
131 | 39 | #include "status.h" | ||
132 | 40 | #include "sound.h" | ||
133 | 41 | |||
134 | 42 | #include <zeitgeist.h> | ||
135 | 43 | |||
136 | 44 | #define PNAME "Zeitgeist" | ||
137 | 45 | #define PDESC "Inform Zeitgeist about your activity" | ||
138 | 46 | #define PVERSION "0.1" | ||
139 | 47 | |||
140 | 48 | static ZeitgeistLog *zg_log = NULL; /* Zeitgeist-daemon handle*/ | ||
141 | 49 | static GSList* signed_in_accounts = NULL; | ||
142 | 50 | |||
143 | 51 | char * | ||
144 | 52 | get_uri_for_group(PurpleGroup *group) | ||
145 | 53 | { | ||
146 | 54 | char* uri = g_strdup_printf("group://%s", | ||
147 | 55 | purple_escape_filename(purple_group_get_name(group))); | ||
148 | 56 | return uri; | ||
149 | 57 | } | ||
150 | 58 | |||
151 | 59 | char * | ||
152 | 60 | get_uri_for_buddy(PurpleBuddy *buddy) | ||
153 | 61 | { | ||
154 | 62 | char* uri = g_strdup_printf("buddy://%s", | ||
155 | 63 | purple_escape_filename(purple_buddy_get_name(buddy))); | ||
156 | 64 | return uri; | ||
157 | 65 | } | ||
158 | 66 | |||
159 | 67 | char * | ||
160 | 68 | get_uri_for_account(PurpleAccount *account) | ||
161 | 69 | { | ||
162 | 70 | char* uri = g_strdup_printf("account://%s", | ||
163 | 71 | purple_escape_filename(purple_normalize(account, | ||
164 | 72 | purple_account_get_username(account)))); | ||
165 | 73 | return uri; | ||
166 | 74 | } | ||
167 | 75 | |||
168 | 76 | char * | ||
169 | 77 | get_uri_for_conversation(PurpleConversation* conv) | ||
170 | 78 | { | ||
171 | 79 | PurpleAccount *account = purple_conversation_get_account(conv); | ||
172 | 80 | PurpleConversationType type = purple_conversation_get_type(conv); | ||
173 | 81 | const char *name = purple_conversation_get_name(conv); | ||
174 | 82 | |||
175 | 83 | PurplePlugin *prpl; | ||
176 | 84 | PurplePluginProtocolInfo *prpl_info; | ||
177 | 85 | const char *prpl_name; | ||
178 | 86 | const char *target; | ||
179 | 87 | char *uri; | ||
180 | 88 | |||
181 | 89 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); | ||
182 | 90 | if (!prpl) | ||
183 | 91 | return NULL; | ||
184 | 92 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | ||
185 | 93 | prpl_name = prpl_info->list_icon(account, NULL); | ||
186 | 94 | |||
187 | 95 | if (type == PURPLE_CONV_TYPE_CHAT) { | ||
188 | 96 | char *temp = g_strdup_printf("%s.chat", purple_normalize(account, name)); | ||
189 | 97 | target = purple_escape_filename(temp); | ||
190 | 98 | g_free(temp); | ||
191 | 99 | } else { | ||
192 | 100 | target = purple_escape_filename(purple_normalize(account, name)); | ||
193 | 101 | } | ||
194 | 102 | |||
195 | 103 | uri = g_strdup_printf("conversation://%s/%s", prpl_name, | ||
196 | 104 | target); | ||
197 | 105 | |||
198 | 106 | return uri; | ||
199 | 107 | } | ||
200 | 108 | |||
201 | 109 | static void store_urls(const char *buffer, | ||
202 | 110 | PurpleAccount *account, const char *target, gboolean sent_or_received) | ||
203 | 111 | { | ||
204 | 112 | GRegex *strip_tags_regex = g_regex_new("<(.*?)>", 0, 0, NULL); | ||
205 | 113 | GRegex *url_regex = g_regex_new("((https?)|(ftp))://[\\S]+", 0, 0, NULL); | ||
206 | 114 | GError *error = NULL; | ||
207 | 115 | GMatchInfo *match_info; | ||
208 | 116 | char *cur = g_regex_replace_literal(strip_tags_regex, buffer, -1, 0, "", 0, NULL); | ||
209 | 117 | g_regex_unref(strip_tags_regex); | ||
210 | 118 | |||
211 | 119 | g_regex_match_full(url_regex, cur, -1, 0, 0, &match_info, &error); | ||
212 | 120 | while (g_match_info_matches (match_info)) | ||
213 | 121 | { | ||
214 | 122 | char *url = g_match_info_fetch (match_info, 0); | ||
215 | 123 | const char *text = target; | ||
216 | 124 | |||
217 | 125 | ZeitgeistEvent *event; | ||
218 | 126 | |||
219 | 127 | event = zeitgeist_event_new_full ( | ||
220 | 128 | (sent_or_received ? ZEITGEIST_ZG_SEND_EVENT: | ||
221 | 129 | ZEITGEIST_ZG_RECEIVE_EVENT), | ||
222 | 130 | (sent_or_received ? ZEITGEIST_ZG_USER_ACTIVITY: | ||
223 | 131 | ZEITGEIST_ZG_WORLD_ACTIVITY), | ||
224 | 132 | "application://pidgin.desktop", | ||
225 | 133 | zeitgeist_subject_new_full ( | ||
226 | 134 | url, | ||
227 | 135 | ZEITGEIST_NFO_BOOKMARK, | ||
228 | 136 | ZEITGEIST_NFO_REMOTE_DATA_OBJECT, | ||
229 | 137 | "text/plain", | ||
230 | 138 | url, | ||
231 | 139 | text, | ||
232 | 140 | "net"), | ||
233 | 141 | NULL); | ||
234 | 142 | |||
235 | 143 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
236 | 144 | (sent_or_received ? ZEITGEIST_ZG_SEND_EVENT: | ||
237 | 145 | ZEITGEIST_ZG_RECEIVE_EVENT), | ||
238 | 146 | (sent_or_received ? ZEITGEIST_ZG_USER_ACTIVITY: | ||
239 | 147 | ZEITGEIST_ZG_WORLD_ACTIVITY), | ||
240 | 148 | "application://pidgin.desktop", | ||
241 | 149 | url, | ||
242 | 150 | ZEITGEIST_NCO_BOOKMARK, | ||
243 | 151 | ZEITGEIST_NFO_REMOTE_DATA_OBJECT, | ||
244 | 152 | "text/plain", | ||
245 | 153 | url, | ||
246 | 154 | text, | ||
247 | 155 | "net");*/ | ||
248 | 156 | |||
249 | 157 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
250 | 158 | |||
251 | 159 | g_free (url); | ||
252 | 160 | g_match_info_next (match_info, &error); | ||
253 | 161 | } | ||
254 | 162 | g_match_info_free (match_info); | ||
255 | 163 | g_regex_unref (url_regex); | ||
256 | 164 | |||
257 | 165 | if (error != NULL) | ||
258 | 166 | { | ||
259 | 167 | g_error_free (error); | ||
260 | 168 | return; | ||
261 | 169 | } | ||
262 | 170 | g_free(cur); | ||
263 | 171 | } | ||
264 | 172 | |||
265 | 173 | /************************************************************************** | ||
266 | 174 | * Buddy List subsystem signal callbacks | ||
267 | 175 | **************************************************************************/ | ||
268 | 176 | |||
269 | 177 | static void | ||
270 | 178 | blist_node_added_cb(PurpleBlistNode *bnode, void *data) | ||
271 | 179 | { | ||
272 | 180 | if (PURPLE_BLIST_NODE_IS_GROUP(bnode)) | ||
273 | 181 | { | ||
274 | 182 | const char *text = purple_group_get_name(PURPLE_GROUP(bnode)); | ||
275 | 183 | char *group_uri = get_uri_for_group(PURPLE_GROUP(bnode)); | ||
276 | 184 | |||
277 | 185 | ZeitgeistEvent *event; | ||
278 | 186 | |||
279 | 187 | event = zeitgeist_event_new_full ( | ||
280 | 188 | ZEITGEIST_ZG_CREATE_EVENT, | ||
281 | 189 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
282 | 190 | "application://pidgin.desktop", | ||
283 | 191 | zeitgeist_subject_new_full ( | ||
284 | 192 | group_uri, | ||
285 | 193 | ZEITGEIST_NCO_CONTACT_GROUP, | ||
286 | 194 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
287 | 195 | "text/plain", | ||
288 | 196 | "application://pidgin.desktop", | ||
289 | 197 | text, | ||
290 | 198 | "net"), | ||
291 | 199 | NULL); | ||
292 | 200 | |||
293 | 201 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
294 | 202 | ZEITGEIST_ZG_CREATE_EVENT, | ||
295 | 203 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
296 | 204 | "application://pidgin.desktop", | ||
297 | 205 | group_uri, | ||
298 | 206 | ZEITGEIST_NCO_CONTACT, | ||
299 | 207 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
300 | 208 | "text/plain", | ||
301 | 209 | "application://pidgin.desktop", | ||
302 | 210 | text, | ||
303 | 211 | "net");*/ | ||
304 | 212 | |||
305 | 213 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
306 | 214 | |||
307 | 215 | g_free(group_uri); | ||
308 | 216 | } | ||
309 | 217 | else if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) | ||
310 | 218 | { | ||
311 | 219 | const char *text = purple_buddy_get_alias(PURPLE_BUDDY(bnode)); | ||
312 | 220 | char *group_uri = get_uri_for_group( | ||
313 | 221 | purple_buddy_get_group(PURPLE_BUDDY(bnode))); | ||
314 | 222 | char *buddy_uri = get_uri_for_buddy(PURPLE_BUDDY(bnode)); | ||
315 | 223 | |||
316 | 224 | ZeitgeistEvent *event; | ||
317 | 225 | |||
318 | 226 | event = zeitgeist_event_new_full ( | ||
319 | 227 | ZEITGEIST_ZG_CREATE_EVENT, | ||
320 | 228 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
321 | 229 | "application://pidgin.desktop", | ||
322 | 230 | zeitgeist_subject_new_full ( | ||
323 | 231 | buddy_uri, | ||
324 | 232 | ZEITGEIST_NCO_CONTACT, | ||
325 | 233 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
326 | 234 | "text/plain", | ||
327 | 235 | group_uri, | ||
328 | 236 | text, | ||
329 | 237 | "net"), | ||
330 | 238 | NULL); | ||
331 | 239 | |||
332 | 240 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
333 | 241 | ZEITGEIST_ZG_CREATE_EVENT, | ||
334 | 242 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
335 | 243 | "application://pidgin.desktop", | ||
336 | 244 | buddy_uri, | ||
337 | 245 | ZEITGEIST_NCO_CONTACT, | ||
338 | 246 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
339 | 247 | "text/plain", | ||
340 | 248 | group_uri, | ||
341 | 249 | text, | ||
342 | 250 | "net");*/ | ||
343 | 251 | |||
344 | 252 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
345 | 253 | |||
346 | 254 | g_free(group_uri); | ||
347 | 255 | g_free(buddy_uri); | ||
348 | 256 | } | ||
349 | 257 | else | ||
350 | 258 | return; | ||
351 | 259 | } | ||
352 | 260 | |||
353 | 261 | static void | ||
354 | 262 | blist_node_removed_cb(PurpleBlistNode *bnode, void *data) | ||
355 | 263 | { | ||
356 | 264 | if (PURPLE_BLIST_NODE_IS_GROUP(bnode)) | ||
357 | 265 | { | ||
358 | 266 | const char *text = purple_group_get_name(PURPLE_GROUP(bnode)); | ||
359 | 267 | char *group_uri = get_uri_for_group(PURPLE_GROUP(bnode)); | ||
360 | 268 | ZeitgeistEvent *event; | ||
361 | 269 | |||
362 | 270 | event = zeitgeist_event_new_full ( | ||
363 | 271 | ZEITGEIST_ZG_CREATE_EVENT, | ||
364 | 272 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
365 | 273 | "application://pidgin.desktop", | ||
366 | 274 | zeitgeist_subject_new_full ( | ||
367 | 275 | group_uri, | ||
368 | 276 | ZEITGEIST_NCO_CONTACT_GROUP, | ||
369 | 277 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
370 | 278 | "text/plain", | ||
371 | 279 | "application://pidgin.desktop", | ||
372 | 280 | text, | ||
373 | 281 | "net"), | ||
374 | 282 | NULL); | ||
375 | 283 | |||
376 | 284 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
377 | 285 | ZEITGEIST_ZG_CREATE_EVENT, | ||
378 | 286 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
379 | 287 | "application://pidgin.desktop", | ||
380 | 288 | group_uri, | ||
381 | 289 | ZEITGEIST_NCO_CONTACT, | ||
382 | 290 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
383 | 291 | "text/plain", | ||
384 | 292 | "application://pidgin.desktop", | ||
385 | 293 | text, | ||
386 | 294 | "net");*/ | ||
387 | 295 | |||
388 | 296 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
389 | 297 | |||
390 | 298 | g_free(group_uri); | ||
391 | 299 | } | ||
392 | 300 | else if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) | ||
393 | 301 | { | ||
394 | 302 | const char *text = purple_buddy_get_alias(PURPLE_BUDDY(bnode)); | ||
395 | 303 | char *group_uri = get_uri_for_group( | ||
396 | 304 | purple_buddy_get_group(PURPLE_BUDDY(bnode))); | ||
397 | 305 | char *buddy_uri = get_uri_for_buddy(PURPLE_BUDDY(bnode)); | ||
398 | 306 | |||
399 | 307 | ZeitgeistEvent *event; | ||
400 | 308 | |||
401 | 309 | event = zeitgeist_event_new_full ( | ||
402 | 310 | ZEITGEIST_ZG_DELETE_EVENT, | ||
403 | 311 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
404 | 312 | "application://pidgin.desktop", | ||
405 | 313 | zeitgeist_subject_new_full ( | ||
406 | 314 | buddy_uri, | ||
407 | 315 | ZEITGEIST_NCO_CONTACT, | ||
408 | 316 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
409 | 317 | "text/plain", | ||
410 | 318 | group_uri, | ||
411 | 319 | text, | ||
412 | 320 | "net"), | ||
413 | 321 | NULL); | ||
414 | 322 | |||
415 | 323 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
416 | 324 | ZEITGEIST_ZG_DELETE_EVENT, | ||
417 | 325 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
418 | 326 | "application://pidgin.desktop", | ||
419 | 327 | buddy_uri, | ||
420 | 328 | ZEITGEIST_NCO_CONTACT, | ||
421 | 329 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
422 | 330 | "text/plain", | ||
423 | 331 | group_uri, | ||
424 | 332 | text, | ||
425 | 333 | "net");*/ | ||
426 | 334 | |||
427 | 335 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
428 | 336 | |||
429 | 337 | g_free(group_uri); | ||
430 | 338 | g_free(buddy_uri); | ||
431 | 339 | } | ||
432 | 340 | else | ||
433 | 341 | return; | ||
434 | 342 | } | ||
435 | 343 | |||
436 | 344 | /************************************************************************** | ||
437 | 345 | * Connection subsystem signal callbacks | ||
438 | 346 | **************************************************************************/ | ||
439 | 347 | |||
440 | 348 | static void | ||
441 | 349 | signed_on_cb(PurpleConnection *gc, void *data) //TODO | ||
442 | 350 | { | ||
443 | 351 | PurpleAccount* account = purple_connection_get_account(gc); | ||
444 | 352 | char *acname = g_strdup(purple_normalize(account, | ||
445 | 353 | purple_account_get_username(account))); | ||
446 | 354 | |||
447 | 355 | const char *text = acname; | ||
448 | 356 | char *account_uri = get_uri_for_account(account); | ||
449 | 357 | |||
450 | 358 | ZeitgeistEvent *event; | ||
451 | 359 | |||
452 | 360 | event = zeitgeist_event_new_full ( | ||
453 | 361 | ZEITGEIST_ZG_ACCESS_EVENT, | ||
454 | 362 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
455 | 363 | "application://pidgin.desktop", | ||
456 | 364 | zeitgeist_subject_new_full ( | ||
457 | 365 | account_uri, | ||
458 | 366 | ZEITGEIST_NCO_CONTACT, | ||
459 | 367 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
460 | 368 | "text/plain", | ||
461 | 369 | "application://pidgin.desktop", | ||
462 | 370 | text, | ||
463 | 371 | "net"), | ||
464 | 372 | NULL); | ||
465 | 373 | |||
466 | 374 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
467 | 375 | ZEITGEIST_ZG_ACCESS_EVENT, | ||
468 | 376 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
469 | 377 | "application://pidgin.desktop", | ||
470 | 378 | account_uri, | ||
471 | 379 | ZEITGEIST_NCO_CONTACT, | ||
472 | 380 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
473 | 381 | "text/plain", | ||
474 | 382 | "application://pidgin.desktop", | ||
475 | 383 | text, | ||
476 | 384 | "net");*/ | ||
477 | 385 | |||
478 | 386 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
479 | 387 | |||
480 | 388 | g_free(account_uri); | ||
481 | 389 | signed_in_accounts = g_slist_append(signed_in_accounts, acname); | ||
482 | 390 | // this is to make sure that a sign off in an account can't happen | ||
483 | 391 | // without a sign-on, looks dumb. however it happens during | ||
484 | 392 | // connection errors. so this check. | ||
485 | 393 | } | ||
486 | 394 | |||
487 | 395 | static void | ||
488 | 396 | signed_off_cb(PurpleConnection *gc, void *data) //TODO | ||
489 | 397 | { | ||
490 | 398 | PurpleAccount* account = purple_connection_get_account(gc); | ||
491 | 399 | const char *acname = purple_normalize(account, | ||
492 | 400 | purple_account_get_username(account)); | ||
493 | 401 | char* acc; | ||
494 | 402 | GSList* current_account = signed_in_accounts; | ||
495 | 403 | while (current_account != NULL) | ||
496 | 404 | { | ||
497 | 405 | acc = current_account->data; | ||
498 | 406 | if (g_str_equal(acname, acc)) | ||
499 | 407 | { | ||
500 | 408 | const char *text = acname; | ||
501 | 409 | char *account_uri = get_uri_for_account(account); | ||
502 | 410 | |||
503 | 411 | ZeitgeistEvent *event; | ||
504 | 412 | |||
505 | 413 | event = zeitgeist_event_new_full ( | ||
506 | 414 | ZEITGEIST_ZG_LEAVE_EVENT, | ||
507 | 415 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
508 | 416 | "application://pidgin.desktop", | ||
509 | 417 | zeitgeist_subject_new_full ( | ||
510 | 418 | account_uri, | ||
511 | 419 | ZEITGEIST_NCO_CONTACT, | ||
512 | 420 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
513 | 421 | "text/plain", | ||
514 | 422 | "application://pidgin.desktop", | ||
515 | 423 | text, | ||
516 | 424 | "net"), | ||
517 | 425 | NULL); | ||
518 | 426 | |||
519 | 427 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
520 | 428 | ZEITGEIST_ZG_LEAVE_EVENT, | ||
521 | 429 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
522 | 430 | "application://pidgin.desktop", | ||
523 | 431 | account_uri, | ||
524 | 432 | ZEITGEIST_NCO_CONTACT, | ||
525 | 433 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
526 | 434 | "text/plain", | ||
527 | 435 | "application://pidgin.desktop", | ||
528 | 436 | text, | ||
529 | 437 | "net");*/ | ||
530 | 438 | |||
531 | 439 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
532 | 440 | |||
533 | 441 | g_free(account_uri); | ||
534 | 442 | g_free(acc); | ||
535 | 443 | signed_in_accounts = g_slist_delete_link(signed_in_accounts, | ||
536 | 444 | current_account); | ||
537 | 445 | } | ||
538 | 446 | else | ||
539 | 447 | { | ||
540 | 448 | current_account = current_account->next; | ||
541 | 449 | } | ||
542 | 450 | } | ||
543 | 451 | } | ||
544 | 452 | |||
545 | 453 | /************************************************************************** | ||
546 | 454 | * Conversation subsystem signal callbacks | ||
547 | 455 | **************************************************************************/ | ||
548 | 456 | static void | ||
549 | 457 | sent_im_msg_cb(PurpleAccount *account, | ||
550 | 458 | const char *recipient, const char *buffer, void *data) | ||
551 | 459 | { | ||
552 | 460 | store_urls(buffer, account, recipient, TRUE); | ||
553 | 461 | } | ||
554 | 462 | |||
555 | 463 | static void | ||
556 | 464 | received_im_msg_cb(PurpleAccount *account, char *sender, | ||
557 | 465 | char *buffer, PurpleConversation *conv, | ||
558 | 466 | PurpleMessageFlags flags, void *data) | ||
559 | 467 | { | ||
560 | 468 | store_urls(buffer, account, sender, FALSE); | ||
561 | 469 | } | ||
562 | 470 | |||
563 | 471 | static void | ||
564 | 472 | received_chat_msg_cb(PurpleAccount *account, char *sender, | ||
565 | 473 | char *buffer, PurpleConversation *chat, | ||
566 | 474 | PurpleMessageFlags flags, void *data) | ||
567 | 475 | { | ||
568 | 476 | store_urls(buffer, account, sender, FALSE); | ||
569 | 477 | } | ||
570 | 478 | |||
571 | 479 | static void | ||
572 | 480 | conversation_created_cb(PurpleConversation *conv, void *data) | ||
573 | 481 | { | ||
574 | 482 | char *conv_uri = get_uri_for_conversation(conv); | ||
575 | 483 | char *account_uri = get_uri_for_account( | ||
576 | 484 | purple_conversation_get_account(conv)); | ||
577 | 485 | const char *text = purple_conversation_get_title(conv); | ||
578 | 486 | |||
579 | 487 | |||
580 | 488 | ZeitgeistEvent *event; | ||
581 | 489 | |||
582 | 490 | event = zeitgeist_event_new_full ( | ||
583 | 491 | ZEITGEIST_ZG_ACCESS_EVENT, | ||
584 | 492 | ZEITGEIST_ZG_USER_ACTIVITY, //FIXME: this may be world activity | ||
585 | 493 | //find a way to check | ||
586 | 494 | "application://pidgin.desktop", | ||
587 | 495 | zeitgeist_subject_new_full ( | ||
588 | 496 | conv_uri, | ||
589 | 497 | ZEITGEIST_NMO_IMMESSAGE, | ||
590 | 498 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
591 | 499 | "text/plain", | ||
592 | 500 | account_uri, | ||
593 | 501 | text, | ||
594 | 502 | "net"), | ||
595 | 503 | NULL); | ||
596 | 504 | |||
597 | 505 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
598 | 506 | ZEITGEIST_ZG_ACCESS_EVENT, | ||
599 | 507 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
600 | 508 | "application://pidgin.desktop", | ||
601 | 509 | conv_uri, | ||
602 | 510 | ZEITGEIST_NMO_IMMESSAGE, | ||
603 | 511 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
604 | 512 | "text/plain", | ||
605 | 513 | account_uri, | ||
606 | 514 | text, | ||
607 | 515 | "net");*/ | ||
608 | 516 | |||
609 | 517 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
610 | 518 | |||
611 | 519 | g_free(conv_uri); | ||
612 | 520 | g_free(account_uri); | ||
613 | 521 | } | ||
614 | 522 | |||
615 | 523 | static void | ||
616 | 524 | deleting_conversation_cb(PurpleConversation *conv, void *data) | ||
617 | 525 | { | ||
618 | 526 | char *conv_uri = get_uri_for_conversation(conv); | ||
619 | 527 | char *account_uri = get_uri_for_account( | ||
620 | 528 | purple_conversation_get_account(conv)); | ||
621 | 529 | const char *text = purple_conversation_get_title(conv); | ||
622 | 530 | |||
623 | 531 | ZeitgeistEvent *event; | ||
624 | 532 | |||
625 | 533 | event = zeitgeist_event_new_full ( | ||
626 | 534 | ZEITGEIST_ZG_DELETE_EVENT, | ||
627 | 535 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
628 | 536 | "application://pidgin.desktop", | ||
629 | 537 | zeitgeist_subject_new_full ( | ||
630 | 538 | conv_uri, | ||
631 | 539 | ZEITGEIST_NMO_IMMESSAGE, | ||
632 | 540 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
633 | 541 | "text/plain", | ||
634 | 542 | account_uri, | ||
635 | 543 | text, | ||
636 | 544 | "net"), | ||
637 | 545 | NULL); | ||
638 | 546 | |||
639 | 547 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
640 | 548 | ZEITGEIST_ZG_DELETE_EVENT, | ||
641 | 549 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
642 | 550 | "application://pidgin.desktop", | ||
643 | 551 | conv_uri, | ||
644 | 552 | ZEITGEIST_NMO_IMMESSAGE, | ||
645 | 553 | ZEITGEIST_NFO_SOFTWARE_SERVICE, | ||
646 | 554 | "text/plain", | ||
647 | 555 | account_uri, | ||
648 | 556 | text, | ||
649 | 557 | "net");*/ | ||
650 | 558 | |||
651 | 559 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
652 | 560 | |||
653 | 561 | g_free(conv_uri); | ||
654 | 562 | } | ||
655 | 563 | |||
656 | 564 | /************************************************************************** | ||
657 | 565 | * File transfer signal callbacks | ||
658 | 566 | **************************************************************************/ | ||
659 | 567 | |||
660 | 568 | static void | ||
661 | 569 | ft_recv_complete_cb(PurpleXfer *xfer, gpointer data) { | ||
662 | 570 | const char *text = purple_xfer_get_filename(xfer); | ||
663 | 571 | char *content_type = g_content_type_guess( | ||
664 | 572 | purple_xfer_get_local_filename(xfer), | ||
665 | 573 | NULL, 0, NULL); | ||
666 | 574 | char *mime_type = g_content_type_get_mime_type(content_type); | ||
667 | 575 | if (mime_type == NULL) | ||
668 | 576 | mime_type = g_strdup("application/octet-stream"); | ||
669 | 577 | // TODO: check if this is the best possible solution | ||
670 | 578 | g_free(content_type); | ||
671 | 579 | GFile *file = g_file_new_for_path(purple_xfer_get_local_filename(xfer)); | ||
672 | 580 | GFile *parent = g_file_get_parent(file); | ||
673 | 581 | ZeitgeistEvent *event; | ||
674 | 582 | |||
675 | 583 | event = zeitgeist_event_new_full ( | ||
676 | 584 | ZEITGEIST_ZG_RECEIVE_EVENT, | ||
677 | 585 | ZEITGEIST_ZG_WORLD_ACTIVITY, | ||
678 | 586 | "application://pidgin.desktop", | ||
679 | 587 | zeitgeist_subject_new_full ( | ||
680 | 588 | g_file_get_uri(file), | ||
681 | 589 | ZEITGEIST_NFO_DOCUMENT, //FIXME: should check MIME types | ||
682 | 590 | ZEITGEIST_NFO_FILE_DATA_OBJECT, | ||
683 | 591 | mime_type, | ||
684 | 592 | (parent? g_file_get_uri(parent) : g_file_get_uri(file)), | ||
685 | 593 | text, | ||
686 | 594 | "net"), | ||
687 | 595 | NULL); | ||
688 | 596 | |||
689 | 597 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
690 | 598 | ZEITGEIST_ZG_RECEIVE_EVENT, | ||
691 | 599 | ZEITGEIST_ZG_WORLD_ACTIVITY, | ||
692 | 600 | "application://pidgin.desktop", | ||
693 | 601 | g_file_get_uri(file), | ||
694 | 602 | ZEITGEIST_NFO_DOCUMENT, | ||
695 | 603 | ZEITGEIST_NFO_FILE_DATA_OBJECT, | ||
696 | 604 | mime_type, | ||
697 | 605 | (parent? g_file_get_uri(parent) : g_file_get_uri(file)), | ||
698 | 606 | text, | ||
699 | 607 | "net");*/ | ||
700 | 608 | |||
701 | 609 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
702 | 610 | |||
703 | 611 | g_free(mime_type); | ||
704 | 612 | } | ||
705 | 613 | |||
706 | 614 | static void | ||
707 | 615 | ft_send_complete_cb(PurpleXfer *xfer, gpointer data) { | ||
708 | 616 | const char *text = purple_xfer_get_filename(xfer); | ||
709 | 617 | char *content_type = g_content_type_guess( | ||
710 | 618 | purple_xfer_get_local_filename(xfer), | ||
711 | 619 | NULL, 0, NULL); | ||
712 | 620 | char *mime_type = g_content_type_get_mime_type(content_type); | ||
713 | 621 | if (mime_type == NULL) | ||
714 | 622 | mime_type = g_strdup("application/octet-stream"); | ||
715 | 623 | // TODO: check if this is the best possible solution | ||
716 | 624 | g_free(content_type); | ||
717 | 625 | GFile *file = g_file_new_for_path(purple_xfer_get_local_filename(xfer)); | ||
718 | 626 | GFile *parent = g_file_get_parent(file); | ||
719 | 627 | ZeitgeistEvent *event; | ||
720 | 628 | |||
721 | 629 | event = zeitgeist_event_new_full ( | ||
722 | 630 | ZEITGEIST_ZG_SEND_EVENT, | ||
723 | 631 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
724 | 632 | "application://pidgin.desktop", | ||
725 | 633 | zeitgeist_subject_new_full ( | ||
726 | 634 | g_file_get_uri(file), | ||
727 | 635 | ZEITGEIST_NFO_DOCUMENT, //FIXME: should check MIME types | ||
728 | 636 | ZEITGEIST_NFO_FILE_DATA_OBJECT, | ||
729 | 637 | mime_type, | ||
730 | 638 | (parent? g_file_get_uri(parent) : g_file_get_uri(file)), | ||
731 | 639 | text, | ||
732 | 640 | "net"), | ||
733 | 641 | NULL); | ||
734 | 642 | |||
735 | 643 | /*g_print("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", | ||
736 | 644 | ZEITGEIST_ZG_SEND_EVENT, | ||
737 | 645 | ZEITGEIST_ZG_USER_ACTIVITY, | ||
738 | 646 | "application://pidgin.desktop", | ||
739 | 647 | g_file_get_uri(file), | ||
740 | 648 | ZEITGEIST_NFO_DOCUMENT, | ||
741 | 649 | ZEITGEIST_NFO_FILE_DATA_OBJECT, | ||
742 | 650 | mime_type, | ||
743 | 651 | (parent? g_file_get_uri(parent) : g_file_get_uri(file)), | ||
744 | 652 | text, | ||
745 | 653 | "net");*/ | ||
746 | 654 | |||
747 | 655 | zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); | ||
748 | 656 | |||
749 | 657 | g_free(mime_type); | ||
750 | 658 | } | ||
751 | 659 | |||
752 | 660 | /************************************************************************** | ||
753 | 661 | * Plugin stuff | ||
754 | 662 | **************************************************************************/ | ||
755 | 663 | static gboolean | ||
756 | 664 | plugin_load(PurplePlugin *plugin) | ||
757 | 665 | { | ||
758 | 666 | zg_log = zeitgeist_log_new(); | ||
759 | 667 | |||
760 | 668 | void *blist_handle = purple_blist_get_handle(); | ||
761 | 669 | void *conn_handle = purple_connections_get_handle(); | ||
762 | 670 | void *conv_handle = purple_conversations_get_handle(); | ||
763 | 671 | void *ft_handle = purple_xfers_get_handle(); | ||
764 | 672 | |||
765 | 673 | /* Buddy List subsystem signals */ | ||
766 | 674 | purple_signal_connect(blist_handle, "blist-node-added", | ||
767 | 675 | plugin, PURPLE_CALLBACK(blist_node_added_cb), NULL); | ||
768 | 676 | purple_signal_connect(blist_handle, "blist-node-removed", | ||
769 | 677 | plugin, PURPLE_CALLBACK(blist_node_removed_cb), NULL); | ||
770 | 678 | //purple_signal_connect(blist_handle, "blist-node-aliased", | ||
771 | 679 | // plugin, PURPLE_CALLBACK(blist_node_aliased), NULL); | ||
772 | 680 | |||
773 | 681 | /* Connection subsystem signals */ | ||
774 | 682 | purple_signal_connect(conn_handle, "signed-on", | ||
775 | 683 | plugin, PURPLE_CALLBACK(signed_on_cb), NULL); | ||
776 | 684 | purple_signal_connect(conn_handle, "signed-off", | ||
777 | 685 | plugin, PURPLE_CALLBACK(signed_off_cb), NULL); | ||
778 | 686 | |||
779 | 687 | /* Conversations subsystem signals */ | ||
780 | 688 | purple_signal_connect(conv_handle, "sent-im-msg", | ||
781 | 689 | plugin, PURPLE_CALLBACK(sent_im_msg_cb), NULL); | ||
782 | 690 | purple_signal_connect(conv_handle, "received-im-msg", | ||
783 | 691 | plugin, PURPLE_CALLBACK(received_im_msg_cb), NULL); | ||
784 | 692 | purple_signal_connect(conv_handle, "received-chat-msg", | ||
785 | 693 | plugin, PURPLE_CALLBACK(received_chat_msg_cb), NULL); | ||
786 | 694 | purple_signal_connect(conv_handle, "conversation-created", | ||
787 | 695 | plugin, PURPLE_CALLBACK(conversation_created_cb), NULL); | ||
788 | 696 | purple_signal_connect(conv_handle, "deleting-conversation", | ||
789 | 697 | plugin, PURPLE_CALLBACK(deleting_conversation_cb), NULL); | ||
790 | 698 | |||
791 | 699 | /* File transfer signals */ | ||
792 | 700 | purple_signal_connect(ft_handle, "file-recv-complete", | ||
793 | 701 | plugin, PURPLE_CALLBACK(ft_recv_complete_cb), NULL); | ||
794 | 702 | purple_signal_connect(ft_handle, "file-send-complete", | ||
795 | 703 | plugin, PURPLE_CALLBACK(ft_send_complete_cb), NULL); | ||
796 | 704 | |||
797 | 705 | return TRUE; | ||
798 | 706 | } | ||
799 | 707 | |||
800 | 708 | static gboolean | ||
801 | 709 | plugin_unload(PurplePlugin *plugin) | ||
802 | 710 | { | ||
803 | 711 | GSList *current_account = signed_in_accounts; | ||
804 | 712 | char *acc; | ||
805 | 713 | while (current_account != NULL) | ||
806 | 714 | { | ||
807 | 715 | acc = current_account->data; | ||
808 | 716 | g_free(acc); | ||
809 | 717 | current_account = current_account->next; | ||
810 | 718 | } | ||
811 | 719 | g_slist_free(signed_in_accounts); | ||
812 | 720 | signed_in_accounts = NULL; | ||
813 | 721 | |||
814 | 722 | return TRUE; | ||
815 | 723 | } | ||
816 | 724 | |||
817 | 725 | static PurplePluginInfo info = | ||
818 | 726 | { | ||
819 | 727 | PURPLE_PLUGIN_MAGIC, | ||
820 | 728 | PURPLE_MAJOR_VERSION, | ||
821 | 729 | PURPLE_MINOR_VERSION, | ||
822 | 730 | PURPLE_PLUGIN_STANDARD, /**< type */ | ||
823 | 731 | NULL, /**< ui_requirement */ | ||
824 | 732 | 0, /**< flags */ | ||
825 | 733 | NULL, /**< dependencies */ | ||
826 | 734 | PURPLE_PRIORITY_DEFAULT, /**< priority */ | ||
827 | 735 | |||
828 | 736 | ZEITGEIST_ID, /**< id */ | ||
829 | 737 | PNAME, /**< name */ | ||
830 | 738 | PVERSION, /**< version */ | ||
831 | 739 | /** summary */ | ||
832 | 740 | PDESC, /** description */ | ||
833 | 741 | PDESC, | ||
834 | 742 | "Tirtha Chatterjee <tirtha.p.chatterjee@gmail.com>", /**< author */ | ||
835 | 743 | "http://www.zeitgeist-project.com/", /**< homepage */ | ||
836 | 744 | |||
837 | 745 | plugin_load, /**< load */ | ||
838 | 746 | plugin_unload, /**< unload */ | ||
839 | 747 | NULL, /**< destroy */ | ||
840 | 748 | |||
841 | 749 | NULL, /**< ui_info */ | ||
842 | 750 | NULL, /**< extra_info */ | ||
843 | 751 | NULL, | ||
844 | 752 | NULL, | ||
845 | 753 | /* Padding */ | ||
846 | 754 | NULL, | ||
847 | 755 | NULL, | ||
848 | 756 | NULL, | ||
849 | 757 | NULL | ||
850 | 758 | }; | ||
851 | 759 | |||
852 | 760 | static void | ||
853 | 761 | init_plugin(PurplePlugin *plugin) | ||
854 | 762 | { | ||
855 | 763 | } | ||
856 | 764 | |||
857 | 765 | PURPLE_INIT_PLUGIN(zeitgeist, init_plugin, info) |
In purple/ zeitgeist_ dataprovider. c
> Zeitgeist dataprovider for XChat is free software;
Should be purple instead of XChat
> Zeitgeist dataprovider for XChat is distributed in the hope that
Should be again purple.