comparison src/server.c @ 2662:b0c5770156e1

[gaim-migrate @ 2675] everything changed! not really. actually to be quite honest nothing changed. it's really bad that all of these files use prpl references. most of them shouldn't. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 02 Nov 2001 01:41:37 +0000
parents 2555683e8dc8
children 37d80035e77f
comparison
equal deleted inserted replaced
2661:5e9a033f04fa 2662:b0c5770156e1
52 if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD)) { 52 if (!strlen(user->password) && !(p->options & OPT_PROTO_NO_PASSWORD)) {
53 do_error_dialog(_("Please enter your password"), _("Signon Error")); 53 do_error_dialog(_("Please enter your password"), _("Signon Error"));
54 return; 54 return;
55 } 55 }
56 56
57 debug_printf("Logging in using %s\n", (*p->name)()); 57 debug_printf("Logging in using %s\n", p->name());
58 (*p->login)(user); 58 p->login(user);
59 } else { 59 } else {
60 do_error_dialog(_("You cannot log this account in; you do not have " 60 do_error_dialog(_("You cannot log this account in; you do not have "
61 "the protocol it uses loaded, or the protocol does " 61 "the protocol it uses loaded, or the protocol does "
62 "not have a login function."), _("Login Error")); 62 "not have a login function."), _("Login Error"));
63 } 63 }
65 65
66 static gboolean send_keepalive(gpointer d) 66 static gboolean send_keepalive(gpointer d)
67 { 67 {
68 struct gaim_connection *gc = d; 68 struct gaim_connection *gc = d;
69 if (gc->prpl && gc->prpl->keepalive) 69 if (gc->prpl && gc->prpl->keepalive)
70 (*gc->prpl->keepalive)(gc); 70 gc->prpl->keepalive(gc);
71 return TRUE; 71 return TRUE;
72 } 72 }
73 73
74 static void update_keepalive(struct gaim_connection *gc, gboolean on) 74 static void update_keepalive(struct gaim_connection *gc, gboolean on)
75 { 75 {
97 gc->idle_timer = 0; 97 gc->idle_timer = 0;
98 98
99 update_keepalive(gc, FALSE); 99 update_keepalive(gc, FALSE);
100 100
101 if (gc->prpl && gc->prpl->close) 101 if (gc->prpl && gc->prpl->close)
102 (*gc->prpl->close)(gc); 102 gc->prpl->close(gc);
103 103
104 account_offline(gc); 104 account_offline(gc);
105 destroy_gaim_conn(gc); 105 destroy_gaim_conn(gc);
106 } 106 }
107 107
144 144
145 int serv_send_im(struct gaim_connection *gc, char *name, char *message, int flags) 145 int serv_send_im(struct gaim_connection *gc, char *name, char *message, int flags)
146 { 146 {
147 int val = -EINVAL; 147 int val = -EINVAL;
148 if (gc->prpl && gc->prpl->send_im) 148 if (gc->prpl && gc->prpl->send_im)
149 val = (*gc->prpl->send_im)(gc, name, message, flags); 149 val = gc->prpl->send_im(gc, name, message, flags);
150 150
151 if (!(flags & IM_FLAG_AWAY)) 151 if (!(flags & IM_FLAG_AWAY))
152 serv_touch_idle(gc); 152 serv_touch_idle(gc);
153 153
154 return val; 154 return val;
155 } 155 }
156 156
157 void serv_get_info(struct gaim_connection *g, char *name) 157 void serv_get_info(struct gaim_connection *g, char *name)
158 { 158 {
159 if (g && g->prpl && g->prpl->get_info) 159 if (g && g->prpl && g->prpl->get_info)
160 (*g->prpl->get_info)(g, name); 160 g->prpl->get_info(g, name);
161 } 161 }
162 162
163 void serv_get_dir(struct gaim_connection *g, char *name) 163 void serv_get_dir(struct gaim_connection *g, char *name)
164 { 164 {
165 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->get_dir) 165 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->get_dir)
166 (*g->prpl->get_dir)(g, name); 166 g->prpl->get_dir(g, name);
167 } 167 }
168 168
169 void serv_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, char *maiden, 169 void serv_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, char *maiden,
170 char *city, char *state, char *country, int web) 170 char *city, char *state, char *country, int web)
171 { 171 {
172 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_dir) 172 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_dir)
173 (*g->prpl->set_dir)(g, first, middle, last, maiden, city, state, country, web); 173 g->prpl->set_dir(g, first, middle, last, maiden, city, state, country, web);
174 } 174 }
175 175
176 void serv_dir_search(struct gaim_connection *g, char *first, char *middle, char *last, char *maiden, 176 void serv_dir_search(struct gaim_connection *g, char *first, char *middle, char *last, char *maiden,
177 char *city, char *state, char *country, char *email) 177 char *city, char *state, char *country, char *email)
178 { 178 {
179 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->dir_search) 179 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->dir_search)
180 (*g->prpl->dir_search)(g, first, middle, last, maiden, city, state, country, email); 180 g->prpl->dir_search(g, first, middle, last, maiden, city, state, country, email);
181 } 181 }
182 182
183 183
184 void serv_set_away(struct gaim_connection *gc, char *state, char *message) 184 void serv_set_away(struct gaim_connection *gc, char *state, char *message)
185 { 185 {
191 strncpy(buf, message, strlen(message) + 1); 191 strncpy(buf, message, strlen(message) + 1);
192 else 192 else
193 strncpy_nohtml(buf, message, strlen(message) + 1); 193 strncpy_nohtml(buf, message, strlen(message) + 1);
194 } 194 }
195 195
196 (*gc->prpl->set_away)(gc, state, buf); 196 gc->prpl->set_away(gc, state, buf);
197 197
198 plugin_event(event_away, gc, state, buf, 0); 198 plugin_event(event_away, gc, state, buf, 0);
199 199
200 if (buf) 200 if (buf)
201 g_free(buf); 201 g_free(buf);
218 218
219 void serv_set_info(struct gaim_connection *g, char *info) 219 void serv_set_info(struct gaim_connection *g, char *info)
220 { 220 {
221 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_info) { 221 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_info) {
222 plugin_event(event_set_info, g, info, 0, 0); 222 plugin_event(event_set_info, g, info, 0, 0);
223 (*g->prpl->set_info)(g, info); 223 g->prpl->set_info(g, info);
224 } 224 }
225 } 225 }
226 226
227 void serv_change_passwd(struct gaim_connection *g, char *orig, char *new) 227 void serv_change_passwd(struct gaim_connection *g, char *orig, char *new)
228 { 228 {
229 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->change_passwd) 229 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->change_passwd)
230 (*g->prpl->change_passwd)(g, orig, new); 230 g->prpl->change_passwd(g, orig, new);
231 } 231 }
232 232
233 void serv_add_buddy(struct gaim_connection *g, char *name) 233 void serv_add_buddy(struct gaim_connection *g, char *name)
234 { 234 {
235 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_buddy) 235 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_buddy)
236 (*g->prpl->add_buddy)(g, name); 236 g->prpl->add_buddy(g, name);
237 } 237 }
238 238
239 void serv_add_buddies(struct gaim_connection *g, GList *buddies) 239 void serv_add_buddies(struct gaim_connection *g, GList *buddies)
240 { 240 {
241 if (g && g_slist_find(connections, g) && g->prpl) { 241 if (g && g_slist_find(connections, g) && g->prpl) {
242 if (g->prpl->add_buddies) 242 if (g->prpl->add_buddies)
243 (*g->prpl->add_buddies)(g, buddies); 243 g->prpl->add_buddies(g, buddies);
244 else if (g->prpl->add_buddy) 244 else if (g->prpl->add_buddy)
245 while (buddies) { 245 while (buddies) {
246 (*g->prpl->add_buddy)(g, buddies->data); 246 g->prpl->add_buddy(g, buddies->data);
247 buddies = buddies->next; 247 buddies = buddies->next;
248 } 248 }
249 } 249 }
250 } 250 }
251 251
252 252
253 void serv_remove_buddy(struct gaim_connection *g, char *name) 253 void serv_remove_buddy(struct gaim_connection *g, char *name)
254 { 254 {
255 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->remove_buddy) 255 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->remove_buddy)
256 (*g->prpl->remove_buddy)(g, name); 256 g->prpl->remove_buddy(g, name);
257 } 257 }
258 258
259 void serv_remove_buddies(struct gaim_connection *gc, GList *g) 259 void serv_remove_buddies(struct gaim_connection *gc, GList *g)
260 { 260 {
261 if (!g_slist_find(connections, gc)) 261 if (!g_slist_find(connections, gc))
262 return; 262 return;
263 if (!gc->prpl) 263 if (!gc->prpl)
264 return; /* how the hell did that happen? */ 264 return; /* how the hell did that happen? */
265 if (gc->prpl->remove_buddies) 265 if (gc->prpl->remove_buddies)
266 (*gc->prpl->remove_buddies)(gc, g); 266 gc->prpl->remove_buddies(gc, g);
267 else { 267 else {
268 while (g) { 268 while (g) {
269 serv_remove_buddy(gc, g->data); 269 serv_remove_buddy(gc, g->data);
270 g = g->next; 270 g = g->next;
271 } 271 }
273 } 273 }
274 274
275 void serv_add_permit(struct gaim_connection *g, char *name) 275 void serv_add_permit(struct gaim_connection *g, char *name)
276 { 276 {
277 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_permit) 277 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_permit)
278 (*g->prpl->add_permit)(g, name); 278 g->prpl->add_permit(g, name);
279 } 279 }
280 280
281 void serv_add_deny(struct gaim_connection *g, char *name) 281 void serv_add_deny(struct gaim_connection *g, char *name)
282 { 282 {
283 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_deny) 283 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_deny)
284 (*g->prpl->add_deny)(g, name); 284 g->prpl->add_deny(g, name);
285 } 285 }
286 286
287 void serv_rem_permit(struct gaim_connection *g, char *name) 287 void serv_rem_permit(struct gaim_connection *g, char *name)
288 { 288 {
289 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_permit) 289 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_permit)
290 (*g->prpl->rem_permit)(g, name); 290 g->prpl->rem_permit(g, name);
291 } 291 }
292 292
293 void serv_rem_deny(struct gaim_connection *g, char *name) 293 void serv_rem_deny(struct gaim_connection *g, char *name)
294 { 294 {
295 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_deny) 295 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_deny)
296 (*g->prpl->rem_deny)(g, name); 296 g->prpl->rem_deny(g, name);
297 } 297 }
298 298
299 void serv_set_permit_deny(struct gaim_connection *g) 299 void serv_set_permit_deny(struct gaim_connection *g)
300 { 300 {
301 /* this is called when either you import a buddy list, and make lots of changes that way, 301 /* this is called when either you import a buddy list, and make lots of changes that way,
302 * or when the user toggles the permit/deny mode in the prefs. In either case you should 302 * or when the user toggles the permit/deny mode in the prefs. In either case you should
303 * probably be resetting and resending the permit/deny info when you get this. */ 303 * probably be resetting and resending the permit/deny info when you get this. */
304 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_permit_deny) 304 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_permit_deny)
305 (*g->prpl->set_permit_deny)(g); 305 g->prpl->set_permit_deny(g);
306 } 306 }
307 307
308 308
309 void serv_set_idle(struct gaim_connection *g, int time) 309 void serv_set_idle(struct gaim_connection *g, int time)
310 { 310 {
311 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_idle) 311 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_idle)
312 (*g->prpl->set_idle)(g, time); 312 g->prpl->set_idle(g, time);
313 } 313 }
314 314
315 void serv_warn(struct gaim_connection *g, char *name, int anon) 315 void serv_warn(struct gaim_connection *g, char *name, int anon)
316 { 316 {
317 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->warn) 317 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->warn)
318 (*g->prpl->warn)(g, name, anon); 318 g->prpl->warn(g, name, anon);
319 } 319 }
320 320
321 void serv_join_chat(struct gaim_connection *g, GList *data) 321 void serv_join_chat(struct gaim_connection *g, GList *data)
322 { 322 {
323 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->join_chat) 323 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->join_chat)
324 (*g->prpl->join_chat)(g, data); 324 g->prpl->join_chat(g, data);
325 } 325 }
326 326
327 void serv_chat_invite(struct gaim_connection *g, int id, char *message, char *name) 327 void serv_chat_invite(struct gaim_connection *g, int id, char *message, char *name)
328 { 328 {
329 char *buffy = message && *message ? g_strdup(message) : NULL; 329 char *buffy = message && *message ? g_strdup(message) : NULL;
330 plugin_event(event_chat_send_invite, g, (void *)id, name, &buffy); 330 plugin_event(event_chat_send_invite, g, (void *)id, name, &buffy);
331 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->chat_invite) 331 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->chat_invite)
332 (*g->prpl->chat_invite)(g, id, buffy, name); 332 g->prpl->chat_invite(g, id, buffy, name);
333 if (buffy) 333 if (buffy)
334 g_free(buffy); 334 g_free(buffy);
335 } 335 }
336 336
337 void serv_chat_leave(struct gaim_connection *g, int id) 337 void serv_chat_leave(struct gaim_connection *g, int id)
338 { 338 {
339 if (!g_slist_find(connections, g)) 339 if (!g_slist_find(connections, g))
340 return; 340 return;
341 341
342 if (g->prpl && g->prpl->chat_leave) 342 if (g->prpl && g->prpl->chat_leave)
343 (*g->prpl->chat_leave)(g, id); 343 g->prpl->chat_leave(g, id);
344 } 344 }
345 345
346 void serv_chat_whisper(struct gaim_connection *g, int id, char *who, char *message) 346 void serv_chat_whisper(struct gaim_connection *g, int id, char *who, char *message)
347 { 347 {
348 if (g->prpl && g->prpl->chat_whisper) 348 if (g->prpl && g->prpl->chat_whisper)
349 (*g->prpl->chat_whisper)(g, id, who, message); 349 g->prpl->chat_whisper(g, id, who, message);
350 } 350 }
351 351
352 int serv_chat_send(struct gaim_connection *g, int id, char *message) 352 int serv_chat_send(struct gaim_connection *g, int id, char *message)
353 { 353 {
354 int val = -EINVAL; 354 int val = -EINVAL;
355 if (g->prpl && g->prpl->chat_send) 355 if (g->prpl && g->prpl->chat_send)
356 val = (*g->prpl->chat_send)(g, id, message); 356 val = g->prpl->chat_send(g, id, message);
357 serv_touch_idle(g); 357 serv_touch_idle(g);
358 return val; 358 return val;
359 } 359 }
360 360
361 int find_queue_row_by_name(char *name) 361 int find_queue_row_by_name(char *name)