comparison src/server.c @ 4040:89b56ab2b692

[gaim-migrate @ 4248] faceprint got jabber registration working again :-) committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 03 Dec 2002 17:50:43 +0000
parents f118d61fb89a
children 226f6871643c
comparison
equal deleted inserted replaced
4039:630826d97d54 4040:89b56ab2b692
41 #include "pixmaps/tb_search.xpm" 41 #include "pixmaps/tb_search.xpm"
42 42
43 void serv_login(struct aim_user *user) 43 void serv_login(struct aim_user *user)
44 { 44 {
45 struct prpl *p = find_prpl(user->protocol); 45 struct prpl *p = find_prpl(user->protocol);
46 46
47 if (user->gc != NULL || p == NULL) 47 if (user->gc != NULL || p == NULL)
48 return; 48 return;
49 49
50 #ifdef GAIM_PLUGINS 50 if(!ref_protocol(p))
51 if (p->plug) { /* This protocol is a plugin */ 51 return;
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 52
62 if (p->login) { 53 if (p->login) {
63 if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD) && 54 if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD) &&
64 !(p->options & OPT_PROTO_PASSWORD_OPTIONAL)) { 55 !(p->options & OPT_PROTO_PASSWORD_OPTIONAL)) {
65 do_error_dialog(_("Please enter your password"), NULL, GAIM_ERROR); 56 do_error_dialog(_("Please enter your password"), NULL, GAIM_ERROR);
93 g_source_remove(gc->keepalive); 84 g_source_remove(gc->keepalive);
94 gc->keepalive = 0; 85 gc->keepalive = 0;
95 } 86 }
96 } 87 }
97 88
98 static gboolean delayed_unload(void *handle) {
99 g_module_close(handle);
100 return FALSE;
101 }
102
103 void serv_close(struct gaim_connection *gc) 89 void serv_close(struct gaim_connection *gc)
104 { 90 {
105 struct prpl *prpl; 91 struct prpl *prpl;
106 while (gc->buddy_chats) { 92 while (gc->buddy_chats) {
107 struct conversation *b = gc->buddy_chats->data; 93 struct conversation *b = gc->buddy_chats->data;
116 102
117 update_keepalive(gc, FALSE); 103 update_keepalive(gc, FALSE);
118 104
119 if (gc->prpl && gc->prpl->close) 105 if (gc->prpl && gc->prpl->close)
120 gc->prpl->close(gc); 106 gc->prpl->close(gc);
121 107
122 prpl = gc->prpl; 108 prpl = gc->prpl;
123 account_offline(gc); 109 account_offline(gc);
124 destroy_gaim_conn(gc); 110 destroy_gaim_conn(gc);
125 111
126 #ifdef GAIM_PLUGINS 112 unref_protocol(prpl);
127 if (prpl->plug) { /* This is a plugin */
128 prpl_accounts[prpl->protocol]--;
129 debug_printf("Prpl %s is now being used by %d accounts\n", prpl->name, prpl_accounts[prpl->protocol]);
130 if (prpl_accounts[prpl->protocol] == 0) { /* We don't need this protocol anymore */
131 debug_printf("Throwing out prpl %s\n", prpl->name);
132 g_timeout_add(0,delayed_unload, prpl->plug->handle);
133 prpl->plug->handle = NULL;
134 }
135 }
136 #endif
137
138 } 113 }
139 114
140 void serv_touch_idle(struct gaim_connection *gc) 115 void serv_touch_idle(struct gaim_connection *gc)
141 { 116 {
142 /* Are we idle? If so, not anymore */ 117 /* Are we idle? If so, not anymore */