1 | /***************************************************************************\ |
---|
2 | * * |
---|
3 | * BitlBee - An IRC to IM gateway * |
---|
4 | * Simple module to facilitate twitter functionality. * |
---|
5 | * * |
---|
6 | * Copyright 2009 Geert Mulders <g.c.w.m.mulders@gmail.com> * |
---|
7 | * * |
---|
8 | * This library is free software; you can redistribute it and/or * |
---|
9 | * modify it under the terms of the GNU Lesser General Public * |
---|
10 | * License as published by the Free Software Foundation, version * |
---|
11 | * 2.1. * |
---|
12 | * * |
---|
13 | * This library is distributed in the hope that it will be useful, * |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
---|
16 | * Lesser General Public License for more details. * |
---|
17 | * * |
---|
18 | * You should have received a copy of the GNU Lesser General Public License * |
---|
19 | * along with this library; if not, write to the Free Software Foundation, * |
---|
20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * |
---|
21 | * * |
---|
22 | ****************************************************************************/ |
---|
23 | |
---|
24 | #include "nogaim.h" |
---|
25 | #include "oauth.h" |
---|
26 | #include "twitter.h" |
---|
27 | #include "twitter_http.h" |
---|
28 | #include "twitter_lib.h" |
---|
29 | #include "url.h" |
---|
30 | |
---|
31 | #define twitter_msg( ic, fmt... ) \ |
---|
32 | do { \ |
---|
33 | struct twitter_data *td = ic->proto_data; \ |
---|
34 | if( td->home_timeline_gc ) \ |
---|
35 | imcb_chat_log( td->home_timeline_gc, fmt ); \ |
---|
36 | else \ |
---|
37 | imcb_log( ic, fmt ); \ |
---|
38 | } while( 0 ); |
---|
39 | |
---|
40 | GSList *twitter_connections = NULL; |
---|
41 | |
---|
42 | /** |
---|
43 | * Main loop function |
---|
44 | */ |
---|
45 | gboolean twitter_main_loop(gpointer data, gint fd, b_input_condition cond) |
---|
46 | { |
---|
47 | struct im_connection *ic = data; |
---|
48 | |
---|
49 | // Check if we are still logged in... |
---|
50 | if (!g_slist_find( twitter_connections, ic )) |
---|
51 | return 0; |
---|
52 | |
---|
53 | // Do stuff.. |
---|
54 | twitter_get_home_timeline(ic, -1); |
---|
55 | |
---|
56 | // If we are still logged in run this function again after timeout. |
---|
57 | return (ic->flags & OPT_LOGGED_IN) == OPT_LOGGED_IN; |
---|
58 | } |
---|
59 | |
---|
60 | static void twitter_main_loop_start( struct im_connection *ic ) |
---|
61 | { |
---|
62 | struct twitter_data *td = ic->proto_data; |
---|
63 | |
---|
64 | imcb_log( ic, "Getting initial statuses" ); |
---|
65 | |
---|
66 | // Run this once. After this queue the main loop function. |
---|
67 | twitter_main_loop(ic, -1, 0); |
---|
68 | |
---|
69 | // Queue the main_loop |
---|
70 | // Save the return value, so we can remove the timeout on logout. |
---|
71 | td->main_loop_id = b_timeout_add(60000, twitter_main_loop, ic); |
---|
72 | } |
---|
73 | |
---|
74 | static void twitter_oauth_start( struct im_connection *ic ); |
---|
75 | |
---|
76 | void twitter_login_finish( struct im_connection *ic ) |
---|
77 | { |
---|
78 | struct twitter_data *td = ic->proto_data; |
---|
79 | |
---|
80 | if( set_getbool( &ic->acc->set, "oauth" ) && !td->oauth_info ) |
---|
81 | twitter_oauth_start( ic ); |
---|
82 | else if( g_strcasecmp( set_getstr( &ic->acc->set, "mode" ), "one" ) != 0 && |
---|
83 | !( td->flags & TWITTER_HAVE_FRIENDS ) ) |
---|
84 | { |
---|
85 | imcb_log( ic, "Getting contact list" ); |
---|
86 | twitter_get_statuses_friends( ic, -1 ); |
---|
87 | } |
---|
88 | else |
---|
89 | twitter_main_loop_start( ic ); |
---|
90 | } |
---|
91 | |
---|
92 | static const struct oauth_service twitter_oauth = |
---|
93 | { |
---|
94 | "http://api.twitter.com/oauth/request_token", |
---|
95 | "http://api.twitter.com/oauth/access_token", |
---|
96 | "https://api.twitter.com/oauth/authorize", |
---|
97 | .consumer_key = "xsDNKJuNZYkZyMcu914uEA", |
---|
98 | .consumer_secret = "FCxqcr0pXKzsF9ajmP57S3VQ8V6Drk4o2QYtqMcOszo", |
---|
99 | }; |
---|
100 | |
---|
101 | static gboolean twitter_oauth_callback( struct oauth_info *info ); |
---|
102 | |
---|
103 | static void twitter_oauth_start( struct im_connection *ic ) |
---|
104 | { |
---|
105 | struct twitter_data *td = ic->proto_data; |
---|
106 | |
---|
107 | imcb_log( ic, "Requesting OAuth request token" ); |
---|
108 | |
---|
109 | td->oauth_info = oauth_request_token( &twitter_oauth, twitter_oauth_callback, ic ); |
---|
110 | |
---|
111 | /* We need help from the user to complete OAuth login, so don't time |
---|
112 | out on this login. */ |
---|
113 | ic->flags |= OPT_SLOW_LOGIN; |
---|
114 | } |
---|
115 | |
---|
116 | static gboolean twitter_oauth_callback( struct oauth_info *info ) |
---|
117 | { |
---|
118 | struct im_connection *ic = info->data; |
---|
119 | struct twitter_data *td; |
---|
120 | |
---|
121 | if( !g_slist_find( twitter_connections, ic ) ) |
---|
122 | return FALSE; |
---|
123 | |
---|
124 | td = ic->proto_data; |
---|
125 | if( info->stage == OAUTH_REQUEST_TOKEN ) |
---|
126 | { |
---|
127 | char name[strlen(ic->acc->user)+9], *msg; |
---|
128 | |
---|
129 | if( info->request_token == NULL ) |
---|
130 | { |
---|
131 | imcb_error( ic, "OAuth error: %s", info->http->status_string ); |
---|
132 | imc_logout( ic, TRUE ); |
---|
133 | return FALSE; |
---|
134 | } |
---|
135 | |
---|
136 | sprintf( name, "%s_%s", td->prefix, ic->acc->user ); |
---|
137 | msg = g_strdup_printf( "To finish OAuth authentication, please visit " |
---|
138 | "%s and respond with the resulting PIN code.", |
---|
139 | info->auth_url ); |
---|
140 | imcb_buddy_msg( ic, name, msg, 0, 0 ); |
---|
141 | g_free( msg ); |
---|
142 | } |
---|
143 | else if( info->stage == OAUTH_ACCESS_TOKEN ) |
---|
144 | { |
---|
145 | if( info->token == NULL || info->token_secret == NULL ) |
---|
146 | { |
---|
147 | imcb_error( ic, "OAuth error: %s", info->http->status_string ); |
---|
148 | imc_logout( ic, TRUE ); |
---|
149 | return FALSE; |
---|
150 | } |
---|
151 | |
---|
152 | /* IM mods didn't do this so far and it's ugly but I should |
---|
153 | be able to get away with it... */ |
---|
154 | g_free( ic->acc->pass ); |
---|
155 | ic->acc->pass = oauth_to_string( info ); |
---|
156 | |
---|
157 | twitter_login_finish( ic ); |
---|
158 | } |
---|
159 | |
---|
160 | return TRUE; |
---|
161 | } |
---|
162 | |
---|
163 | |
---|
164 | static char *set_eval_mode( set_t *set, char *value ) |
---|
165 | { |
---|
166 | if( g_strcasecmp( value, "one" ) == 0 || |
---|
167 | g_strcasecmp( value, "many" ) == 0 || |
---|
168 | g_strcasecmp( value, "chat" ) == 0 ) |
---|
169 | return value; |
---|
170 | else |
---|
171 | return NULL; |
---|
172 | } |
---|
173 | |
---|
174 | static gboolean twitter_length_check( struct im_connection *ic, gchar *msg ) |
---|
175 | { |
---|
176 | int max = set_getint( &ic->acc->set, "message_length" ), len; |
---|
177 | |
---|
178 | if( max == 0 || ( len = g_utf8_strlen( msg, -1 ) ) <= max ) |
---|
179 | return TRUE; |
---|
180 | |
---|
181 | imcb_error( ic, "Maximum message length exceeded: %d > %d", len, max ); |
---|
182 | |
---|
183 | return FALSE; |
---|
184 | } |
---|
185 | |
---|
186 | static void twitter_init( account_t *acc ) |
---|
187 | { |
---|
188 | set_t *s; |
---|
189 | char *def_url; |
---|
190 | char *def_oauth; |
---|
191 | |
---|
192 | if( strcmp( acc->prpl->name, "twitter" ) == 0 ) |
---|
193 | { |
---|
194 | def_url = TWITTER_API_URL; |
---|
195 | def_oauth = "true"; |
---|
196 | } |
---|
197 | else /* if( strcmp( acc->prpl->name, "identica" ) == 0 ) */ |
---|
198 | { |
---|
199 | def_url = IDENTICA_API_URL; |
---|
200 | def_oauth = "false"; |
---|
201 | } |
---|
202 | |
---|
203 | s = set_add( &acc->set, "auto_reply_timeout", "10800", set_eval_int, acc ); |
---|
204 | |
---|
205 | s = set_add( &acc->set, "base_url", def_url, NULL, acc ); |
---|
206 | s->flags |= ACC_SET_OFFLINE_ONLY; |
---|
207 | |
---|
208 | s = set_add( &acc->set, "commands", "true", set_eval_bool, acc ); |
---|
209 | |
---|
210 | s = set_add( &acc->set, "message_length", "140", set_eval_int, acc ); |
---|
211 | |
---|
212 | s = set_add( &acc->set, "mode", "chat", set_eval_mode, acc ); |
---|
213 | s->flags |= ACC_SET_OFFLINE_ONLY; |
---|
214 | |
---|
215 | s = set_add( &acc->set, "oauth", def_oauth, set_eval_bool, acc ); |
---|
216 | } |
---|
217 | |
---|
218 | /** |
---|
219 | * Login method. Since the twitter API works with seperate HTTP request we |
---|
220 | * only save the user and pass to the twitter_data object. |
---|
221 | */ |
---|
222 | static void twitter_login( account_t *acc ) |
---|
223 | { |
---|
224 | struct im_connection *ic = imcb_new( acc ); |
---|
225 | struct twitter_data *td; |
---|
226 | char name[strlen(acc->user)+9]; |
---|
227 | url_t url; |
---|
228 | |
---|
229 | if( !url_set( &url, set_getstr( &ic->acc->set, "base_url" ) ) || |
---|
230 | ( url.proto != PROTO_HTTP && url.proto != PROTO_HTTPS ) ) |
---|
231 | { |
---|
232 | imcb_error( ic, "Incorrect API base URL: %s", set_getstr( &ic->acc->set, "base_url" ) ); |
---|
233 | imc_logout( ic, FALSE ); |
---|
234 | return; |
---|
235 | } |
---|
236 | |
---|
237 | twitter_connections = g_slist_append( twitter_connections, ic ); |
---|
238 | td = g_new0( struct twitter_data, 1 ); |
---|
239 | ic->proto_data = td; |
---|
240 | |
---|
241 | td->url_ssl = url.proto == PROTO_HTTPS; |
---|
242 | td->url_port = url.port; |
---|
243 | td->url_host = g_strdup( url.host ); |
---|
244 | if( strcmp( url.file, "/" ) != 0 ) |
---|
245 | td->url_path = g_strdup( url.file ); |
---|
246 | else |
---|
247 | td->url_path = g_strdup( "" ); |
---|
248 | if( g_str_has_suffix( url.host, ".com" ) ) |
---|
249 | td->prefix = g_strndup( url.host, strlen( url.host ) - 4 ); |
---|
250 | else |
---|
251 | td->prefix = g_strdup( url.host ); |
---|
252 | |
---|
253 | td->user = acc->user; |
---|
254 | if( strstr( acc->pass, "oauth_token=" ) ) |
---|
255 | td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth ); |
---|
256 | |
---|
257 | sprintf( name, "%s_%s", td->prefix, acc->user ); |
---|
258 | imcb_add_buddy( ic, name, NULL ); |
---|
259 | imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL ); |
---|
260 | |
---|
261 | imcb_log( ic, "Connecting" ); |
---|
262 | |
---|
263 | twitter_login_finish( ic ); |
---|
264 | } |
---|
265 | |
---|
266 | /** |
---|
267 | * Logout method. Just free the twitter_data. |
---|
268 | */ |
---|
269 | static void twitter_logout( struct im_connection *ic ) |
---|
270 | { |
---|
271 | struct twitter_data *td = ic->proto_data; |
---|
272 | |
---|
273 | // Set the status to logged out. |
---|
274 | ic->flags &= ~ OPT_LOGGED_IN; |
---|
275 | |
---|
276 | // Remove the main_loop function from the function queue. |
---|
277 | b_event_remove(td->main_loop_id); |
---|
278 | |
---|
279 | if(td->home_timeline_gc) |
---|
280 | imcb_chat_free(td->home_timeline_gc); |
---|
281 | |
---|
282 | if( td ) |
---|
283 | { |
---|
284 | oauth_info_free( td->oauth_info ); |
---|
285 | g_free( td->prefix ); |
---|
286 | g_free( td->url_host ); |
---|
287 | g_free( td->url_path ); |
---|
288 | g_free( td->pass ); |
---|
289 | g_free( td ); |
---|
290 | } |
---|
291 | |
---|
292 | twitter_connections = g_slist_remove( twitter_connections, ic ); |
---|
293 | } |
---|
294 | |
---|
295 | static void twitter_handle_command( struct im_connection *ic, char *message ); |
---|
296 | |
---|
297 | /** |
---|
298 | * |
---|
299 | */ |
---|
300 | static int twitter_buddy_msg( struct im_connection *ic, char *who, char *message, int away ) |
---|
301 | { |
---|
302 | struct twitter_data *td = ic->proto_data; |
---|
303 | int plen = strlen( td->prefix ); |
---|
304 | |
---|
305 | if (g_strncasecmp(who, td->prefix, plen) == 0 && who[plen] == '_' && |
---|
306 | g_strcasecmp(who + plen + 1, ic->acc->user) == 0) |
---|
307 | { |
---|
308 | if( set_getbool( &ic->acc->set, "oauth" ) && |
---|
309 | td->oauth_info && td->oauth_info->token == NULL ) |
---|
310 | { |
---|
311 | char pin[strlen(message)+1], *s; |
---|
312 | |
---|
313 | strcpy( pin, message ); |
---|
314 | for( s = pin + sizeof( pin ) - 2; s > pin && isspace( *s ); s -- ) |
---|
315 | *s = '\0'; |
---|
316 | for( s = pin; *s && isspace( *s ); s ++ ) {} |
---|
317 | |
---|
318 | if( !oauth_access_token( s, td->oauth_info ) ) |
---|
319 | { |
---|
320 | imcb_error( ic, "OAuth error: %s", "Failed to send access token request" ); |
---|
321 | imc_logout( ic, TRUE ); |
---|
322 | return FALSE; |
---|
323 | } |
---|
324 | } |
---|
325 | else |
---|
326 | twitter_handle_command(ic, message); |
---|
327 | } |
---|
328 | else |
---|
329 | { |
---|
330 | twitter_direct_messages_new(ic, who, message); |
---|
331 | } |
---|
332 | return( 0 ); |
---|
333 | } |
---|
334 | |
---|
335 | /** |
---|
336 | * |
---|
337 | */ |
---|
338 | static void twitter_set_my_name( struct im_connection *ic, char *info ) |
---|
339 | { |
---|
340 | } |
---|
341 | |
---|
342 | static void twitter_get_info(struct im_connection *ic, char *who) |
---|
343 | { |
---|
344 | } |
---|
345 | |
---|
346 | static void twitter_add_buddy( struct im_connection *ic, char *who, char *group ) |
---|
347 | { |
---|
348 | twitter_friendships_create_destroy(ic, who, 1); |
---|
349 | } |
---|
350 | |
---|
351 | static void twitter_remove_buddy( struct im_connection *ic, char *who, char *group ) |
---|
352 | { |
---|
353 | twitter_friendships_create_destroy(ic, who, 0); |
---|
354 | } |
---|
355 | |
---|
356 | static void twitter_chat_msg( struct groupchat *c, char *message, int flags ) |
---|
357 | { |
---|
358 | if( c && message ) |
---|
359 | twitter_handle_command( c->ic, message ); |
---|
360 | } |
---|
361 | |
---|
362 | static void twitter_chat_invite( struct groupchat *c, char *who, char *message ) |
---|
363 | { |
---|
364 | } |
---|
365 | |
---|
366 | static void twitter_chat_leave( struct groupchat *c ) |
---|
367 | { |
---|
368 | struct twitter_data *td = c->ic->proto_data; |
---|
369 | |
---|
370 | if( c != td->home_timeline_gc ) |
---|
371 | return; /* WTF? */ |
---|
372 | |
---|
373 | /* If the user leaves the channel: Fine. Rejoin him/her once new |
---|
374 | tweets come in. */ |
---|
375 | imcb_chat_free(td->home_timeline_gc); |
---|
376 | td->home_timeline_gc = NULL; |
---|
377 | } |
---|
378 | |
---|
379 | static void twitter_keepalive( struct im_connection *ic ) |
---|
380 | { |
---|
381 | } |
---|
382 | |
---|
383 | static void twitter_add_permit( struct im_connection *ic, char *who ) |
---|
384 | { |
---|
385 | } |
---|
386 | |
---|
387 | static void twitter_rem_permit( struct im_connection *ic, char *who ) |
---|
388 | { |
---|
389 | } |
---|
390 | |
---|
391 | static void twitter_add_deny( struct im_connection *ic, char *who ) |
---|
392 | { |
---|
393 | } |
---|
394 | |
---|
395 | static void twitter_rem_deny( struct im_connection *ic, char *who ) |
---|
396 | { |
---|
397 | } |
---|
398 | |
---|
399 | //static char *twitter_set_display_name( set_t *set, char *value ) |
---|
400 | //{ |
---|
401 | // return value; |
---|
402 | //} |
---|
403 | |
---|
404 | static void twitter_buddy_data_add( struct bee_user *bu ) |
---|
405 | { |
---|
406 | bu->data = g_new0( struct twitter_user_data, 1 ); |
---|
407 | } |
---|
408 | |
---|
409 | static void twitter_buddy_data_free( struct bee_user *bu ) |
---|
410 | { |
---|
411 | g_free( bu->data ); |
---|
412 | } |
---|
413 | |
---|
414 | static void twitter_handle_command( struct im_connection *ic, char *message ) |
---|
415 | { |
---|
416 | struct twitter_data *td = ic->proto_data; |
---|
417 | char *cmds, **cmd; |
---|
418 | |
---|
419 | cmds = g_strdup( message ); |
---|
420 | cmd = split_command_parts( cmds ); |
---|
421 | |
---|
422 | if( cmd[0] == NULL ) |
---|
423 | { |
---|
424 | g_free( cmds ); |
---|
425 | return; |
---|
426 | } |
---|
427 | else if( !set_getbool( &ic->acc->set, "commands" ) ) |
---|
428 | { |
---|
429 | /* Not supporting commands. */ |
---|
430 | } |
---|
431 | else if( g_strcasecmp( cmd[0], "undo" ) == 0 ) |
---|
432 | { |
---|
433 | guint64 id; |
---|
434 | |
---|
435 | if( cmd[1] ) |
---|
436 | id = g_ascii_strtoull( cmd[1], NULL, 10 ); |
---|
437 | else |
---|
438 | id = td->last_status_id; |
---|
439 | |
---|
440 | /* TODO: User feedback. */ |
---|
441 | if( id ) |
---|
442 | twitter_status_destroy( ic, id ); |
---|
443 | else |
---|
444 | twitter_msg( ic, "Could not undo last action" ); |
---|
445 | |
---|
446 | g_free( cmds ); |
---|
447 | return; |
---|
448 | } |
---|
449 | else if( g_strcasecmp( cmd[0], "follow" ) == 0 && cmd[1] ) |
---|
450 | { |
---|
451 | twitter_add_buddy( ic, cmd[1], NULL ); |
---|
452 | g_free( cmds ); |
---|
453 | return; |
---|
454 | } |
---|
455 | else if( g_strcasecmp( cmd[0], "unfollow" ) == 0 && cmd[1] ) |
---|
456 | { |
---|
457 | twitter_remove_buddy( ic, cmd[1], NULL ); |
---|
458 | g_free( cmds ); |
---|
459 | return; |
---|
460 | } |
---|
461 | else if( g_strcasecmp( cmd[0], "rt" ) == 0 && cmd[1] ) |
---|
462 | { |
---|
463 | struct twitter_user_data *tud; |
---|
464 | bee_user_t *bu; |
---|
465 | guint64 id; |
---|
466 | |
---|
467 | if( ( bu = bee_user_by_handle( ic->bee, ic, cmd[1] ) ) && |
---|
468 | ( tud = bu->data ) && tud->last_id ) |
---|
469 | id = tud->last_id; |
---|
470 | else |
---|
471 | id = g_ascii_strtoull( cmd[1], NULL, 10 ); |
---|
472 | |
---|
473 | td->last_status_id = 0; |
---|
474 | if( id ) |
---|
475 | twitter_status_retweet( ic, id ); |
---|
476 | else |
---|
477 | twitter_msg( ic, "User `%s' does not exist or didn't " |
---|
478 | "post any statuses recently", cmd[1] ); |
---|
479 | |
---|
480 | g_free( cmds ); |
---|
481 | return; |
---|
482 | } |
---|
483 | else if( g_strcasecmp( cmd[0], "post" ) == 0 ) |
---|
484 | { |
---|
485 | message += 5; |
---|
486 | } |
---|
487 | |
---|
488 | { |
---|
489 | guint64 in_reply_to = 0; |
---|
490 | char *s, *new = NULL; |
---|
491 | bee_user_t *bu; |
---|
492 | |
---|
493 | if( !twitter_length_check( ic, message ) ) |
---|
494 | { |
---|
495 | g_free( cmds ); |
---|
496 | return; |
---|
497 | } |
---|
498 | |
---|
499 | s = cmd[0] + strlen( cmd[0] ) - 1; |
---|
500 | if( s > cmd[0] && ( *s == ':' || *s == ',' ) ) |
---|
501 | { |
---|
502 | *s = '\0'; |
---|
503 | |
---|
504 | if( ( bu = bee_user_by_handle( ic->bee, ic, cmd[0] ) ) ) |
---|
505 | { |
---|
506 | struct twitter_user_data *tud = bu->data; |
---|
507 | |
---|
508 | new = g_strdup_printf( "@%s %s", bu->handle, |
---|
509 | message + ( s - cmd[0] ) + 2 ); |
---|
510 | message = new; |
---|
511 | |
---|
512 | if( time( NULL ) < tud->last_time + |
---|
513 | set_getint( &ic->acc->set, "auto_reply_timeout" ) ) |
---|
514 | in_reply_to = tud->last_id; |
---|
515 | } |
---|
516 | } |
---|
517 | |
---|
518 | /* If the user runs undo between this request and its response |
---|
519 | this would delete the second-last Tweet. Prevent that. */ |
---|
520 | td->last_status_id = 0; |
---|
521 | twitter_post_status( ic, message, in_reply_to ); |
---|
522 | g_free( new ); |
---|
523 | } |
---|
524 | g_free( cmds ); |
---|
525 | } |
---|
526 | |
---|
527 | void twitter_initmodule() |
---|
528 | { |
---|
529 | struct prpl *ret = g_new0(struct prpl, 1); |
---|
530 | |
---|
531 | ret->options = OPT_NOOTR; |
---|
532 | ret->name = "twitter"; |
---|
533 | ret->login = twitter_login; |
---|
534 | ret->init = twitter_init; |
---|
535 | ret->logout = twitter_logout; |
---|
536 | ret->buddy_msg = twitter_buddy_msg; |
---|
537 | ret->get_info = twitter_get_info; |
---|
538 | ret->set_my_name = twitter_set_my_name; |
---|
539 | ret->add_buddy = twitter_add_buddy; |
---|
540 | ret->remove_buddy = twitter_remove_buddy; |
---|
541 | ret->chat_msg = twitter_chat_msg; |
---|
542 | ret->chat_invite = twitter_chat_invite; |
---|
543 | ret->chat_leave = twitter_chat_leave; |
---|
544 | ret->keepalive = twitter_keepalive; |
---|
545 | ret->add_permit = twitter_add_permit; |
---|
546 | ret->rem_permit = twitter_rem_permit; |
---|
547 | ret->add_deny = twitter_add_deny; |
---|
548 | ret->rem_deny = twitter_rem_deny; |
---|
549 | ret->buddy_data_add = twitter_buddy_data_add; |
---|
550 | ret->buddy_data_free = twitter_buddy_data_free; |
---|
551 | ret->handle_cmp = g_strcasecmp; |
---|
552 | |
---|
553 | register_protocol(ret); |
---|
554 | |
---|
555 | /* And an identi.ca variant: */ |
---|
556 | ret = g_memdup(ret, sizeof(struct prpl)); |
---|
557 | ret->name = "identica"; |
---|
558 | register_protocol(ret); |
---|
559 | } |
---|