comparison src/protocols/icq/gaim_icq.c @ 3572:bdd0bebd2d04

[gaim-migrate @ 3670] Phase II. No longer do you have to worry about protocol plugins. When Gaim probes plugins on load, it will detect protocol plugins and add them to the list of available protocols. When you try to log an account on with one of them, Gaim will automatically load the plugin--when no more accounts need the protocol--Gaim will automatically unload it. Protocol plugins are no longer available in the plugins ui, and no protocols are compiled statically by default. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 30 Sep 2002 01:05:18 +0000
parents 7a3f16a375a5
children 8b3491f1ca56
comparison
equal deleted inserted replaced
3571:a88c62c5b7da 3572:bdd0bebd2d04
20 int cur_status; 20 int cur_status;
21 gboolean connected; 21 gboolean connected;
22 }; 22 };
23 23
24 static guint ack_timer = 0; 24 static guint ack_timer = 0;
25
26 static char *icq_name() {
27 return "ICQ";
28 }
29 25
30 static void icq_do_log(icq_Link *link, time_t time, unsigned char level, const char *log) { 26 static void icq_do_log(icq_Link *link, time_t time, unsigned char level, const char *log) {
31 debug_printf("ICQ debug %d: %s", level, log); 27 debug_printf("ICQ debug %d: %s", level, log);
32 } 28 }
33 29
472 m = g_list_append(m, pbm); 468 m = g_list_append(m, pbm);
473 469
474 return m; 470 return m;
475 } 471 }
476 472
477 static GList *icq_user_opts() {
478 GList *m = NULL;
479 struct proto_user_opt *puo;
480
481 puo = g_new0(struct proto_user_opt, 1);
482 puo->label = "Nick:";
483 puo->def = "Gaim User";
484 puo->pos = USEROPT_NICK;
485 m = g_list_append(m, puo);
486
487 return m;
488 }
489
490 static GList *icq_away_states(struct gaim_connection *gc) { 473 static GList *icq_away_states(struct gaim_connection *gc) {
491 GList *m = NULL; 474 GList *m = NULL;
492 475
493 m = g_list_append(m, "Online"); 476 m = g_list_append(m, "Online");
494 m = g_list_append(m, "Away"); 477 m = g_list_append(m, "Away");
502 } 485 }
503 486
504 static struct prpl *my_protocol = NULL; 487 static struct prpl *my_protocol = NULL;
505 488
506 void icq_init(struct prpl *ret) { 489 void icq_init(struct prpl *ret) {
490 struct proto_user_opt *puo;
507 ret->protocol = PROTO_ICQ; 491 ret->protocol = PROTO_ICQ;
508 ret->name = icq_name; 492 ret->name = g_strdup("ICQ");
509 ret->list_icon = icq_list_icon; 493 ret->list_icon = icq_list_icon;
510 ret->away_states = icq_away_states; 494 ret->away_states = icq_away_states;
511 ret->buddy_menu = icq_buddy_menu; 495 ret->buddy_menu = icq_buddy_menu;
512 ret->user_opts = icq_user_opts;
513 ret->login = icq_login; 496 ret->login = icq_login;
514 ret->close = icq_close; 497 ret->close = icq_close;
515 ret->send_im = icq_send_msg; 498 ret->send_im = icq_send_msg;
516 ret->add_buddy = icq_add_buddy; 499 ret->add_buddy = icq_add_buddy;
517 ret->add_buddies = icq_add_buddies; 500 ret->add_buddies = icq_add_buddies;
518 ret->remove_buddy = icq_rem_buddy; 501 ret->remove_buddy = icq_rem_buddy;
519 ret->get_info = icq_get_info; 502 ret->get_info = icq_get_info;
520 ret->set_away = icq_set_away; 503 ret->set_away = icq_set_away;
521 ret->keepalive = icq_keepalive; 504 ret->keepalive = icq_keepalive;
522 505
506 puo = g_new0(struct proto_user_opt, 1);
507 puo->label = g_strdup("Nick:");
508 puo->def = g_strdup("Gaim User");
509 puo->pos = USEROPT_NICK;
510 ret->user_opts = g_list_append(ret->user_opts, puo);
511
523 my_protocol = ret; 512 my_protocol = ret;
524 513
525 icq_SocketNotify = icq_sock_notify; 514 icq_SocketNotify = icq_sock_notify;
526 icq_SetTimeout = icq_set_timeout; 515 icq_SetTimeout = icq_set_timeout;
527 } 516 }
528 517
529 #ifndef STATIC 518 #ifndef STATIC
530 519
531 char *gaim_plugin_init(GModule *handle) 520 void *gaim_prpl_init(struct prpl *prpl)
532 { 521 {
533 load_protocol(icq_init, sizeof(struct prpl)); 522 icq_init(prpl);
534 return NULL; 523 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
535 } 524 }
536
537 void gaim_plugin_remove()
538 {
539 struct prpl *p = find_prpl(PROTO_ICQ);
540 if (p == my_protocol)
541 unload_protocol(p);
542 }
543
544 char *name()
545 {
546 return "ICQ";
547 }
548
549 char *description()
550 {
551 return PRPL_DESC("ICQ");
552 }
553
554 #endif 525 #endif