annotate src/protocols/msn/cmdproc.c @ 13545:cfc2f7fcb3dd

[gaim-migrate @ 15922] Way more changes that I initially thought I was going to make. I apologize for the commit message spam. These changes bring a lot of consistency to our capitalization and punctuation, especially of words like "e-mail". For reference, I've used these rules (after discussing in #gaim): e-mail, a case of two words joined: "e-mail" - in the middle of a sentence caps context "E-mail" - start of text in a sentence caps context "E-Mail" - in a header (title) caps context re-enable, a single word, would be: "re-enable", "Re-enable", and "Re-enable" (respectively) The reason this changeset exploded is that, as I went through and verified these changes, I realized we were using improper capitalization (e.g. header instead of sentence) in a number of dialogs. I fixed a number of these cases before, and this corrects another pile. This looks like I've made a LOT of work for the translators, but the impact is significantly mitigated by three factors: 1) Many of these changes use strings that already exist, or change one string in many places. 2) I've used sed to correct the .po files where possible. 3) The actual changes are extremely trivial. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 21 Mar 2006 04:32:45 +0000
parents 1a97d5e88d12
children 995aea35b05c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file cmdproc.c MSN command processor functions
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * gaim
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
6 * Gaim is the legal property of its developers, whose names are too numerous
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
8 * source distribution.
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 *
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * (at your option) any later version.
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 *
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * GNU General Public License for more details.
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 *
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 */
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "msn.h"
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "cmdproc.h"
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 MsnCmdProc *
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 msn_cmdproc_new(MsnSession *session)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 MsnCmdProc *cmdproc;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 cmdproc = g_new0(MsnCmdProc, 1);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 cmdproc->session = session;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 cmdproc->txqueue = g_queue_new();
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 cmdproc->history = msn_history_new();
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 return cmdproc;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 msn_cmdproc_destroy(MsnCmdProc *cmdproc)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 MsnTransaction *trans;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 msn_transaction_destroy(trans);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 g_queue_free(cmdproc->txqueue);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 msn_history_destroy(cmdproc->history);
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10481
diff changeset
52
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10481
diff changeset
53 if (cmdproc->last_cmd != NULL)
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10481
diff changeset
54 msn_command_destroy(cmdproc->last_cmd);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10481
diff changeset
55
10481
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
56 g_free(cmdproc);
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 msn_cmdproc_process_queue(MsnCmdProc *cmdproc)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 MsnTransaction *trans;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63
10481
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
64 while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL)
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 msn_cmdproc_send_trans(cmdproc, trans);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, MsnTransaction *trans)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 g_return_if_fail(cmdproc != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 g_return_if_fail(trans != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 g_queue_push_tail(cmdproc->txqueue, trans);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 static void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 show_debug_cmd(MsnCmdProc *cmdproc, gboolean incoming, const char *command)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 MsnServConn *servconn;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 const char *names[] = { "NS", "SB" };
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 char *show;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 char tmp;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 size_t len;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 servconn = cmdproc->servconn;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 len = strlen(command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 show = g_strdup(command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 tmp = (incoming) ? 'S' : 'C';
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 if ((show[len - 1] == '\n') && (show[len - 2] == '\r'))
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 show[len - 2] = '\0';
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 gaim_debug_misc("msn", "%c: %s %03d: %s\n", tmp,
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 names[servconn->type], servconn->num, show);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 g_free(show);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 MsnServConn *servconn;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 char *data;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
108 size_t len;
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 g_return_if_fail(cmdproc != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 g_return_if_fail(trans != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 servconn = cmdproc->servconn;
10481
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
114
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
115 if (!servconn->connected)
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
116 return;
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
117
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 msn_history_add(cmdproc->history, trans);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 data = msn_transaction_to_string(trans);
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
121
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 len = strlen(data);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 show_debug_cmd(cmdproc, FALSE, data);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 if (trans->callbacks == NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 trans->callbacks = g_hash_table_lookup(cmdproc->cbs_table->cmds,
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 trans->command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 if (trans->payload != NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 data = g_realloc(data, len + trans->payload_len);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 memcpy(data + len, trans->payload, trans->payload_len);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 len += trans->payload_len;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 msn_servconn_write(servconn, data, len);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 g_free(data);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command,
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 const char *format, ...)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 MsnServConn *servconn;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 char *data;
8830
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
148 char *params = NULL;
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 va_list arg;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 size_t len;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 g_return_if_fail(cmdproc != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 g_return_if_fail(command != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 servconn = cmdproc->servconn;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156
10481
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
157 if (!servconn->connected)
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
158 return;
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
159
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
160 if (format != NULL)
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
161 {
8830
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
162 va_start(arg, format);
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
163 params = g_strdup_vprintf(format, arg);
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
164 va_end(arg);
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
165 }
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 if (params != NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 data = g_strdup_printf("%s %s\r\n", command, params);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 else
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 data = g_strdup_printf("%s\r\n", command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 g_free(params);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 len = strlen(data);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 show_debug_cmd(cmdproc, FALSE, data);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 msn_servconn_write(servconn, data, len);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 g_free(data);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command,
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 const char *format, ...)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 MsnTransaction *trans;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 va_list arg;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 g_return_if_fail(cmdproc != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 g_return_if_fail(command != NULL);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192
10481
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
193 if (!cmdproc->servconn->connected)
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
194 return;
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
195
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 trans = g_new0(MsnTransaction, 1);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 trans->command = g_strdup(command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
200 if (format != NULL)
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
201 {
8830
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
202 va_start(arg, format);
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
203 trans->params = g_strdup_vprintf(format, arg);
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
204 va_end(arg);
f8038b1f7449 [gaim-migrate @ 9594]
Christian Hammond <chipx86@chipx86.com>
parents: 8810
diff changeset
205 }
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 msn_cmdproc_send_trans(cmdproc, trans);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 void
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
211 msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload,
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
212 int payload_len)
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
213 {
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
214 MsnCommand *last;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
215
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
216 g_return_if_fail(cmdproc != NULL);
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
217
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
218 last = cmdproc->last_cmd;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
219 last->payload = g_memdup(payload, payload_len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
220 last->payload_len = payload_len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
221
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
222 if (last->payload_cb != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
223 last->payload_cb(cmdproc, last, payload, payload_len);
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
224 }
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
225
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
226 void
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 msn_cmdproc_process_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 {
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10310
diff changeset
229 MsnMsgTypeCb cb;
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230
9881
17dbed6eebf5 [gaim-migrate @ 10760]
Mark Doliner <mark@kingant.net>
parents: 9641
diff changeset
231 if (msn_message_get_content_type(msg) == NULL)
17dbed6eebf5 [gaim-migrate @ 10760]
Mark Doliner <mark@kingant.net>
parents: 9641
diff changeset
232 {
17dbed6eebf5 [gaim-migrate @ 10760]
Mark Doliner <mark@kingant.net>
parents: 9641
diff changeset
233 gaim_debug_misc("msn", "failed to find message content\n");
17dbed6eebf5 [gaim-migrate @ 10760]
Mark Doliner <mark@kingant.net>
parents: 9641
diff changeset
234 return;
17dbed6eebf5 [gaim-migrate @ 10760]
Mark Doliner <mark@kingant.net>
parents: 9641
diff changeset
235 }
17dbed6eebf5 [gaim-migrate @ 10760]
Mark Doliner <mark@kingant.net>
parents: 9641
diff changeset
236
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 cb = g_hash_table_lookup(cmdproc->cbs_table->msgs,
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 msn_message_get_content_type(msg));
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 if (cb == NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 {
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
242 gaim_debug_warning("msn", "Unhandled content-type '%s'\n",
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
243 msn_message_get_content_type(msg));
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 return;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 cb(cmdproc, msg);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 {
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
254 MsnTransCb cb = NULL;
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 MsnTransaction *trans = NULL;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 if (cmd->trId)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 trans = msn_history_find(cmdproc->history, cmd->trId);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
260 if (trans != NULL)
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
261 if (trans->timer)
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
262 gaim_timeout_remove(trans->timer);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
263
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 if (g_ascii_isdigit(cmd->command[0]))
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 if (trans != NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 MsnErrorCb error_cb = NULL;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 int error;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 error = atoi(cmd->command);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
272
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
273 if (trans->error_cb != NULL)
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
274 error_cb = trans->error_cb;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
275
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
276 if (error_cb == NULL && cmdproc->cbs_table->errors != NULL)
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 if (error_cb != NULL)
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
280 {
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 error_cb(cmdproc, trans, error);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10043
diff changeset
282 }
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 else
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 #if 1
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 msn_error_handle(cmdproc->session, error);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287 #else
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 gaim_debug_warning("msn", "Unhandled error '%s'\n",
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 cmd->command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 #endif
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 return;
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 if (cmdproc->cbs_table->async != NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
300 if (cb == NULL && trans != NULL)
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 {
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
302 cmd->trans = trans;
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
304 if (trans->callbacks != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
305 cb = g_hash_table_lookup(trans->callbacks, cmd->command);
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307
10043
700f8fb9e581 [gaim-migrate @ 11002]
Luke Schierer <lschiere@pidgin.im>
parents: 9881
diff changeset
308 if (cb == NULL && cmdproc->cbs_table->fallback != NULL)
700f8fb9e581 [gaim-migrate @ 11002]
Luke Schierer <lschiere@pidgin.im>
parents: 9881
diff changeset
309 cb = g_hash_table_lookup(cmdproc->cbs_table->fallback, cmd->command);
700f8fb9e581 [gaim-migrate @ 11002]
Luke Schierer <lschiere@pidgin.im>
parents: 9881
diff changeset
310
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 if (cb != NULL)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
312 {
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 cb(cmdproc, cmd);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
314 }
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 else
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 gaim_debug_warning("msn", "Unhandled command '%s'\n",
9158
c30d81b4dd22 [gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents: 8830
diff changeset
318 cmd->command);
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 9158
diff changeset
321 if (trans != NULL && trans->pendent_cmd != NULL)
10481
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
322 msn_transaction_unqueue_cmd(trans, cmdproc);
8810
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 }
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 void
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 {
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 show_debug_cmd(cmdproc, TRUE, command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 if (cmdproc->last_cmd != NULL)
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 msn_command_destroy(cmdproc->last_cmd);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 cmdproc->last_cmd = msn_command_from_string(command);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 msn_cmdproc_process_cmd(cmdproc, cmdproc->last_cmd);
a7affa2e2986 [gaim-migrate @ 9572]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 }