Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/transaction.c @ 31292:47b6eda87723
propagate from branch 'im.pidgin.pidgin' (head 07d0765c444a097af45c2650f54323afb900a07b)
to branch 'im.pidgin.soc.2010.msn-tlc' (head f3998422a4724ab424e4e2328f58fc0504856557)
author | masca@cpw.pidgin.im |
---|---|
date | Mon, 19 Jul 2010 21:11:32 +0000 |
parents | 230caecf5435 |
children | ad11780ba8b9 |
comparison
equal
deleted
inserted
replaced
30698:e874875a74a7 | 31292:47b6eda87723 |
---|---|
19 * | 19 * |
20 * You should have received a copy of the GNU General Public License | 20 * You should have received a copy of the GNU General Public License |
21 * along with this program; if not, write to the Free Software | 21 * along with this program; if not, write to the Free Software |
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
23 */ | 23 */ |
24 | |
25 #include "internal.h" | |
26 #include "debug.h" | |
27 | |
24 #include "msn.h" | 28 #include "msn.h" |
25 #include "transaction.h" | 29 #include "transaction.h" |
26 | 30 |
27 MsnTransaction * | 31 MsnTransaction * |
28 msn_transaction_new(MsnCmdProc *cmdproc, const char *command, | 32 msn_transaction_new(MsnCmdProc *cmdproc, const char *command, |
35 | 39 |
36 trans = g_new0(MsnTransaction, 1); | 40 trans = g_new0(MsnTransaction, 1); |
37 | 41 |
38 trans->cmdproc = cmdproc; | 42 trans->cmdproc = cmdproc; |
39 trans->command = g_strdup(command); | 43 trans->command = g_strdup(command); |
44 trans->saveable = TRUE; | |
40 | 45 |
41 if (format != NULL) | 46 if (format != NULL) |
42 { | 47 { |
43 va_start(arg, format); | 48 va_start(arg, format); |
44 trans->params = g_strdup_vprintf(format, arg); | 49 trans->params = g_strdup_vprintf(format, arg); |
94 | 99 |
95 g_return_val_if_fail(trans != NULL, FALSE); | 100 g_return_val_if_fail(trans != NULL, FALSE); |
96 | 101 |
97 if (trans->params != NULL) | 102 if (trans->params != NULL) |
98 str = g_strdup_printf("%s %u %s\r\n", trans->command, trans->trId, trans->params); | 103 str = g_strdup_printf("%s %u %s\r\n", trans->command, trans->trId, trans->params); |
104 else if (trans->saveable) | |
105 str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId); | |
99 else | 106 else |
100 str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId); | 107 str = g_strdup_printf("%s\r\n", trans->command); |
101 | 108 |
102 return str; | 109 return str; |
103 } | 110 } |
104 | 111 |
105 void | 112 void |
173 g_return_if_fail(trans != NULL); | 180 g_return_if_fail(trans != NULL); |
174 trans->data_free = fn; | 181 trans->data_free = fn; |
175 } | 182 } |
176 | 183 |
177 void | 184 void |
185 msn_transaction_set_saveable(MsnTransaction *trans, gboolean saveable) | |
186 { | |
187 g_return_if_fail(trans != NULL); | |
188 | |
189 trans->saveable = saveable; | |
190 } | |
191 | |
192 void | |
178 msn_transaction_add_cb(MsnTransaction *trans, char *answer, | 193 msn_transaction_add_cb(MsnTransaction *trans, char *answer, |
179 MsnTransCb cb) | 194 MsnTransCb cb) |
180 { | 195 { |
181 g_return_if_fail(trans != NULL); | 196 g_return_if_fail(trans != NULL); |
182 g_return_if_fail(answer != NULL); | 197 g_return_if_fail(answer != NULL); |