Mercurial > pidgin
changeset 6885:66dd420d3d23
[gaim-migrate @ 7431]
Add support for removing groups in protocols. Currently, only MSN supports
it, but you cannot delete group 0 (aka, "The evil ~ group of DOOM!"), so
I'll add a GrossHack (TM) to not show that group if it's empty.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 18 Sep 2003 05:39:44 +0000 |
parents | 5bd9f201b4bf |
children | b5fb1d5282e5 |
files | src/blist.c src/dialogs.c src/html.h src/protocols/msn/msn.c src/prpl.h src/server.c src/server.h |
diffstat | 7 files changed, 57 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/blist.c Thu Sep 18 02:56:04 2003 +0000 +++ b/src/blist.c Thu Sep 18 05:39:44 2003 +0000 @@ -1102,6 +1102,7 @@ { struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; GaimBlistNode *node = (GaimBlistNode*)group; + GList *l; if(node->child) { char *buf; @@ -1134,6 +1135,14 @@ if (node->next) node->next->prev = node->prev; + for (l = gaim_connections_get_all(); l != NULL; l = l->next) + { + GaimConnection *gc = (GaimConnection *)l->data; + + if (gaim_connection_get_state(gc) == GAIM_CONNECTED) + serv_remove_group(gc, group->name); + } + ops->remove(gaimbuddylist, node); g_free(group->name); g_free(group);
--- a/src/dialogs.c Thu Sep 18 02:56:04 2003 +0000 +++ b/src/dialogs.c Thu Sep 18 05:39:44 2003 +0000 @@ -435,7 +435,9 @@ void do_remove_group(GaimGroup *g) { GaimBlistNode *cnode, *bnode; + cnode = ((GaimBlistNode*)g)->child; + while(cnode) { if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) { bnode = cnode->child; @@ -467,6 +469,7 @@ cnode = cnode->next; } } + gaim_blist_remove_group(g); gaim_blist_save(); }
--- a/src/html.h Thu Sep 18 02:56:04 2003 +0000 +++ b/src/html.h Thu Sep 18 05:39:44 2003 +0000 @@ -5,7 +5,7 @@ * gaim * * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
--- a/src/protocols/msn/msn.c Thu Sep 18 02:56:04 2003 +0000 +++ b/src/protocols/msn/msn.c Thu Sep 18 05:39:44 2003 +0000 @@ -1191,6 +1191,29 @@ } static void +msn_remove_group(GaimConnection *gc, const char *name) +{ + MsnSession *session = (MsnSession *)gc->proto_data; + MsnGroup *group; + + if ((group = msn_groups_find_with_name(session->groups, name)) != NULL) + { + char outparams[MSN_BUF_LEN]; + + g_snprintf(outparams, sizeof(outparams), "%d", + msn_group_get_id(group)); + + if (!msn_servconn_send_command(session->notification_conn, + "RMG", outparams)) + { + gaim_connection_error(gc, _("Write error")); + + return; + } + } +} + +static void msn_got_info(gpointer data, char *url_text, unsigned long len) { char *stripped, *p, *q; @@ -1460,7 +1483,9 @@ msn_rename_group, msn_buddy_free, msn_convo_closed, - msn_normalize + msn_normalize, + NULL, + msn_remove_group }; static GaimPluginInfo info =
--- a/src/prpl.h Thu Sep 18 02:56:04 2003 +0000 +++ b/src/prpl.h Thu Sep 18 05:39:44 2003 +0000 @@ -303,12 +303,13 @@ void (*buddy_free)(GaimBuddy *); - /* this is really bad. */ void (*convo_closed)(GaimConnection *, const char *who); char *(*normalize)(const char *); void (*set_buddy_icon)(GaimConnection *, const char *filename); + + void (*remove_group)(GaimConnection *gc, const char *group); }; #define GAIM_IS_PROTOCOL_PLUGIN(plugin) \
--- a/src/server.c Thu Sep 18 02:56:04 2003 +0000 +++ b/src/server.c Thu Sep 18 05:39:44 2003 +0000 @@ -490,6 +490,21 @@ prpl_info->remove_buddy(g, name, group); } +void +serv_remove_group(GaimConnection *gc, const char *name) +{ + GaimPluginProtocolInfo *prpl_info = NULL; + + if (gc != NULL && gc->prpl != NULL) + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + + if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && + prpl_info->remove_group) + { + prpl_info->remove_group(gc, name); + } +} + void serv_remove_buddies(GaimConnection *gc, GList *g, const char *group) { GaimPluginProtocolInfo *prpl_info = NULL;
--- a/src/server.h Thu Sep 18 02:56:04 2003 +0000 +++ b/src/server.h Thu Sep 18 05:39:44 2003 +0000 @@ -52,6 +52,7 @@ void serv_add_buddies(GaimConnection *, GList *); void serv_remove_buddy(GaimConnection *, const char *, const char *); void serv_remove_buddies(GaimConnection *, GList *, const char *); +void serv_remove_group(GaimConnection *, const char *); void serv_add_permit(GaimConnection *, const char *); void serv_add_deny(GaimConnection *, const char *); void serv_rem_permit(GaimConnection *, const char *);