[796da03] | 1 | /***************************************************************************\ |
---|
| 2 | * * |
---|
| 3 | * BitlBee - An IRC to IM gateway * |
---|
| 4 | * libpurple module - Main file * |
---|
| 5 | * * |
---|
| 6 | * Copyright 2009 Wilmer van der Gaast <wilmer@gaast.net> * |
---|
| 7 | * * |
---|
| 8 | * This program is free software; you can redistribute it and/or modify * |
---|
| 9 | * it under the terms of the GNU General Public License as published by * |
---|
| 10 | * the Free Software Foundation; either version 2 of the License, or * |
---|
| 11 | * (at your option) any later version. * |
---|
| 12 | * * |
---|
| 13 | * This program 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 * |
---|
| 16 | * GNU General Public License for more details. * |
---|
| 17 | * * |
---|
| 18 | * You should have received a copy of the GNU General Public License along * |
---|
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., * |
---|
| 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * |
---|
| 21 | * * |
---|
| 22 | \***************************************************************************/ |
---|
| 23 | |
---|
| 24 | #include <glib.h> |
---|
| 25 | #include <purple.h> |
---|
| 26 | |
---|
| 27 | #include "bitlbee.h" |
---|
| 28 | |
---|
| 29 | GSList *purple_connections; |
---|
| 30 | |
---|
[7da726b] | 31 | static struct im_connection *purple_ic_by_pa( PurpleAccount *pa ) |
---|
[860ba6a] | 32 | { |
---|
| 33 | GSList *i; |
---|
| 34 | |
---|
| 35 | for( i = purple_connections; i; i = i->next ) |
---|
| 36 | if( ((struct im_connection *)i->data)->proto_data == pa ) |
---|
| 37 | return i->data; |
---|
| 38 | |
---|
| 39 | return NULL; |
---|
| 40 | } |
---|
| 41 | |
---|
[7da726b] | 42 | static struct im_connection *purple_ic_by_gc( PurpleConnection *gc ) |
---|
| 43 | { |
---|
| 44 | return purple_ic_by_pa( purple_connection_get_account( gc ) ); |
---|
| 45 | } |
---|
| 46 | |
---|
[796da03] | 47 | static void purple_init( account_t *acc ) |
---|
| 48 | { |
---|
[0f7ee7e5] | 49 | PurplePlugin *prpl = purple_plugins_find_with_id( acc->prpl->name ); |
---|
| 50 | PurplePluginProtocolInfo *pi = prpl->info->extra_info; |
---|
| 51 | GList *i; |
---|
[0cbef26] | 52 | |
---|
[0f7ee7e5] | 53 | for( i = pi->protocol_options; i; i = i->next ) |
---|
| 54 | { |
---|
| 55 | PurpleAccountOption *o = i->data; |
---|
| 56 | const char *name; |
---|
| 57 | char *def = NULL; |
---|
| 58 | set_eval eval = NULL; |
---|
| 59 | set_t *s; |
---|
| 60 | |
---|
| 61 | name = purple_account_option_get_setting( o ); |
---|
| 62 | |
---|
| 63 | switch( purple_account_option_get_type( o ) ) |
---|
| 64 | { |
---|
| 65 | case PURPLE_PREF_STRING: |
---|
| 66 | def = g_strdup( purple_account_option_get_default_string( o ) ); |
---|
| 67 | break; |
---|
| 68 | |
---|
| 69 | case PURPLE_PREF_INT: |
---|
| 70 | def = g_strdup_printf( "%d", purple_account_option_get_default_int( o ) ); |
---|
| 71 | eval = set_eval_int; |
---|
| 72 | break; |
---|
| 73 | |
---|
| 74 | case PURPLE_PREF_BOOLEAN: |
---|
| 75 | if( purple_account_option_get_default_bool( o ) ) |
---|
| 76 | def = g_strdup( "true" ); |
---|
| 77 | else |
---|
| 78 | def = g_strdup( "false" ); |
---|
| 79 | eval = set_eval_bool; |
---|
| 80 | break; |
---|
| 81 | |
---|
| 82 | default: |
---|
| 83 | fprintf( stderr, "Setting with unknown type: %s (%d)\n", name, purple_account_option_get_type( o ) ); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | if( def != NULL ) |
---|
| 87 | { |
---|
| 88 | s = set_add( &acc->set, name, def, eval, acc ); |
---|
| 89 | s->flags |= ACC_SET_OFFLINE_ONLY; |
---|
| 90 | g_free( def ); |
---|
| 91 | } |
---|
| 92 | } |
---|
[796da03] | 93 | } |
---|
| 94 | |
---|
[b74b287] | 95 | static void purple_sync_settings( account_t *acc, PurpleAccount *pa ) |
---|
| 96 | { |
---|
| 97 | PurplePlugin *prpl = purple_plugins_find_with_id( pa->protocol_id ); |
---|
| 98 | PurplePluginProtocolInfo *pi = prpl->info->extra_info; |
---|
| 99 | GList *i; |
---|
| 100 | |
---|
| 101 | for( i = pi->protocol_options; i; i = i->next ) |
---|
| 102 | { |
---|
| 103 | PurpleAccountOption *o = i->data; |
---|
| 104 | const char *name; |
---|
| 105 | set_t *s; |
---|
| 106 | |
---|
| 107 | name = purple_account_option_get_setting( o ); |
---|
| 108 | s = set_find( &acc->set, name ); |
---|
| 109 | if( s->value == NULL ) |
---|
| 110 | continue; |
---|
| 111 | |
---|
| 112 | switch( purple_account_option_get_type( o ) ) |
---|
| 113 | { |
---|
| 114 | case PURPLE_PREF_STRING: |
---|
| 115 | purple_account_set_string( pa, name, set_getstr( &acc->set, name ) ); |
---|
| 116 | break; |
---|
| 117 | |
---|
| 118 | case PURPLE_PREF_INT: |
---|
| 119 | purple_account_set_int( pa, name, set_getint( &acc->set, name ) ); |
---|
| 120 | break; |
---|
| 121 | |
---|
| 122 | case PURPLE_PREF_BOOLEAN: |
---|
| 123 | purple_account_set_bool( pa, name, set_getbool( &acc->set, name ) ); |
---|
| 124 | break; |
---|
| 125 | |
---|
| 126 | default: |
---|
| 127 | break; |
---|
| 128 | } |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | |
---|
[796da03] | 132 | static void purple_login( account_t *acc ) |
---|
| 133 | { |
---|
| 134 | struct im_connection *ic = imcb_new( acc ); |
---|
[860ba6a] | 135 | PurpleAccount *pa; |
---|
[796da03] | 136 | |
---|
| 137 | /* For now this is needed in the _connected() handlers if using |
---|
| 138 | GLib event handling, to make sure we're not handling events |
---|
| 139 | on dead connections. */ |
---|
| 140 | purple_connections = g_slist_prepend( purple_connections, ic ); |
---|
| 141 | |
---|
[b74b287] | 142 | ic->proto_data = pa = purple_account_new( acc->user, acc->prpl->name ); |
---|
[860ba6a] | 143 | purple_account_set_password( pa, acc->pass ); |
---|
[b74b287] | 144 | purple_sync_settings( acc, pa ); |
---|
[860ba6a] | 145 | |
---|
| 146 | purple_account_set_enabled( pa, "BitlBee", TRUE ); |
---|
[796da03] | 147 | } |
---|
| 148 | |
---|
| 149 | static void purple_logout( struct im_connection *ic ) |
---|
| 150 | { |
---|
[db4cd40] | 151 | PurpleAccount *pa = ic->proto_data; |
---|
| 152 | |
---|
| 153 | purple_account_set_enabled( pa, "BitlBee", FALSE ); |
---|
[796da03] | 154 | purple_connections = g_slist_remove( purple_connections, ic ); |
---|
[b74b287] | 155 | purple_accounts_remove( pa ); |
---|
[796da03] | 156 | } |
---|
| 157 | |
---|
| 158 | static int purple_buddy_msg( struct im_connection *ic, char *who, char *message, int flags ) |
---|
| 159 | { |
---|
[389f7be] | 160 | PurpleConversation *conv; |
---|
| 161 | |
---|
| 162 | if( ( conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_IM, |
---|
| 163 | who, ic->proto_data ) ) == NULL ) |
---|
| 164 | { |
---|
| 165 | conv = purple_conversation_new( PURPLE_CONV_TYPE_IM, |
---|
| 166 | ic->proto_data, who ); |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | purple_conv_im_send( purple_conversation_get_im_data( conv ), message ); |
---|
[0cbef26] | 170 | |
---|
| 171 | return 1; |
---|
[796da03] | 172 | } |
---|
| 173 | |
---|
| 174 | static GList *purple_away_states( struct im_connection *ic ) |
---|
| 175 | { |
---|
[ec5e57d] | 176 | PurpleAccount *pa = ic->proto_data; |
---|
| 177 | GList *st, *ret = NULL; |
---|
| 178 | |
---|
| 179 | for( st = purple_account_get_status_types( pa ); st; st = st->next ) |
---|
| 180 | ret = g_list_append( ret, (void*) purple_status_type_get_name( st->data ) ); |
---|
| 181 | |
---|
| 182 | return ret; |
---|
[796da03] | 183 | } |
---|
| 184 | |
---|
| 185 | static void purple_set_away( struct im_connection *ic, char *state_txt, char *message ) |
---|
| 186 | { |
---|
[ec5e57d] | 187 | PurpleAccount *pa = ic->proto_data; |
---|
| 188 | GList *status_types = purple_account_get_status_types( pa ), *st; |
---|
| 189 | PurpleStatusType *pst = NULL; |
---|
| 190 | |
---|
| 191 | for( st = status_types; st; st = st->next ) |
---|
| 192 | { |
---|
| 193 | pst = st->data; |
---|
| 194 | |
---|
| 195 | if( g_strcasecmp( state_txt, purple_status_type_get_name( pst ) ) == 0 ) |
---|
| 196 | break; |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | purple_account_set_status( pa, st ? purple_status_type_get_id( pst ) : "away", |
---|
| 200 | TRUE, "message", message, NULL ); |
---|
[796da03] | 201 | } |
---|
| 202 | |
---|
| 203 | static void purple_add_buddy( struct im_connection *ic, char *who, char *group ) |
---|
| 204 | { |
---|
| 205 | } |
---|
| 206 | |
---|
| 207 | static void purple_remove_buddy( struct im_connection *ic, char *who, char *group ) |
---|
| 208 | { |
---|
| 209 | } |
---|
| 210 | |
---|
| 211 | static void purple_keepalive( struct im_connection *ic ) |
---|
| 212 | { |
---|
| 213 | } |
---|
| 214 | |
---|
| 215 | static int purple_send_typing( struct im_connection *ic, char *who, int typing ) |
---|
| 216 | { |
---|
[0cbef26] | 217 | return 1; |
---|
[796da03] | 218 | } |
---|
| 219 | |
---|
[860ba6a] | 220 | static void purple_ui_init(); |
---|
| 221 | |
---|
| 222 | static PurpleCoreUiOps bee_core_uiops = |
---|
| 223 | { |
---|
| 224 | NULL, |
---|
| 225 | NULL, |
---|
| 226 | purple_ui_init, |
---|
| 227 | NULL, |
---|
| 228 | }; |
---|
| 229 | |
---|
| 230 | static void prplcb_conn_progress( PurpleConnection *gc, const char *text, size_t step, size_t step_count ) |
---|
| 231 | { |
---|
[0cbef26] | 232 | struct im_connection *ic = purple_ic_by_gc( gc ); |
---|
| 233 | |
---|
| 234 | imcb_log( ic, "%s", text ); |
---|
[860ba6a] | 235 | } |
---|
| 236 | |
---|
| 237 | static void prplcb_conn_connected( PurpleConnection *gc ) |
---|
| 238 | { |
---|
[d250b2a] | 239 | struct im_connection *ic = purple_ic_by_gc( gc ); |
---|
| 240 | |
---|
| 241 | imcb_connected( ic ); |
---|
| 242 | |
---|
| 243 | if( gc->flags & PURPLE_CONNECTION_HTML ) |
---|
| 244 | ic->flags |= OPT_DOES_HTML; |
---|
[860ba6a] | 245 | } |
---|
| 246 | |
---|
| 247 | static void prplcb_conn_disconnected( PurpleConnection *gc ) |
---|
| 248 | { |
---|
[0cbef26] | 249 | struct im_connection *ic = purple_ic_by_gc( gc ); |
---|
| 250 | |
---|
| 251 | if( ic != NULL ) |
---|
[b74b287] | 252 | { |
---|
[0cbef26] | 253 | imc_logout( ic, TRUE ); |
---|
[b74b287] | 254 | } |
---|
[860ba6a] | 255 | } |
---|
| 256 | |
---|
| 257 | static void prplcb_conn_notice( PurpleConnection *gc, const char *text ) |
---|
| 258 | { |
---|
[0cbef26] | 259 | struct im_connection *ic = purple_ic_by_gc( gc ); |
---|
| 260 | |
---|
| 261 | if( ic != NULL ) |
---|
| 262 | imcb_log( ic, "%s", text ); |
---|
[860ba6a] | 263 | } |
---|
| 264 | |
---|
| 265 | static void prplcb_conn_report_disconnect_reason( PurpleConnection *gc, PurpleConnectionError reason, const char *text ) |
---|
| 266 | { |
---|
[0cbef26] | 267 | struct im_connection *ic = purple_ic_by_gc( gc ); |
---|
| 268 | |
---|
[860ba6a] | 269 | /* PURPLE_CONNECTION_ERROR_NAME_IN_USE means concurrent login, |
---|
| 270 | should probably handle that. */ |
---|
[0cbef26] | 271 | if( ic != NULL ) |
---|
| 272 | imcb_error( ic, "%s", text ); |
---|
[860ba6a] | 273 | } |
---|
| 274 | |
---|
| 275 | static PurpleConnectionUiOps bee_conn_uiops = |
---|
| 276 | { |
---|
| 277 | prplcb_conn_progress, |
---|
| 278 | prplcb_conn_connected, |
---|
| 279 | prplcb_conn_disconnected, |
---|
| 280 | prplcb_conn_notice, |
---|
| 281 | NULL, |
---|
| 282 | NULL, |
---|
| 283 | NULL, |
---|
| 284 | prplcb_conn_report_disconnect_reason, |
---|
| 285 | }; |
---|
| 286 | |
---|
[7da726b] | 287 | static void prplcb_blist_new( PurpleBlistNode *node ) |
---|
| 288 | { |
---|
| 289 | PurpleBuddy *bud = (PurpleBuddy*) node; |
---|
| 290 | |
---|
[db4cd40] | 291 | if( node->type == PURPLE_BLIST_BUDDY_NODE ) |
---|
[7da726b] | 292 | { |
---|
[db4cd40] | 293 | struct im_connection *ic = purple_ic_by_pa( bud->account ); |
---|
| 294 | |
---|
| 295 | if( ic == NULL ) |
---|
| 296 | return; |
---|
| 297 | |
---|
[7da726b] | 298 | imcb_add_buddy( ic, bud->name, NULL ); |
---|
| 299 | if( bud->server_alias ) |
---|
[4524f66] | 300 | { |
---|
| 301 | imcb_rename_buddy( ic, bud->name, bud->server_alias ); |
---|
[7da726b] | 302 | imcb_buddy_nick_hint( ic, bud->name, bud->server_alias ); |
---|
[4524f66] | 303 | } |
---|
[7da726b] | 304 | } |
---|
| 305 | } |
---|
| 306 | |
---|
| 307 | static void prplcb_blist_update( PurpleBuddyList *list, PurpleBlistNode *node ) |
---|
| 308 | { |
---|
| 309 | PurpleBuddy *bud = (PurpleBuddy*) node; |
---|
| 310 | |
---|
[db4cd40] | 311 | if( node->type == PURPLE_BLIST_BUDDY_NODE ) |
---|
[7da726b] | 312 | { |
---|
[db4cd40] | 313 | struct im_connection *ic = purple_ic_by_pa( bud->account ); |
---|
[4f103ea] | 314 | PurpleStatus *as; |
---|
| 315 | int flags = 0; |
---|
| 316 | |
---|
[db4cd40] | 317 | if( ic == NULL ) |
---|
| 318 | return; |
---|
| 319 | |
---|
[4524f66] | 320 | if( bud->server_alias ) |
---|
| 321 | imcb_rename_buddy( ic, bud->name, bud->server_alias ); |
---|
| 322 | |
---|
[4f103ea] | 323 | flags |= purple_presence_is_online( bud->presence ) ? OPT_LOGGED_IN : 0; |
---|
| 324 | flags |= purple_presence_is_available( bud->presence ) ? 0 : OPT_AWAY; |
---|
| 325 | |
---|
| 326 | as = purple_presence_get_active_status( bud->presence ); |
---|
| 327 | |
---|
| 328 | imcb_buddy_status( ic, bud->name, flags, purple_status_get_name( as ), |
---|
| 329 | purple_status_get_attr_string( as, "message" ) ); |
---|
[7da726b] | 330 | } |
---|
| 331 | } |
---|
| 332 | |
---|
| 333 | static void prplcb_blist_remove( PurpleBuddyList *list, PurpleBlistNode *node ) |
---|
| 334 | { |
---|
| 335 | PurpleBuddy *bud = (PurpleBuddy*) node; |
---|
| 336 | |
---|
[db4cd40] | 337 | if( node->type == PURPLE_BLIST_BUDDY_NODE ) |
---|
[0cbef26] | 338 | { |
---|
[db4cd40] | 339 | struct im_connection *ic = purple_ic_by_pa( bud->account ); |
---|
| 340 | |
---|
| 341 | if( ic == NULL ) |
---|
| 342 | return; |
---|
| 343 | |
---|
[0cbef26] | 344 | imcb_remove_buddy( ic, bud->name, NULL ); |
---|
| 345 | } |
---|
[7da726b] | 346 | } |
---|
| 347 | |
---|
| 348 | static PurpleBlistUiOps bee_blist_uiops = |
---|
| 349 | { |
---|
| 350 | NULL, |
---|
| 351 | prplcb_blist_new, |
---|
| 352 | NULL, |
---|
| 353 | prplcb_blist_update, |
---|
| 354 | prplcb_blist_remove, |
---|
| 355 | }; |
---|
| 356 | |
---|
[d250b2a] | 357 | static void prplcb_conv_im( PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime ) |
---|
| 358 | { |
---|
| 359 | struct im_connection *ic = purple_ic_by_pa( conv->account ); |
---|
| 360 | |
---|
[389f7be] | 361 | /* ..._SEND means it's an outgoing message, no need to echo those. */ |
---|
| 362 | if( !( flags & PURPLE_MESSAGE_SEND ) ) |
---|
| 363 | imcb_buddy_msg( ic, (char*) who, (char*) message, 0, mtime ); |
---|
[d250b2a] | 364 | } |
---|
| 365 | |
---|
[860ba6a] | 366 | static PurpleConversationUiOps bee_conv_uiops = |
---|
| 367 | { |
---|
| 368 | NULL, /* create_conversation */ |
---|
| 369 | NULL, /* destroy_conversation */ |
---|
| 370 | NULL, /* write_chat */ |
---|
[d250b2a] | 371 | prplcb_conv_im, /* write_im */ |
---|
[e046390] | 372 | NULL, /* write_conv */ |
---|
[860ba6a] | 373 | NULL, /* chat_add_users */ |
---|
| 374 | NULL, /* chat_rename_user */ |
---|
| 375 | NULL, /* chat_remove_users */ |
---|
| 376 | NULL, /* chat_update_user */ |
---|
| 377 | NULL, /* present */ |
---|
| 378 | NULL, /* has_focus */ |
---|
| 379 | NULL, /* custom_smiley_add */ |
---|
| 380 | NULL, /* custom_smiley_write */ |
---|
| 381 | NULL, /* custom_smiley_close */ |
---|
| 382 | NULL, /* send_confirm */ |
---|
| 383 | }; |
---|
| 384 | |
---|
[0cbef26] | 385 | static void prplcb_debug_print( PurpleDebugLevel level, const char *category, const char *arg_s ) |
---|
| 386 | { |
---|
| 387 | printf( "DEBUG %s: %s", category, arg_s ); |
---|
| 388 | } |
---|
| 389 | |
---|
| 390 | static PurpleDebugUiOps bee_debug_uiops = |
---|
| 391 | { |
---|
| 392 | prplcb_debug_print, |
---|
| 393 | }; |
---|
| 394 | |
---|
[4164e62] | 395 | static guint prplcb_ev_timeout_add( guint interval, GSourceFunc func, gpointer udata ) |
---|
| 396 | { |
---|
| 397 | return b_timeout_add( interval, (b_event_handler) func, udata ); |
---|
| 398 | } |
---|
| 399 | |
---|
| 400 | static guint prplcb_ev_input_add( int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer udata ) |
---|
| 401 | { |
---|
| 402 | return b_input_add( fd, cond | B_EV_FLAG_FORCE_REPEAT, (b_event_handler) func, udata ); |
---|
| 403 | } |
---|
| 404 | |
---|
| 405 | static gboolean prplcb_ev_remove( guint id ) |
---|
| 406 | { |
---|
| 407 | b_event_remove( (gint) id ); |
---|
| 408 | return TRUE; |
---|
| 409 | } |
---|
| 410 | |
---|
| 411 | static PurpleEventLoopUiOps glib_eventloops = |
---|
| 412 | { |
---|
| 413 | prplcb_ev_timeout_add, |
---|
| 414 | prplcb_ev_remove, |
---|
| 415 | prplcb_ev_input_add, |
---|
| 416 | prplcb_ev_remove, |
---|
| 417 | }; |
---|
| 418 | |
---|
[860ba6a] | 419 | static void purple_ui_init() |
---|
| 420 | { |
---|
[7da726b] | 421 | purple_blist_set_ui_ops( &bee_blist_uiops ); |
---|
[860ba6a] | 422 | purple_connections_set_ui_ops( &bee_conn_uiops ); |
---|
| 423 | purple_conversations_set_ui_ops( &bee_conv_uiops ); |
---|
[0cbef26] | 424 | //purple_debug_set_ui_ops( &bee_debug_uiops ); |
---|
[860ba6a] | 425 | } |
---|
| 426 | |
---|
[796da03] | 427 | void purple_initmodule() |
---|
| 428 | { |
---|
| 429 | GList *prots; |
---|
| 430 | |
---|
[e046390] | 431 | if( B_EV_IO_READ != PURPLE_INPUT_READ || |
---|
| 432 | B_EV_IO_WRITE != PURPLE_INPUT_WRITE ) |
---|
| 433 | { |
---|
| 434 | /* FIXME FIXME FIXME FIXME FIXME :-) */ |
---|
| 435 | exit( 1 ); |
---|
| 436 | } |
---|
| 437 | |
---|
[796da03] | 438 | purple_util_set_user_dir("/tmp"); |
---|
| 439 | purple_debug_set_enabled(FALSE); |
---|
| 440 | purple_core_set_ui_ops(&bee_core_uiops); |
---|
| 441 | purple_eventloop_set_ui_ops(&glib_eventloops); |
---|
| 442 | if( !purple_core_init( "BitlBee") ) |
---|
| 443 | { |
---|
| 444 | /* Initializing the core failed. Terminate. */ |
---|
| 445 | fprintf( stderr, "libpurple initialization failed.\n" ); |
---|
| 446 | abort(); |
---|
| 447 | } |
---|
| 448 | |
---|
| 449 | /* This seems like stateful shit we don't want... */ |
---|
| 450 | purple_set_blist(purple_blist_new()); |
---|
| 451 | purple_blist_load(); |
---|
| 452 | |
---|
| 453 | /* Meh? */ |
---|
| 454 | purple_prefs_load(); |
---|
| 455 | |
---|
| 456 | for( prots = purple_plugins_get_protocols(); prots; prots = prots->next ) |
---|
| 457 | { |
---|
| 458 | struct prpl *ret = g_new0( struct prpl, 1 ); |
---|
| 459 | PurplePlugin *prot = prots->data; |
---|
| 460 | |
---|
| 461 | ret->name = prot->info->id; |
---|
| 462 | ret->login = purple_login; |
---|
| 463 | ret->init = purple_init; |
---|
| 464 | ret->logout = purple_logout; |
---|
| 465 | ret->buddy_msg = purple_buddy_msg; |
---|
| 466 | ret->away_states = purple_away_states; |
---|
| 467 | ret->set_away = purple_set_away; |
---|
| 468 | ret->add_buddy = purple_add_buddy; |
---|
| 469 | ret->remove_buddy = purple_remove_buddy; |
---|
| 470 | ret->keepalive = purple_keepalive; |
---|
| 471 | ret->send_typing = purple_send_typing; |
---|
| 472 | ret->handle_cmp = g_strcasecmp; |
---|
| 473 | |
---|
| 474 | register_protocol( ret ); |
---|
| 475 | } |
---|
| 476 | } |
---|