Mercurial > pidgin
changeset 5322:a4d017bee1de
[gaim-migrate @ 5694]
Dragging buddies into different groups now moves them server-side. You may
have some bugs regarding this, or some errors. They should go away after
they are moved into new groups.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 07 May 2003 01:53:04 +0000 |
parents | 21b303d09752 |
children | 29754a7d94e5 |
files | src/protocols/msn/msn.c src/protocols/msn/notification.c src/protocols/msn/session.h |
diffstat | 3 files changed, 103 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/msn/msn.c Wed May 07 01:41:07 2003 +0000 +++ b/src/protocols/msn/msn.c Wed May 07 01:53:04 2003 +0000 @@ -751,7 +751,51 @@ msn_group_buddy(struct gaim_connection *gc, const char *who, const char *old_group, const char *new_group) { - + MsnSession *session = gc->proto_data; + char outparams[MSN_BUF_LEN]; + gint *old_group_id, *new_group_id; + + old_group_id = g_hash_table_lookup(session->group_ids, old_group); + new_group_id = g_hash_table_lookup(session->group_ids, new_group); + + if (new_group_id == NULL) { + g_snprintf(outparams, sizeof(outparams), "%s 0", + msn_url_encode(new_group)); + + if (!msn_servconn_send_command(session->notification_conn, + "ADG", outparams)) { + hide_login_progress(gc, _("Write error")); + signoff(gc); + return; + } + + /* I hate this. So much. */ + session->moving_buddy = TRUE; + session->dest_group_id = *new_group_id; + } + else { + g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", + who, who, *new_group_id); + + if (!msn_servconn_send_command(session->notification_conn, + "ADD", outparams)) { + hide_login_progress(gc, _("Write error")); + signoff(gc); + return; + } + } + + if (old_group_id != NULL) { + g_snprintf(outparams, sizeof(outparams), "FL %s %d", + who, *old_group_id); + + if (!msn_servconn_send_command(session->notification_conn, + "REM", outparams)) { + hide_login_progress(gc, _("Write error")); + signoff(gc); + return; + } + } } static void
--- a/src/protocols/msn/notification.c Wed May 07 01:41:07 2003 +0000 +++ b/src/protocols/msn/notification.c Wed May 07 01:53:04 2003 +0000 @@ -362,6 +362,28 @@ } static gboolean +__adg_cmd(MsnServConn *servconn, const char *command, const char **params, + size_t param_count) +{ + MsnSession *session = servconn->session; + gint *group_id; + char *group_name; + + group_id = g_new(gint, 1); + *group_id = atoi(params[3]); + + group_name = msn_url_decode(params[2]); + + gaim_debug(GAIM_DEBUG_INFO, "msn", "Added group %s (id %d)\n", + group_name, group_id); + + g_hash_table_insert(session->group_ids, group_name, group_id); + g_hash_table_insert(session->group_names, group_id, g_strdup(group_name)); + + return TRUE; +} + +static gboolean __blp_cmd(MsnServConn *servconn, const char *command, const char **params, size_t param_count) { @@ -710,6 +732,34 @@ return TRUE; } +static gboolean +__rem_cmd(MsnServConn *servconn, const char *command, const char **params, + size_t param_count) +{ + MsnSession *session = servconn->session; + + /* I hate this. */ + if (session->moving_buddy) { + struct gaim_connection *gc = session->account->gc; + const char *passport = params[3]; + char outparams[MSN_BUF_LEN]; + + g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", + passport, passport, session->dest_group_id); + + session->moving_buddy = FALSE; + session->dest_group_id = 0; + + if (!msn_servconn_send_command(session->notification_conn, + "ADD", outparams)) { + hide_login_progress(gc, _("Write error")); + signoff(gc); + } + } + + return TRUE; +} + /************************************************************************** * Misc commands **************************************************************************/ @@ -1046,6 +1096,7 @@ if (notification_commands == NULL) { /* Register the command callbacks. */ msn_servconn_register_command(notification, "ADD", __add_cmd); + msn_servconn_register_command(notification, "ADG", __adg_cmd); msn_servconn_register_command(notification, "BLP", __blp_cmd); msn_servconn_register_command(notification, "BPR", __blank_cmd); msn_servconn_register_command(notification, "CHG", __blank_cmd); @@ -1064,7 +1115,8 @@ msn_servconn_register_command(notification, "QRY", __blank_cmd); msn_servconn_register_command(notification, "REA", __rea_cmd); msn_servconn_register_command(notification, "REG", __reg_cmd); - msn_servconn_register_command(notification, "REM", __blank_cmd); + msn_servconn_register_command(notification, "REM", __rem_cmd); + msn_servconn_register_command(notification, "RMG", __blank_cmd); msn_servconn_register_command(notification, "RNG", __rng_cmd); msn_servconn_register_command(notification, "SYN", __blank_cmd); msn_servconn_register_command(notification, "URL", __url_cmd);
--- a/src/protocols/msn/session.h Wed May 07 01:41:07 2003 +0000 +++ b/src/protocols/msn/session.h Wed May 07 01:53:04 2003 +0000 @@ -67,8 +67,12 @@ } passport_info; - /* You have no idea how much I hate this. */ + /* You have no idea how much I hate all that is below. */ GaimPlugin *prpl; + + /* For moving buddies from one group to another. Ugh. */ + gboolean moving_buddy; + gint dest_group_id; }; /**