comparison src/server.c @ 11643:eb14bbcf7249

[gaim-migrate @ 13920] sf patch #1293063, from John Bailey Move and rename some functions from server.c to the account API. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 12 Oct 2005 02:47:31 +0000
parents c4fde4165293
children bcc49c25ef90
comparison
equal deleted inserted replaced
11642:58bc500cf226 11643:eb14bbcf7249
207 gaim_signal_emit(gaim_accounts_get_handle(), 207 gaim_signal_emit(gaim_accounts_get_handle(),
208 "account-set-info", account, info); 208 "account-set-info", account, info);
209 } 209 }
210 } 210 }
211 211
212 void serv_change_passwd(GaimConnection *gc, const char *orig, const char *new)
213 {
214 GaimPluginProtocolInfo *prpl_info = NULL;
215
216 if (gc != NULL && gc->prpl != NULL)
217 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
218
219 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->change_passwd)
220 prpl_info->change_passwd(gc, orig, new);
221 }
222
223 void serv_add_buddy(GaimConnection *gc, GaimBuddy *buddy)
224 {
225 GaimPluginProtocolInfo *prpl_info = NULL;
226
227 if (gc != NULL && gc->prpl != NULL)
228 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
229
230 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->add_buddy)
231 prpl_info->add_buddy(gc, buddy, gaim_find_buddys_group(buddy));
232 }
233
234 void serv_add_buddies(GaimConnection *gc, GList *buddies)
235 {
236 GaimPluginProtocolInfo *prpl_info = NULL;
237
238 if (gc != NULL && gc->prpl != NULL)
239 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
240
241 if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) {
242 GList *cur, *groups = NULL;
243
244 /* Make a list of what the groups each buddy is in */
245 for (cur = buddies; cur != NULL; cur = cur->next) {
246 GaimBlistNode *node = cur->data;
247 groups = g_list_append(groups, node->parent->parent);
248 }
249
250 if (prpl_info->add_buddies)
251 prpl_info->add_buddies(gc, buddies, groups);
252 else if (prpl_info->add_buddy) {
253 GList *curb = buddies;
254 GList *curg = groups;
255 while ((curb != NULL) && (curg != NULL)) {
256 prpl_info->add_buddy(gc, curb->data, curg->data);
257 curb = curb->next;
258 curg = curg->next;
259 }
260 }
261
262 g_list_free(groups);
263 }
264 }
265
266
267 void serv_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
268 {
269 GaimPluginProtocolInfo *prpl_info = NULL;
270
271 if (gc != NULL && gc->prpl != NULL)
272 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
273
274 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->remove_buddy)
275 prpl_info->remove_buddy(gc, buddy, group);
276 }
277
278 void serv_remove_buddies(GaimConnection *gc, GList *buddies, GList *groups)
279 {
280 GaimPluginProtocolInfo *prpl_info = NULL;
281
282 if (!g_list_find(gaim_connections_get_all(), gc))
283 return;
284
285 if (gc != NULL && gc->prpl != NULL)
286 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
287
288 if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) {
289 if (prpl_info->remove_buddies) {
290 prpl_info->remove_buddies(gc, buddies, groups);
291 } else {
292 GList *curb = buddies;
293 GList *curg = groups;
294 while ((curb != NULL) && (curg != NULL)) {
295 serv_remove_buddy(gc, curb->data, curg->data);
296 curb = curb->next;
297 curg = curg->next;
298 }
299 }
300 }
301 }
302
303 void serv_remove_group(GaimConnection *gc, GaimGroup *group)
304 {
305 GaimPluginProtocolInfo *prpl_info = NULL;
306
307 if (gc != NULL && gc->prpl != NULL)
308 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
309
310 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) &&
311 prpl_info->remove_group)
312 {
313 prpl_info->remove_group(gc, group);
314 }
315 }
316
317 /* 212 /*
318 * Set buddy's alias on server roster/list 213 * Set buddy's alias on server roster/list
319 */ 214 */
320 void serv_alias_buddy(GaimBuddy *b) 215 void serv_alias_buddy(GaimBuddy *b)
321 { 216 {