Mercurial > pidgin.yaz
comparison src/multi.c @ 5205:fefad67de2c7
[gaim-migrate @ 5573]
I had a damn good commit message, but it was eaten. Let's try it again.
Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short.
There are lots'a cool thingies here.
Okay now, this isn't as cool as the previous message, but:
1) There's now a single entry function for all plugin types. It returns a
detailed information structure on the plugin. This removes a lot of the
ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so
if you use it, well, you shouldn't have used it anyway, but now you
can't! bwahahaha. Use AIM/ICQ.
2) There are now 3 types of plugins: Standard, Loader, and Protocol
plugins.
Standard plugins are, well, standard, compiled plugins.
Loader plugins load other plugins. For example, the perl support is now
a loader plugin. It loads perl scripts. In the future, we'll have
Ruby and Python loader plugins.
Protocol plugins are, well, protocol plugins... yeah...
3) Plugins have unique IDs, so they can be referred to or automatically
updated from a plugin database in the future. Neat, huh?
4) Plugins will have dependency support in the future, and can be hidden,
so if you have, say, a logging core plugin, it won't have to show up,
but then you load the GTK+ logging plugin and it'll auto-load the core
plugin. Core/UI split plugins!
5) There will eventually be custom plugin signals and RPC of some sort, for
the core/ui split plugins.
So, okay, back up .gaimrc.
I'd like to thank my parents for their support, javabsp for helping convert
a bunch of protocol plugins, and Etan for helping convert a bunch of
standard plugins.
Have fun. If you have any problems, please let me know, but you probably
won't have anything major happen. You will have to convert your plugins,
though, and I'm not guaranteeing that all perl scripts will still work.
I'll end up changing the perl script API eventually, so I know they won't
down the road. Don't worry, though. It'll be mass cool.
faceprint wants me to just commit the damn code already. So, here we go!!!
..
..
I need a massage. From a young, cute girl. Are there any young, cute girls
in the audience? IM me plz k thx.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 25 Apr 2003 06:47:33 +0000 |
parents | b37d7d09ec83 |
children | 0241d6b6702d |
comparison
equal
deleted
inserted
replaced
5204:44de70702205 | 5205:fefad67de2c7 |
---|---|
131 struct gaim_connection *new_gaim_conn(struct gaim_account *account) | 131 struct gaim_connection *new_gaim_conn(struct gaim_account *account) |
132 { | 132 { |
133 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); | 133 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); |
134 gc->edittype = EDIT_GC; | 134 gc->edittype = EDIT_GC; |
135 gc->protocol = account->protocol; | 135 gc->protocol = account->protocol; |
136 gc->prpl = find_prpl(account->protocol); | 136 gc->prpl = gaim_find_prpl(account->protocol); |
137 g_snprintf(gc->username, sizeof(gc->username), "%s", account->username); | 137 g_snprintf(gc->username, sizeof(gc->username), "%s", account->username); |
138 g_snprintf(gc->password, sizeof(gc->password), "%s", account->password); | 138 g_snprintf(gc->password, sizeof(gc->password), "%s", account->password); |
139 gc->keepalive = 0; | 139 gc->keepalive = 0; |
140 gc->inpa = 0; | 140 gc->inpa = 0; |
141 gc->buddy_chats = NULL; | 141 gc->buddy_chats = NULL; |
210 quit_acctedit(d); | 210 quit_acctedit(d); |
211 } | 211 } |
212 | 212 |
213 static char *proto_name(int proto) | 213 static char *proto_name(int proto) |
214 { | 214 { |
215 struct prpl *p = find_prpl(proto); | 215 GaimPlugin *p = gaim_find_prpl(proto); |
216 if (p && p->name) | 216 if (p && p->info->name) |
217 return p->name; | 217 return p->info->name; |
218 else | 218 else |
219 return "Unknown"; | 219 return "Unknown"; |
220 } | 220 } |
221 | 221 |
222 void regenerate_user_list() | 222 void regenerate_user_list() |
364 gtk_widget_show(button); | 364 gtk_widget_show(button); |
365 return button; | 365 return button; |
366 } | 366 } |
367 | 367 |
368 static void process_login_opts(struct mod_account *ma) { | 368 static void process_login_opts(struct mod_account *ma) { |
369 struct prpl *p = find_prpl(ma->protocol); | 369 GaimPlugin *p = gaim_find_prpl(ma->protocol); |
370 const char *entry_text; | 370 const char *entry_text; |
371 char *username = g_strdup(gtk_entry_get_text(GTK_ENTRY(ma->name))); | 371 char *username = g_strdup(gtk_entry_get_text(GTK_ENTRY(ma->name))); |
372 char *tmp; | 372 char *tmp; |
373 GList *entries = ma->user_split_entries; | 373 GList *entries = ma->user_split_entries; |
374 GList *user_splits = NULL; | 374 GList *user_splits = NULL; |
375 | |
375 if(p) | 376 if(p) |
376 user_splits = p->user_splits; | 377 user_splits = GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits; |
378 | |
377 while(user_splits) { | 379 while(user_splits) { |
378 GtkWidget *entry = entries->data; | 380 GtkWidget *entry = entries->data; |
379 struct proto_user_split *pus = user_splits->data; | 381 struct proto_user_split *pus = user_splits->data; |
380 char tmp_sep[2] = " "; | 382 char tmp_sep[2] = " "; |
381 entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); | 383 entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); |
402 static void ok_mod(GtkWidget *w, struct mod_account *ma) | 404 static void ok_mod(GtkWidget *w, struct mod_account *ma) |
403 { | 405 { |
404 GList *tmp; | 406 GList *tmp; |
405 const char *txt; | 407 const char *txt; |
406 struct gaim_account *a; | 408 struct gaim_account *a; |
407 struct prpl *p = find_prpl(ma->protocol); | 409 GaimPlugin *p = gaim_find_prpl(ma->protocol); |
410 GaimPluginProtocolInfo *prpl_info = NULL; | |
408 GtkTreeIter iter; | 411 GtkTreeIter iter; |
409 int proxytype; | 412 int proxytype; |
410 | 413 |
411 if (!ma->account) { | 414 if (!ma->account) { |
412 txt = gtk_entry_get_text(GTK_ENTRY(ma->name)); | 415 txt = gtk_entry_get_text(GTK_ENTRY(ma->name)); |
476 g_snprintf(gpi->proxypass, sizeof(gpi->proxypass), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxypass_entry))); | 479 g_snprintf(gpi->proxypass, sizeof(gpi->proxypass), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxypass_entry))); |
477 | 480 |
478 ma->account->gpi = gpi; | 481 ma->account->gpi = gpi; |
479 } | 482 } |
480 | 483 |
484 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p); | |
485 | |
481 /* | 486 /* |
482 * See if user registration is supported/required | 487 * See if user registration is supported/required |
483 */ | 488 */ |
484 if(!p) { | 489 if (!p) { |
485 /* TBD: error dialog here! (This should never happen, you know...) */ | 490 /* TBD: error dialog here! (This should never happen, you know...) */ |
486 fprintf(stderr, "dbg: couldn't find protocol for protocol number %d!\n", ma->protocol); | 491 fprintf(stderr, "dbg: couldn't find protocol for protocol number %d!\n", ma->protocol); |
487 fflush(stderr); | 492 fflush(stderr); |
488 } else { | 493 } else { |
489 if(p->register_user != NULL && | 494 if (prpl_info->register_user != NULL && |
490 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ma->register_user)) == TRUE) { | 495 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ma->register_user)) == TRUE) { |
491 ref_protocol(p); | 496 prpl_info->register_user(a); |
492 p->register_user(a); | |
493 /* we don't unref the protocol because register user has callbacks | |
494 * that need to get called first, then they will unref the protocol | |
495 * appropriately */ | |
496 } | 497 } |
497 } | 498 } |
498 | 499 |
499 save_prefs(); | 500 save_prefs(); |
500 | 501 |
517 static void generate_protocol_options(struct mod_account *ma, GtkWidget *box); | 518 static void generate_protocol_options(struct mod_account *ma, GtkWidget *box); |
518 | 519 |
519 static void set_prot(GtkWidget *opt, int proto) | 520 static void set_prot(GtkWidget *opt, int proto) |
520 { | 521 { |
521 struct mod_account *ma = g_object_get_data(G_OBJECT(opt), "mod_account"); | 522 struct mod_account *ma = g_object_get_data(G_OBJECT(opt), "mod_account"); |
522 struct prpl *p; | 523 GaimPlugin *p; |
523 if (ma->protocol != proto) { | 524 if (ma->protocol != proto) { |
524 int i; | 525 int i; |
525 | 526 |
526 for (i = 0; i < 7; i++) | 527 for (i = 0; i < 7; i++) |
527 ma->proto_opt[i][0] = '\0'; | 528 ma->proto_opt[i][0] = '\0'; |
528 p = find_prpl(ma->protocol); | 529 p = gaim_find_prpl(ma->protocol); |
529 | 530 |
530 process_login_opts(ma); | 531 process_login_opts(ma); |
531 | 532 |
532 ma->protocol = proto; | 533 ma->protocol = proto; |
533 | 534 |
541 } | 542 } |
542 } | 543 } |
543 | 544 |
544 static GtkWidget *make_protocol_menu(GtkWidget *box, struct mod_account *ma) | 545 static GtkWidget *make_protocol_menu(GtkWidget *box, struct mod_account *ma) |
545 { | 546 { |
547 GaimPluginProtocolInfo *prpl_info = NULL; | |
546 GtkWidget *optmenu; | 548 GtkWidget *optmenu; |
547 GtkWidget *menu; | 549 GtkWidget *menu; |
548 GtkWidget *opt; | 550 GtkWidget *opt; |
549 GSList *p = protocols; | 551 GSList *p; |
550 struct prpl *e; | 552 GaimPlugin *e; |
551 int count = 0; | 553 int count = 0; |
552 gboolean found = FALSE; | 554 gboolean found = FALSE; |
553 | 555 |
554 optmenu = gtk_option_menu_new(); | 556 optmenu = gtk_option_menu_new(); |
555 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); | 557 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); |
556 gtk_widget_show(optmenu); | 558 gtk_widget_show(optmenu); |
557 | 559 |
558 menu = gtk_menu_new(); | 560 menu = gtk_menu_new(); |
559 | 561 |
560 while (p) { | 562 for (p = protocols; p != NULL; p = p->next) { |
561 e = (struct prpl *)p->data; | 563 e = (GaimPlugin *)p->data; |
562 if (e->protocol == ma->protocol) | 564 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(e); |
565 | |
566 if (prpl_info->protocol == ma->protocol) | |
563 found = TRUE; | 567 found = TRUE; |
564 if (!found) | 568 if (!found) |
565 count++; | 569 count++; |
566 if (e->name) | 570 if (e->info->name) |
567 opt = gtk_menu_item_new_with_label(e->name); | 571 opt = gtk_menu_item_new_with_label(e->info->name); |
568 else | 572 else |
569 opt = gtk_menu_item_new_with_label("Unknown"); | 573 opt = gtk_menu_item_new_with_label("Unknown"); |
570 g_object_set_data(G_OBJECT(opt), "mod_account", ma); | 574 g_object_set_data(G_OBJECT(opt), "mod_account", ma); |
571 g_signal_connect(GTK_OBJECT(opt), "activate", | 575 g_signal_connect(GTK_OBJECT(opt), "activate", |
572 G_CALLBACK(set_prot), (void *)e->protocol); | 576 G_CALLBACK(set_prot), (void *)prpl_info->protocol); |
573 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | 577 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
574 gtk_widget_show(opt); | 578 gtk_widget_show(opt); |
575 p = p->next; | |
576 } | 579 } |
577 | 580 |
578 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | 581 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
579 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count); | 582 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count); |
580 | 583 |
691 GtkWidget *hbox; | 694 GtkWidget *hbox; |
692 GtkWidget *label; | 695 GtkWidget *label; |
693 GList *user_splits = NULL; | 696 GList *user_splits = NULL; |
694 GList *split_entries; | 697 GList *split_entries; |
695 | 698 |
696 struct prpl *p; | 699 GaimPlugin *p; |
697 | 700 |
698 char *username = NULL; | 701 char *username = NULL; |
699 char *start; | 702 char *start; |
700 | 703 |
701 if(ma->login_frame) | 704 if(ma->login_frame) |
722 make_protocol_menu(hbox, ma); | 725 make_protocol_menu(hbox, ma); |
723 | 726 |
724 hbox = gtk_hbox_new(FALSE, 5); | 727 hbox = gtk_hbox_new(FALSE, 5); |
725 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 728 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
726 | 729 |
727 p = find_prpl(ma->protocol); | 730 p = gaim_find_prpl(ma->protocol); |
731 | |
728 if(p) | 732 if(p) |
729 user_splits = p->user_splits; | 733 user_splits = GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits; |
730 | 734 |
731 label = gtk_label_new(_("Screenname:")); | 735 label = gtk_label_new(_("Screenname:")); |
732 gtk_size_group_add_widget(ma->sg, label); | 736 gtk_size_group_add_widget(ma->sg, label); |
733 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 737 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
734 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 738 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
786 ma->rempass = acct_button(_("Remember Password"), ma, OPT_ACCT_REM_PASS, vbox); | 790 ma->rempass = acct_button(_("Remember Password"), ma, OPT_ACCT_REM_PASS, vbox); |
787 acct_button(_("Auto-Login"), ma, OPT_ACCT_AUTO, vbox); | 791 acct_button(_("Auto-Login"), ma, OPT_ACCT_AUTO, vbox); |
788 | 792 |
789 gtk_widget_show_all(ma->login_frame); | 793 gtk_widget_show_all(ma->login_frame); |
790 | 794 |
791 if(p) | 795 if (p) |
792 user_splits = g_list_last(p->user_splits); | 796 user_splits = g_list_last(GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits); |
793 | 797 |
794 username = g_strdup(ma->username); | 798 username = g_strdup(ma->username); |
795 split_entries = g_list_last(ma->user_split_entries); | 799 split_entries = g_list_last(ma->user_split_entries); |
796 | 800 |
797 while(user_splits) { | 801 while(user_splits) { |
812 gtk_entry_set_text(GTK_ENTRY(ma->name), username); | 816 gtk_entry_set_text(GTK_ENTRY(ma->name), username); |
813 gtk_entry_set_text(GTK_ENTRY(ma->alias), ma->show); | 817 gtk_entry_set_text(GTK_ENTRY(ma->alias), ma->show); |
814 gtk_entry_set_text(GTK_ENTRY(ma->pass), ma->password); | 818 gtk_entry_set_text(GTK_ENTRY(ma->pass), ma->password); |
815 g_free(username); | 819 g_free(username); |
816 | 820 |
817 if (p && (p->options & OPT_PROTO_NO_PASSWORD)) { | 821 if (p && (GAIM_PLUGIN_PROTOCOL_INFO(p)->options & OPT_PROTO_NO_PASSWORD)) { |
818 gtk_widget_hide(ma->pwdbox); | 822 gtk_widget_hide(ma->pwdbox); |
819 gtk_widget_hide(ma->rempass); | 823 gtk_widget_hide(ma->rempass); |
820 } | 824 } |
821 } | 825 } |
822 | 826 |
831 * tired and I don't care. */ | 835 * tired and I don't care. */ |
832 /* Sean was right. I did do that. I told him I would. */ | 836 /* Sean was right. I did do that. I told him I would. */ |
833 | 837 |
834 GtkWidget *vbox; | 838 GtkWidget *vbox; |
835 GtkWidget *frame; | 839 GtkWidget *frame; |
836 | 840 GaimPluginProtocolInfo *prpl_info = NULL; |
837 struct prpl *p = find_prpl(ma->protocol); | 841 |
842 GaimPlugin *p = gaim_find_prpl(ma->protocol); | |
838 | 843 |
839 if(ma->user_frame) | 844 if(ma->user_frame) |
840 gtk_widget_destroy(ma->user_frame); | 845 gtk_widget_destroy(ma->user_frame); |
841 ma->user_frame = NULL; | 846 ma->user_frame = NULL; |
842 | 847 |
856 if (!p) { | 861 if (!p) { |
857 gtk_widget_hide(ma->user_frame); | 862 gtk_widget_hide(ma->user_frame); |
858 return; | 863 return; |
859 } | 864 } |
860 | 865 |
861 if (!(p->options & OPT_PROTO_MAIL_CHECK)) | 866 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p); |
867 | |
868 if (!(prpl_info->options & OPT_PROTO_MAIL_CHECK)) | |
862 gtk_widget_hide(ma->checkmail); | 869 gtk_widget_hide(ma->checkmail); |
863 if (!(p->options & OPT_PROTO_BUDDY_ICON)) | 870 if (!(prpl_info->options & OPT_PROTO_BUDDY_ICON)) |
864 gtk_widget_hide(ma->iconsel); | 871 gtk_widget_hide(ma->iconsel); |
865 | 872 |
866 if ((p->options & OPT_PROTO_BUDDY_ICON) || (p->options & OPT_PROTO_MAIL_CHECK)) | 873 if ((prpl_info->options & OPT_PROTO_BUDDY_ICON) || |
874 (prpl_info->options & OPT_PROTO_MAIL_CHECK)) { | |
875 | |
867 return; | 876 return; |
877 } | |
878 | |
868 gtk_widget_hide(ma->user_frame); | 879 gtk_widget_hide(ma->user_frame); |
869 } | 880 } |
870 | 881 |
871 static void generate_protocol_options(struct mod_account *ma, GtkWidget *box) | 882 static void generate_protocol_options(struct mod_account *ma, GtkWidget *box) |
872 { | 883 { |
873 struct prpl *p = find_prpl(ma->protocol); | 884 GaimPlugin *p = gaim_find_prpl(ma->protocol); |
885 GaimPluginProtocolInfo *prpl_info = NULL; | |
874 | 886 |
875 GList *op, *tmp; | 887 GList *op, *tmp; |
876 | 888 |
877 GtkWidget *vbox; | 889 GtkWidget *vbox; |
878 GtkWidget *hbox; | 890 GtkWidget *hbox; |
892 } | 904 } |
893 | 905 |
894 if (!p) | 906 if (!p) |
895 return; | 907 return; |
896 | 908 |
897 if (!p->user_opts) | 909 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p); |
910 | |
911 if (!prpl_info->user_opts) | |
898 return; | 912 return; |
899 | 913 |
900 tmp = op = p->user_opts; | 914 tmp = op = prpl_info->user_opts; |
901 | 915 |
902 if (!op) | 916 if (!op) |
903 return; | 917 return; |
904 | 918 |
905 g_snprintf(buf, sizeof(buf), _("%s Options"), p->name); | 919 g_snprintf(buf, sizeof(buf), _("%s Options"), p->info->name); |
906 frame = make_frame(box, buf); | 920 frame = make_frame(box, buf); |
907 | 921 |
908 /* BLEH */ | 922 /* BLEH */ |
909 ma->proto_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); | 923 ma->proto_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
910 gtk_box_reorder_child(GTK_BOX(box), ma->proto_frame, 0); | 924 gtk_box_reorder_child(GTK_BOX(box), ma->proto_frame, 0); |
942 ma->opt_entries = g_list_append(ma->opt_entries, entry); | 956 ma->opt_entries = g_list_append(ma->opt_entries, entry); |
943 | 957 |
944 op = op->next; | 958 op = op->next; |
945 } | 959 } |
946 | 960 |
947 if(p->register_user != NULL) { | 961 if(prpl_info->register_user != NULL) { |
948 ma->register_user = gtk_check_button_new_with_label(_("Register with server")); | 962 ma->register_user = gtk_check_button_new_with_label(_("Register with server")); |
949 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ma->register_user), FALSE); | 963 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ma->register_user), FALSE); |
950 gtk_box_pack_start(GTK_BOX(vbox), ma->register_user, FALSE, FALSE, 0); | 964 gtk_box_pack_start(GTK_BOX(vbox), ma->register_user, FALSE, FALSE, 0); |
951 gtk_widget_show(ma->register_user); | 965 gtk_widget_show(ma->register_user); |
952 } | 966 } |
1152 mod_accounts = g_slist_append(mod_accounts, ma); | 1166 mod_accounts = g_slist_append(mod_accounts, ma); |
1153 | 1167 |
1154 if (a) { | 1168 if (a) { |
1155 int i; | 1169 int i; |
1156 ma->options = a->options; | 1170 ma->options = a->options; |
1157 if (find_prpl(a->protocol)) | 1171 if (gaim_find_prpl(a->protocol)) |
1158 ma->protocol = a->protocol; | 1172 ma->protocol = a->protocol; |
1159 else if (protocols) | 1173 else if (protocols) |
1160 ma->protocol = ((struct prpl *)protocols->data)->protocol; | 1174 ma->protocol = GAIM_PLUGIN_PROTOCOL_INFO( |
1175 ((GaimPlugin *)protocols->data))->protocol; | |
1161 else | 1176 else |
1162 ma->protocol = -1; | 1177 ma->protocol = -1; |
1163 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", a->iconfile); | 1178 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", a->iconfile); |
1164 g_snprintf(ma->username, sizeof(ma->username), "%s", a->username); | 1179 g_snprintf(ma->username, sizeof(ma->username), "%s", a->username); |
1165 g_snprintf(ma->show, sizeof(ma->show), "%s", a->alias); | 1180 g_snprintf(ma->show, sizeof(ma->show), "%s", a->alias); |
1168 for (i = 0; i < 7; i++) | 1183 for (i = 0; i < 7; i++) |
1169 g_snprintf(ma->proto_opt[i], sizeof(ma->proto_opt[i]), "%s", | 1184 g_snprintf(ma->proto_opt[i], sizeof(ma->proto_opt[i]), "%s", |
1170 a->proto_opt[i]); | 1185 a->proto_opt[i]); |
1171 } else { | 1186 } else { |
1172 ma->options = OPT_ACCT_REM_PASS; | 1187 ma->options = OPT_ACCT_REM_PASS; |
1173 if (find_prpl(DEFAULT_PROTO)) | 1188 if (gaim_find_prpl(GAIM_PROTO_DEFAULT)) |
1174 ma->protocol = DEFAULT_PROTO; | 1189 ma->protocol = GAIM_PROTO_DEFAULT; |
1175 else if (protocols) | 1190 else if (protocols) |
1176 ma->protocol = ((struct prpl *)protocols->data)->protocol; | 1191 ma->protocol = GAIM_PLUGIN_PROTOCOL_INFO( |
1192 ((GaimPlugin *)protocols->data))->protocol; | |
1177 else | 1193 else |
1178 ma->protocol = -1; | 1194 ma->protocol = -1; |
1179 } | 1195 } |
1180 } else { | 1196 } else { |
1181 gtk_widget_show(ma->mod); | 1197 gtk_widget_show(ma->mod); |
1359 { | 1375 { |
1360 GtkTreeModel *model = (GtkTreeModel *)d; | 1376 GtkTreeModel *model = (GtkTreeModel *)d; |
1361 GtkTreeIter iter; | 1377 GtkTreeIter iter; |
1362 | 1378 |
1363 struct gaim_account *account = NULL; | 1379 struct gaim_account *account = NULL; |
1364 struct prpl *p = NULL; | 1380 GaimPlugin *p = NULL; |
1381 GaimPluginProtocolInfo *prpl_info = NULL; | |
1365 | 1382 |
1366 gtk_tree_model_get_iter_from_string(model, &iter, path_str); | 1383 gtk_tree_model_get_iter_from_string(model, &iter, path_str); |
1367 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1); | 1384 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1); |
1368 | 1385 |
1369 p = find_prpl(account->protocol); | 1386 p = gaim_find_prpl(account->protocol); |
1370 if (!account->gc && p && p->login) { | 1387 |
1371 struct prpl *p = find_prpl(account->protocol); | 1388 if (p != NULL) |
1372 if (p && !(p->options & OPT_PROTO_NO_PASSWORD) && | 1389 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p); |
1373 !(p->options & OPT_PROTO_PASSWORD_OPTIONAL) && !account->password[0]) { | 1390 |
1391 if (!account->gc && p && prpl_info->login) { | |
1392 GaimPlugin *p = gaim_find_prpl(account->protocol); | |
1393 | |
1394 if (p != NULL) | |
1395 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p); | |
1396 | |
1397 if (p && !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && | |
1398 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) && | |
1399 !account->password[0]) { | |
1400 | |
1374 do_pass_dlg(account); | 1401 do_pass_dlg(account); |
1375 } else { | 1402 } |
1403 else { | |
1376 serv_login(account); | 1404 serv_login(account); |
1377 } | 1405 } |
1378 } else if (account->gc) { | 1406 } else if (account->gc) { |
1379 account->gc->wants_to_die = TRUE; | 1407 account->gc->wants_to_die = TRUE; |
1380 signoff(account->gc); | 1408 signoff(account->gc); |
1381 } else { | 1409 } else { |
1382 if (account->protocol == PROTO_TOC) | 1410 if (account->protocol == GAIM_PROTO_TOC) |
1383 do_error_dialog(_("TOC not found."), | 1411 do_error_dialog(_("TOC not found."), |
1384 _("You have attempted to login an IM account using the " | 1412 _("You have attempted to login an IM account using the " |
1385 "TOC protocol. Because this protocol is inferior to " | 1413 "TOC protocol. Because this protocol is inferior to " |
1386 "OSCAR, it is now compiled as a plugin by default. " | 1414 "OSCAR, it is now compiled as a plugin by default. " |
1387 "To login, edit this account to use OSCAR or load the " | 1415 "To login, edit this account to use OSCAR or load the " |
1691 | 1719 |
1692 gc->account->connecting = FALSE; | 1720 gc->account->connecting = FALSE; |
1693 connecting_count--; | 1721 connecting_count--; |
1694 debug_printf("connecting_count: %d\n", connecting_count); | 1722 debug_printf("connecting_count: %d\n", connecting_count); |
1695 | 1723 |
1696 plugin_event(event_signon, gc); | 1724 gaim_event_broadcast(event_signon, gc); |
1697 system_log(log_signon, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); | 1725 system_log(log_signon, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); |
1698 | 1726 |
1699 /* away option given? */ | 1727 /* away option given? */ |
1700 if (opt_away) { | 1728 if (opt_away) { |
1701 away_on_login(opt_away_arg); | 1729 away_on_login(opt_away_arg); |
1735 return; | 1763 return; |
1736 | 1764 |
1737 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) { | 1765 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) { |
1738 gtk_list_store_set(model, &iter, | 1766 gtk_list_store_set(model, &iter, |
1739 COLUMN_ONLINE, TRUE, | 1767 COLUMN_ONLINE, TRUE, |
1740 COLUMN_PROTOCOL, gc->prpl->name, | 1768 COLUMN_PROTOCOL, gc->prpl->info->name, |
1741 -1); | 1769 -1); |
1742 } | 1770 } |
1743 | 1771 |
1744 /* Update the conversation windows that use this account. */ | 1772 /* Update the conversation windows that use this account. */ |
1745 for (l = gaim_get_conversations(); l != NULL; l = l->next) { | 1773 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
1978 | 2006 |
1979 void hide_login_progress(struct gaim_connection *gc, char *why) | 2007 void hide_login_progress(struct gaim_connection *gc, char *why) |
1980 { | 2008 { |
1981 gchar *buf; | 2009 gchar *buf; |
1982 | 2010 |
1983 plugin_event(event_error, gc, why); | 2011 gaim_event_broadcast(event_error, gc, why); |
1984 buf = g_strdup_printf(_("%s was unable to sign on"), gc->username); | 2012 buf = g_strdup_printf(_("%s was unable to sign on"), gc->username); |
1985 hide_login_progress_common(gc, why, _("Signon Error"), buf); | 2013 hide_login_progress_common(gc, why, _("Signon Error"), buf); |
1986 g_free(buf); | 2014 g_free(buf); |
1987 } | 2015 } |
1988 | 2016 |
2002 */ | 2030 */ |
2003 void hide_login_progress_error(struct gaim_connection *gc, char *why) | 2031 void hide_login_progress_error(struct gaim_connection *gc, char *why) |
2004 { | 2032 { |
2005 char buf[2048]; | 2033 char buf[2048]; |
2006 | 2034 |
2007 plugin_event(event_error, gc, why); | 2035 gaim_event_broadcast(event_error, gc, why); |
2008 g_snprintf(buf, sizeof(buf), _("%s has been signed off"), gc->username); | 2036 g_snprintf(buf, sizeof(buf), _("%s has been signed off"), gc->username); |
2009 hide_login_progress_common(gc, why, _("Connection Error"), buf); | 2037 hide_login_progress_common(gc, why, _("Connection Error"), buf); |
2010 } | 2038 } |
2011 | 2039 |
2012 void signoff_all() | 2040 void signoff_all() |
2024 | 2052 |
2025 void signoff(struct gaim_connection *gc) | 2053 void signoff(struct gaim_connection *gc) |
2026 { | 2054 { |
2027 GList *wins; | 2055 GList *wins; |
2028 | 2056 |
2029 /* UI stuff */ | |
2030 /* CONV XXX | |
2031 convo_menu_remove(gc); | |
2032 remove_icon_data(gc); | |
2033 */ | |
2034 | |
2035 gaim_blist_remove_account(gc->account); | 2057 gaim_blist_remove_account(gc->account); |
2036 | 2058 |
2037 /* core stuff */ | 2059 /* core stuff */ |
2038 /* remove this here so plugins get a sensible count of connections */ | 2060 /* remove this here so plugins get a sensible count of connections */ |
2039 connections = g_slist_remove(connections, gc); | 2061 connections = g_slist_remove(connections, gc); |
2040 debug_printf("date: %s\n", full_date()); | 2062 debug_printf("date: %s\n", full_date()); |
2041 plugin_event(event_signoff, gc); | 2063 gaim_event_broadcast(event_signoff, gc); |
2042 system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); | 2064 system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); |
2043 /* set this in case the plugin died before really connecting. | 2065 /* set this in case the plugin died before really connecting. |
2044 do it after calling the plugins so they can determine if | 2066 do it after calling the plugins so they can determine if |
2045 this user was ever on-line or not */ | 2067 this user was ever on-line or not */ |
2046 if (gc->account->connecting) { | 2068 if (gc->account->connecting) { |