Mercurial > pidgin
comparison src/server.c @ 2586:0f5390176949
[gaim-migrate @ 2599]
try to do things more safely. dialogs.c is really what should be changed though.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Tue, 23 Oct 2001 08:22:48 +0000 |
| parents | d392e9b867e9 |
| children | e0d4a23aac89 |
comparison
equal
deleted
inserted
replaced
| 2585:4424c670021d | 2586:0f5390176949 |
|---|---|
| 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->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->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->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) |
| 216 } | 216 } |
| 217 } | 217 } |
| 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->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->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->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->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); |
| 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->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)) | |
| 262 return; | |
| 261 if (!gc->prpl) | 263 if (!gc->prpl) |
| 262 return; /* how the hell did that happen? */ | 264 return; /* how the hell did that happen? */ |
| 263 if (gc->prpl->remove_buddies) | 265 if (gc->prpl->remove_buddies) |
| 264 (*gc->prpl->remove_buddies)(gc, g); | 266 (*gc->prpl->remove_buddies)(gc, g); |
| 265 else { | 267 else { |
| 270 } | 272 } |
| 271 } | 273 } |
| 272 | 274 |
| 273 void serv_add_permit(struct gaim_connection *g, char *name) | 275 void serv_add_permit(struct gaim_connection *g, char *name) |
| 274 { | 276 { |
| 275 if (g->prpl && g->prpl->add_permit) | 277 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_permit) |
| 276 (*g->prpl->add_permit)(g, name); | 278 (*g->prpl->add_permit)(g, name); |
| 277 } | 279 } |
| 278 | 280 |
| 279 void serv_add_deny(struct gaim_connection *g, char *name) | 281 void serv_add_deny(struct gaim_connection *g, char *name) |
| 280 { | 282 { |
| 281 if (g->prpl && g->prpl->add_deny) | 283 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_deny) |
| 282 (*g->prpl->add_deny)(g, name); | 284 (*g->prpl->add_deny)(g, name); |
| 283 } | 285 } |
| 284 | 286 |
| 285 void serv_rem_permit(struct gaim_connection *g, char *name) | 287 void serv_rem_permit(struct gaim_connection *g, char *name) |
| 286 { | 288 { |
| 287 if (g->prpl && g->prpl->rem_permit) | 289 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_permit) |
| 288 (*g->prpl->rem_permit)(g, name); | 290 (*g->prpl->rem_permit)(g, name); |
| 289 } | 291 } |
| 290 | 292 |
| 291 void serv_rem_deny(struct gaim_connection *g, char *name) | 293 void serv_rem_deny(struct gaim_connection *g, char *name) |
| 292 { | 294 { |
| 293 if (g->prpl && g->prpl->rem_deny) | 295 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_deny) |
| 294 (*g->prpl->rem_deny)(g, name); | 296 (*g->prpl->rem_deny)(g, name); |
| 295 } | 297 } |
| 296 | 298 |
| 297 void serv_set_permit_deny(struct gaim_connection *g) | 299 void serv_set_permit_deny(struct gaim_connection *g) |
| 298 { | 300 { |
| 299 /* 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, |
| 300 * 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 |
| 301 * 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. */ |
| 302 if (g->prpl && g->prpl->set_permit_deny) | 304 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_permit_deny) |
| 303 (*g->prpl->set_permit_deny)(g); | 305 (*g->prpl->set_permit_deny)(g); |
| 304 } | 306 } |
| 305 | 307 |
| 306 | 308 |
| 307 void serv_set_idle(struct gaim_connection *g, int time) | 309 void serv_set_idle(struct gaim_connection *g, int time) |
| 308 { | 310 { |
| 309 if (g->prpl && g->prpl->set_idle) | 311 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_idle) |
| 310 (*g->prpl->set_idle)(g, time); | 312 (*g->prpl->set_idle)(g, time); |
| 311 } | 313 } |
| 312 | 314 |
| 313 void serv_warn(struct gaim_connection *g, char *name, int anon) | 315 void serv_warn(struct gaim_connection *g, char *name, int anon) |
| 314 { | 316 { |
| 315 if (g->prpl && g->prpl->warn) | 317 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->warn) |
| 316 (*g->prpl->warn)(g, name, anon); | 318 (*g->prpl->warn)(g, name, anon); |
| 317 } | 319 } |
| 318 | 320 |
| 319 void serv_join_chat(struct gaim_connection *g, GList *data) | 321 void serv_join_chat(struct gaim_connection *g, GList *data) |
| 320 { | 322 { |
| 321 if (g->prpl && g->prpl->join_chat) | 323 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->join_chat) |
| 322 (*g->prpl->join_chat)(g, data); | 324 (*g->prpl->join_chat)(g, data); |
| 323 } | 325 } |
| 324 | 326 |
| 325 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) |
| 326 { | 328 { |
| 327 char *buffy = message && *message ? g_strdup(message) : NULL; | 329 char *buffy = message && *message ? g_strdup(message) : NULL; |
| 328 plugin_event(event_chat_send_invite, g, (void *)id, name, &buffy); | 330 plugin_event(event_chat_send_invite, g, (void *)id, name, &buffy); |
| 329 if (g->prpl && g->prpl->chat_invite) | 331 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->chat_invite) |
| 330 (*g->prpl->chat_invite)(g, id, buffy, name); | 332 (*g->prpl->chat_invite)(g, id, buffy, name); |
| 331 if (buffy) | 333 if (buffy) |
| 332 g_free(buffy); | 334 g_free(buffy); |
| 333 } | 335 } |
| 334 | 336 |
| 335 void serv_chat_leave(struct gaim_connection *g, int id) | 337 void serv_chat_leave(struct gaim_connection *g, int id) |
| 336 { | 338 { |
| 337 /* i think this is the only one this should be necessary for since this is the | |
| 338 * only thing that could possibly get called after the connection is closed */ | |
| 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); |
