Mercurial > pidgin
annotate libpurple/protocols/msnp9/slpmsg.c @ 24379:f0d5d78e8e47
Make the Send button insensitive when there is no text in the input buffer.
Has a few minor format changes from the original patch by Gabriel.
Fixes #7529.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 13 Nov 2008 05:33:24 +0000 |
parents | a07cfce78345 |
children |
rev | line source |
---|---|
21312
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1 /** |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2 * @file slpmsg.h SLP Message functions |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3 * |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
4 * purple |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
5 * |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
8 * source distribution. |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
9 * |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
14 * |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
19 * |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
23 */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
24 #include "msn.h" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
25 #include "slpmsg.h" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
26 #include "slplink.h" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
27 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
28 /************************************************************************** |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
29 * SLP Message |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
30 **************************************************************************/ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
31 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
32 MsnSlpMessage * |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
33 msn_slpmsg_new(MsnSlpLink *slplink) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
34 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
35 MsnSlpMessage *slpmsg; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
36 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
37 slpmsg = g_new0(MsnSlpMessage, 1); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
38 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
39 #ifdef MSN_DEBUG_SLPMSG |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
40 purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
41 #endif |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
42 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
43 slpmsg->slplink = slplink; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
44 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
45 slplink->slp_msgs = |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
46 g_list_append(slplink->slp_msgs, slpmsg); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
47 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
48 return slpmsg; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
49 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
50 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
51 void |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
52 msn_slpmsg_destroy(MsnSlpMessage *slpmsg) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
53 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
54 MsnSlpLink *slplink; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
55 GList *cur; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
56 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
57 g_return_if_fail(slpmsg != NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
58 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
59 #ifdef MSN_DEBUG_SLPMSG |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
60 purple_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
61 #endif |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
62 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
63 slplink = slpmsg->slplink; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
64 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
65 if (slpmsg->fp != NULL) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
66 fclose(slpmsg->fp); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
67 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
68 purple_imgstore_unref(slpmsg->img); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
69 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
70 /* We don't want to free the data of the PurpleStoredImage, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
71 * but to avoid code duplication, it's sharing buffer. */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
72 if (slpmsg->img == NULL) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
73 g_free(slpmsg->buffer); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
74 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
75 #ifdef MSN_DEBUG_SLP |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
76 /* |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
77 if (slpmsg->info != NULL) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
78 g_free(slpmsg->info); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
79 */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
80 #endif |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
81 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
82 for (cur = slpmsg->msgs; cur != NULL; cur = cur->next) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
83 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
84 /* Something is pointing to this slpmsg, so we should remove that |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
85 * pointer to prevent a crash. */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
86 /* Ex: a user goes offline and after that we receive an ACK */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
87 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
88 MsnMessage *msg = cur->data; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
89 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
90 #ifdef MSN_DEBUG_SLPMSG |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
91 purple_debug_info("msn", "Unlink slpmsg callbacks.\n"); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
92 #endif |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
93 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
94 msg->ack_cb = NULL; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
95 msg->nak_cb = NULL; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
96 msg->ack_data = NULL; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
97 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
98 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
99 slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
100 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
101 g_free(slpmsg); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
102 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
103 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
104 void |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
105 msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
106 long long size) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
107 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
108 /* We can only have one data source at a time. */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
109 g_return_if_fail(slpmsg->buffer == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
110 g_return_if_fail(slpmsg->img == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
111 g_return_if_fail(slpmsg->fp == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
112 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
113 if (body != NULL) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
114 slpmsg->buffer = g_memdup(body, size); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
115 else |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
116 slpmsg->buffer = g_new0(guchar, size); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
117 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
118 slpmsg->size = size; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
119 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
120 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
121 void |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
122 msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
123 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
124 /* We can only have one data source at a time. */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
125 g_return_if_fail(slpmsg->buffer == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
126 g_return_if_fail(slpmsg->img == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
127 g_return_if_fail(slpmsg->fp == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
128 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
129 slpmsg->img = purple_imgstore_ref(img); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
130 slpmsg->buffer = (guchar *)purple_imgstore_get_data(img); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
131 slpmsg->size = purple_imgstore_get_size(img); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
132 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
133 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
134 void |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
135 msn_slpmsg_open_file(MsnSlpMessage *slpmsg, const char *file_name) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
136 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
137 struct stat st; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
138 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
139 /* We can only have one data source at a time. */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
140 g_return_if_fail(slpmsg->buffer == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
141 g_return_if_fail(slpmsg->img == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
142 g_return_if_fail(slpmsg->fp == NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
143 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
144 slpmsg->fp = g_fopen(file_name, "rb"); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
145 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
146 if (g_stat(file_name, &st) == 0) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
147 slpmsg->size = st.st_size; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
148 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
149 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
150 #ifdef MSN_DEBUG_SLP |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
151 void |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
152 msn_slpmsg_show(MsnMessage *msg) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
153 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
154 const char *info; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
155 gboolean text; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
156 guint32 flags; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
157 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
158 text = FALSE; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
159 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
160 flags = GUINT32_TO_LE(msg->msnslp_header.flags); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
161 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
162 switch (flags) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
163 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
164 case 0x0: |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
165 info = "SLP CONTROL"; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
166 text = TRUE; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
167 break; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
168 case 0x2: |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
169 info = "SLP ACK"; break; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
170 case 0x20: |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
171 case 0x1000030: |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
172 info = "SLP DATA"; break; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
173 default: |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
174 info = "SLP UNKNOWN"; break; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
175 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
176 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
177 msn_message_show_readable(msg, info, text); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
178 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
179 #endif |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
180 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
181 MsnSlpMessage * |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
182 msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
183 const char *header, const char *branch, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
184 const char *content_type, const char *content) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
185 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
186 MsnSlpLink *slplink; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
187 MsnSlpMessage *slpmsg; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
188 char *body; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
189 gsize body_len; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
190 gsize content_len; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
191 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
192 g_return_val_if_fail(slpcall != NULL, NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
193 g_return_val_if_fail(header != NULL, NULL); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
194 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
195 slplink = slpcall->slplink; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
196 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
197 /* Let's remember that "content" should end with a 0x00 */ |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
198 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
199 content_len = (content != NULL) ? strlen(content) + 1 : 0; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
200 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
201 body = g_strdup_printf( |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
202 "%s\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
203 "To: <msnmsgr:%s>\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
204 "From: <msnmsgr:%s>\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
205 "Via: MSNSLP/1.0/TLP ;branch={%s}\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
206 "CSeq: %d\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
207 "Call-ID: {%s}\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
208 "Max-Forwards: 0\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
209 "Content-Type: %s\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
210 "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
211 "\r\n", |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
212 header, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
213 slplink->remote_user, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
214 slplink->local_user, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
215 branch, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
216 cseq, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
217 slpcall->id, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
218 content_type, |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
219 content_len); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
220 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
221 body_len = strlen(body); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
222 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
223 if (content_len > 0) |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
224 { |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
225 body_len += content_len; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
226 body = g_realloc(body, body_len); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
227 g_strlcat(body, content, body_len); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
228 } |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
229 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
230 slpmsg = msn_slpmsg_new(slplink); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
231 msn_slpmsg_set_body(slpmsg, body, body_len); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
232 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
233 slpmsg->sip = TRUE; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
234 slpmsg->slpcall = slpcall; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
235 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
236 g_free(body); |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
237 |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
238 return slpmsg; |
a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
239 } |