Mercurial > pidgin
comparison src/server.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 | b791019b2492 |
children | 81d514f109de |
comparison
equal
deleted
inserted
replaced
3571:a88c62c5b7da | 3572:bdd0bebd2d04 |
---|---|
45 struct prpl *p = find_prpl(user->protocol); | 45 struct prpl *p = find_prpl(user->protocol); |
46 | 46 |
47 if (user->gc != NULL) | 47 if (user->gc != NULL) |
48 return; | 48 return; |
49 | 49 |
50 #ifdef GAIM_PLUGINS | |
51 if (p->plug) { /* This protocol is a plugin */ | |
52 prpl_accounts[p->protocol]++; | |
53 debug_printf("Protocol %s is now being used by %d connections.\n", p->name, prpl_accounts[p->protocol]); | |
54 if (!p->plug->handle) { /* But the protocol isn't yet loaded. */ | |
55 unload_protocol(p); /* Unload it to free the old name and options */ | |
56 if (load_prpl(p)) /* And load the plugin */ | |
57 return; | |
58 } | |
59 } | |
60 #endif | |
61 | |
50 if (p && p->login) { | 62 if (p && p->login) { |
51 if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD)) { | 63 if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD)) { |
52 do_error_dialog(_("Please enter your password"), NULL, GAIM_ERROR); | 64 do_error_dialog(_("Please enter your password"), NULL, GAIM_ERROR); |
53 return; | 65 return; |
54 } | 66 } |
55 | 67 |
56 debug_printf(PACKAGE " " VERSION " logging in %s using %s\n", user->username, p->name()); | 68 debug_printf(PACKAGE " " VERSION " logging in %s using %s\n", user->username, p->name); |
57 user->connecting = TRUE; | 69 user->connecting = TRUE; |
58 connecting_count++; | 70 connecting_count++; |
59 debug_printf("connecting_count: %d\n", connecting_count); | 71 debug_printf("connecting_count: %d\n", connecting_count); |
60 plugin_event(event_connecting, user); | 72 plugin_event(event_connecting, user); |
61 p->login(user); | 73 p->login(user); |
82 } | 94 } |
83 } | 95 } |
84 | 96 |
85 void serv_close(struct gaim_connection *gc) | 97 void serv_close(struct gaim_connection *gc) |
86 { | 98 { |
99 struct prpl *prpl; | |
87 while (gc->buddy_chats) { | 100 while (gc->buddy_chats) { |
88 struct conversation *b = gc->buddy_chats->data; | 101 struct conversation *b = gc->buddy_chats->data; |
89 gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); | 102 gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); |
90 b->gc = NULL; | 103 b->gc = NULL; |
91 update_buttons_by_protocol(b); | 104 update_buttons_by_protocol(b); |
97 | 110 |
98 update_keepalive(gc, FALSE); | 111 update_keepalive(gc, FALSE); |
99 | 112 |
100 if (gc->prpl && gc->prpl->close) | 113 if (gc->prpl && gc->prpl->close) |
101 gc->prpl->close(gc); | 114 gc->prpl->close(gc); |
102 | 115 |
116 prpl = gc->prpl; | |
103 account_offline(gc); | 117 account_offline(gc); |
104 destroy_gaim_conn(gc); | 118 destroy_gaim_conn(gc); |
119 | |
120 #ifdef GAIM_PLUGINS | |
121 if (prpl->plug) { /* This is a plugin */ | |
122 prpl_accounts[prpl->protocol]--; | |
123 debug_printf("Prpl %s is now being used by %d accounts\n", prpl->name, prpl_accounts[prpl->protocol]); | |
124 if (prpl_accounts[prpl->protocol] == 0) { /* We don't need this protocol anymore */ | |
125 debug_printf("Throwing out prpl %s\n", prpl->name); | |
126 g_module_close(prpl->plug->handle); | |
127 prpl->plug->handle = NULL; | |
128 } | |
129 } | |
130 #endif | |
131 | |
105 } | 132 } |
106 | 133 |
107 void serv_touch_idle(struct gaim_connection *gc) | 134 void serv_touch_idle(struct gaim_connection *gc) |
108 { | 135 { |
109 /* Are we idle? If so, not anymore */ | 136 /* Are we idle? If so, not anymore */ |