Mercurial > pidgin.yaz
changeset 31148:f7ee91763c6b
msn: Remove msn_cmdproc_send_quick in favor of msn_cmdproc_send_trans
With this changes whe have an unified and robust way to send commands.
We avoid duplicated code and it's easier to find problems since the code is only
in one place.
author | masca@cpw.pidgin.im |
---|---|
date | Wed, 10 Mar 2010 22:16:04 +0000 |
parents | 4d7dfeae29c6 |
children | 54c8aeecab4c |
files | libpurple/protocols/msn/cmdproc.c libpurple/protocols/msn/cmdproc.h libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/switchboard.c |
diffstat | 5 files changed, 10 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/cmdproc.c Wed Mar 10 21:46:37 2010 +0000 +++ b/libpurple/protocols/msn/cmdproc.c Wed Mar 10 22:16:04 2010 +0000 @@ -155,48 +155,6 @@ } void -msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnServConn *servconn; - char *data; - char *params = NULL; - va_list arg; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) - return; - - if (format != NULL) - { - va_start(arg, format); - params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - if (params != NULL) - data = g_strdup_printf("%s %s\r\n", command, params); - else - data = g_strdup_printf("%s\r\n", command); - - g_free(params); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - - -void msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload, int payload_len) {
--- a/libpurple/protocols/msn/cmdproc.h Wed Mar 10 21:46:37 2010 +0000 +++ b/libpurple/protocols/msn/cmdproc.h Wed Mar 10 22:16:04 2010 +0000 @@ -91,9 +91,6 @@ void msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); -void msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); - void msn_cmdproc_process_msg(MsnCmdProc *cmdproc, MsnMessage *msg); void msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd);
--- a/libpurple/protocols/msn/msn.c Wed Mar 10 21:46:37 2010 +0000 +++ b/libpurple/protocols/msn/msn.c Wed Mar 10 22:16:04 2010 +0000 @@ -1962,6 +1962,7 @@ msn_keepalive(PurpleConnection *gc) { MsnSession *session; + MsnTransaction *trans; session = gc->proto_data; @@ -1971,7 +1972,8 @@ cmdproc = session->notification->cmdproc; - msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL); + trans = msn_transaction_new(cmdproc, "PNG", NULL, NULL); + msn_cmdproc_send_trans(cmdproc, trans); } }
--- a/libpurple/protocols/msn/notification.c Wed Mar 10 21:46:37 2010 +0000 +++ b/libpurple/protocols/msn/notification.c Wed Mar 10 22:16:04 2010 +0000 @@ -304,12 +304,15 @@ void msn_notification_close(MsnNotification *notification) { + MsnTransaction *trans; + g_return_if_fail(notification != NULL); if (!notification->in_use) return; - msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL); + trans = msn_transaction_new(notification->cmdproc, "OUT", NULL, NULL); + msn_cmdproc_send_trans(notification->cmdproc, trans); msn_notification_disconnect(notification); }
--- a/libpurple/protocols/msn/switchboard.c Wed Mar 10 21:46:37 2010 +0000 +++ b/libpurple/protocols/msn/switchboard.c Wed Mar 10 22:16:04 2010 +0000 @@ -1223,8 +1223,10 @@ !swboard->session->connected) { MsnCmdProc *cmdproc; + MsnTransaction *trans; cmdproc = swboard->cmdproc; - msn_cmdproc_send_quick(cmdproc, "OUT", NULL, NULL); + trans = msn_transaction_new(cmdproc, "OUT", NULL, NULL); + msn_cmdproc_send_trans(cmdproc, trans); msn_switchboard_destroy(swboard); }