Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/sbconn.c @ 32489:60d879806964
Be a bit more specific about removing non-local MSN objects, which
HanzZ thinks should fix a leak somewhere.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 02 Sep 2011 19:50:58 +0000 |
parents | f83dc631c73b |
children |
rev | line source |
---|---|
31412
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
1 /** |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
2 * @file sbconn.c MSN Switchboard Connection |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
3 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
4 * purple |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
5 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
8 * source distribution. |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
9 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
13 * (at your option) any later version. |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
14 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
18 * GNU General Public License for more details. |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
19 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
23 */ |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31393
diff
changeset
|
24 |
31236
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
25 #include "internal.h" |
31256
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
26 #include "debug.h" |
31236
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
27 |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
28 #include "msg.h" |
31231
f84fb808e8ed
Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents:
diff
changeset
|
29 #include "sbconn.h" |
f84fb808e8ed
Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents:
diff
changeset
|
30 |
31236
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
31 void msn_sbconn_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part) |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
32 { |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
33 MsnMessage *msg; |
31246
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
31236
diff
changeset
|
34 const char *passport; |
31236
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
35 char *data; |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
36 size_t size; |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
37 |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
38 msg = msn_message_new_msnslp(); |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
39 |
31246
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
31236
diff
changeset
|
40 passport = purple_normalize(slplink->session->account, slplink->remote_user); |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
31236
diff
changeset
|
41 msn_message_set_header(msg, "P2P-Dest", passport); |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
31236
diff
changeset
|
42 |
31376
2de522fa534a
Fix a lot more leaks, some old, some new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31287
diff
changeset
|
43 msg->part = msn_slpmsgpart_ref(part); |
31236
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
44 data = msn_slpmsgpart_serialize(part, &size); |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
45 msn_message_set_bin_data(msg, data, size); |
31376
2de522fa534a
Fix a lot more leaks, some old, some new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31287
diff
changeset
|
46 g_free(data); |
31236
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
47 |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
48 if (slplink->swboard == NULL) |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
49 { |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
50 slplink->swboard = msn_session_get_swboard(slplink->session, |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
51 slplink->remote_user, MSN_SB_FLAG_FT); |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
52 |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
53 g_return_if_fail(slplink->swboard != NULL); |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
54 |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
55 /* If swboard is destroyed we will be too */ |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
56 slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
57 } |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
58 |
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
59 msn_switchboard_send_msg(slplink->swboard, msg, TRUE); |
31393
b4285ea42b6e
msn_message_destroy() calls msn_message_unref() if refcount>0. This is
Mark Doliner <mark@kingant.net>
parents:
31376
diff
changeset
|
60 msn_message_unref(msg); |
31236
37474bb06bad
Add support in SBConn to send parts instead of messages.
masca@cpw.pidgin.im
parents:
31233
diff
changeset
|
61 } |
31253
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
62 |
31256
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
63 /** Called when a message times out. */ |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
64 static void |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
65 msg_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
66 { |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
67 MsnMessage *msg; |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
68 |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
69 msg = trans->data; |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
70 |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
71 msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_TIMEOUT); |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
72 } |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
73 |
31253
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
74 static void |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
75 release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
76 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
77 MsnCmdProc *cmdproc; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
78 MsnTransaction *trans; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
79 char *payload; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
80 gsize payload_len; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
81 char flag; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
82 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
83 g_return_if_fail(swboard != NULL); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
84 g_return_if_fail(msg != NULL); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
85 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
86 cmdproc = swboard->cmdproc; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
87 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
88 payload = msn_message_gen_payload(msg, &payload_len); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
89 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
90 if (purple_debug_is_verbose()) { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
91 purple_debug_info("msn", "SB length:{%" G_GSIZE_FORMAT "}\n", payload_len); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
92 msn_message_show_readable(msg, "SB SEND", FALSE); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
93 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
94 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
95 flag = msn_message_get_flag(msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
96 trans = msn_transaction_new(cmdproc, "MSG", "%c %" G_GSIZE_FORMAT, |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
97 flag, payload_len); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
98 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
99 /* Data for callbacks */ |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
100 msn_transaction_set_data(trans, msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
101 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
102 if (flag != 'U') { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
103 if (msg->type == MSN_MSG_TEXT) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
104 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
105 msg->ack_ref = TRUE; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
106 msn_message_ref(msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
107 swboard->ack_list = g_list_append(swboard->ack_list, msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
108 msn_transaction_set_timeout_cb(trans, msg_timeout); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
109 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
110 else if (msg->type == MSN_MSG_SLP) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
111 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
112 msg->ack_ref = TRUE; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
113 msn_message_ref(msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
114 swboard->ack_list = g_list_append(swboard->ack_list, msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
115 msn_transaction_set_timeout_cb(trans, msg_timeout); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
116 #if 0 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
117 if (msg->ack_cb != NULL) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
118 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
119 msn_transaction_add_cb(trans, "ACK", msg_ack); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
120 msn_transaction_add_cb(trans, "NAK", msg_nak); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
121 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
122 #endif |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
123 } |
32399
f83dc631c73b
'U' messages don't get ack'd, so they shouldn't be saved.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31590
diff
changeset
|
124 } else { |
f83dc631c73b
'U' messages don't get ack'd, so they shouldn't be saved.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31590
diff
changeset
|
125 msn_transaction_set_saveable(trans, FALSE); |
31253
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
126 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
127 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
128 trans->payload = payload; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
129 trans->payload_len = payload_len; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
130 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
131 msn_cmdproc_send_trans(cmdproc, trans); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
132 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
133 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
134 static void |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
135 queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
136 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
137 g_return_if_fail(swboard != NULL); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
138 g_return_if_fail(msg != NULL); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
139 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
140 purple_debug_info("msn", "Appending message to queue.\n"); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
141 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
142 g_queue_push_tail(swboard->msg_queue, msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
143 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
144 msn_message_ref(msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
145 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
146 |
31256
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
147 void |
ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
masca@cpw.pidgin.im
parents:
31253
diff
changeset
|
148 msn_sbconn_process_queue(MsnSwitchBoard *swboard) |
31253
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
149 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
150 MsnMessage *msg; |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
151 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
152 g_return_if_fail(swboard != NULL); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
153 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
154 purple_debug_info("msn", "Processing queue\n"); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
155 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
156 while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
157 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
158 purple_debug_info("msn", "Sending message\n"); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
159 release_msg(swboard, msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
160 msn_message_unref(msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
161 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
162 } |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
163 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
164 void |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
165 msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
166 gboolean queue) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
167 { |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
168 g_return_if_fail(swboard != NULL); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
169 g_return_if_fail(msg != NULL); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
170 |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
171 purple_debug_info("msn", "switchboard send msg..\n"); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
172 if (msn_switchboard_can_send(swboard)) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
173 release_msg(swboard, msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
174 else if (queue) |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
175 queue_msg(swboard, msg); |
5904070c0019
Move sending messages via SB to SBConn.
masca@cpw.pidgin.im
parents:
31246
diff
changeset
|
176 } |