libpurple/protocols/msn/object.c

Wed, 15 Dec 2010 22:04:08 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Wed, 15 Dec 2010 22:04:08 +0000
changeset 31237
9c2341bd9199
parent 31136
643ef83b4c67
child 32312
44c2bc252f60
permissions
-rw-r--r--

Fix typo

9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
1 /**
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
2 * @file object.c MSNObject API
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15870
diff changeset
4 * purple
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
5 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15870
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
9198
e8eb6d5eb9eb [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
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
8 * source distribution.
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
9 *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
13 * (at your option) any later version.
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
14 *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
19 *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16538
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
23 */
28981
4e3922ab4844 Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents: 23441
diff changeset
24
4e3922ab4844 Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents: 23441
diff changeset
25 #include "msn.h"
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
26 #include "object.h"
15049
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
27 #include "debug.h"
22653
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
28 /* Sha1 stuff */
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
29 #include "cipher.h"
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
30 /* Base64 stuff */
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
31 #include "util.h"
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
32
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
33 #define GET_STRING_TAG(field, id) \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
34 if ((tag = strstr(str, id "=\"")) != NULL) \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
35 { \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
36 tag += strlen(id "=\""); \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
37 c = strchr(tag, '"'); \
10116
054b064145a1 [gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10093
diff changeset
38 if (c != NULL) \
054b064145a1 [gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10093
diff changeset
39 { \
054b064145a1 [gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10093
diff changeset
40 if (obj->field != NULL) \
054b064145a1 [gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10093
diff changeset
41 g_free(obj->field); \
054b064145a1 [gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10093
diff changeset
42 obj->field = g_strndup(tag, c - tag); \
054b064145a1 [gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10093
diff changeset
43 } \
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
44 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
45
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
46 #define GET_INT_TAG(field, id) \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
47 if ((tag = strstr(str, id "=\"")) != NULL) \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
48 { \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
49 char buf[16]; \
9823
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
50 size_t offset; \
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
51 tag += strlen(id "=\""); \
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
52 c = strchr(tag, '"'); \
9823
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
53 if (c != NULL) \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
54 { \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
55 memset(buf, 0, sizeof(buf)); \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
56 offset = c - tag; \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
57 if (offset >= sizeof(buf)) \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
58 offset = sizeof(buf) - 1; \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
59 strncpy(buf, tag, offset); \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
60 obj->field = atoi(buf); \
676d416efa7e [gaim-migrate @ 10694]
Mark Doliner <markdoliner@pidgin.im>
parents: 9776
diff changeset
61 } \
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
62 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
63
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
64 static GList *local_objs;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
65
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
66 MsnObject *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
67 msn_object_new(void)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
68 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
69 MsnObject *obj;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
70
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
71 obj = g_new0(MsnObject, 1);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
72
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
73 msn_object_set_type(obj, MSN_OBJECT_UNKNOWN);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
74 msn_object_set_friendly(obj, "AAA=");
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
75
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
76 return obj;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
77 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
78
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
79 MsnObject *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
80 msn_object_new_from_string(const char *str)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
81 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
82 MsnObject *obj;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
83 char *tag, *c;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
84
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
85 g_return_val_if_fail(str != NULL, NULL);
14419
b2710bc260e8 [gaim-migrate @ 17063]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
86
b2710bc260e8 [gaim-migrate @ 17063]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
87 if (strncmp(str, "<msnobj ", 8))
b2710bc260e8 [gaim-migrate @ 17063]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
88 return NULL;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
89
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
90 obj = msn_object_new();
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
91
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
92 GET_STRING_TAG(creator, "Creator");
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
93 GET_INT_TAG(size, "Size");
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
94 GET_INT_TAG(type, "Type");
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
95 GET_STRING_TAG(location, "Location");
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
96 GET_STRING_TAG(friendly, "Friendly");
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
97 GET_STRING_TAG(sha1d, "SHA1D");
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
98 GET_STRING_TAG(sha1c, "SHA1C");
30580
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
99 GET_STRING_TAG(url, "Url");
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
100 GET_STRING_TAG(url1, "Url1");
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
101
9776
18190cb3c009 [gaim-migrate @ 10644]
Daniel Atallah <datallah@pidgin.im>
parents: 9198
diff changeset
102 /* If we are missing any of the required elements then discard the object */
18190cb3c009 [gaim-migrate @ 10644]
Daniel Atallah <datallah@pidgin.im>
parents: 9198
diff changeset
103 if (obj->creator == NULL || obj->size == 0 || obj->type == 0
30580
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
104 || obj->sha1d == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15870
diff changeset
105 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
9776
18190cb3c009 [gaim-migrate @ 10644]
Daniel Atallah <datallah@pidgin.im>
parents: 9198
diff changeset
106 msn_object_destroy(obj);
30580
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
107 return NULL;
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
108 }
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
109
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
110 if (obj->location == NULL || obj->friendly == NULL) {
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
111 /* Location/friendly are required for non-buddyicon objects */
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
112 if (obj->type != MSN_OBJECT_USERTILE) {
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
113 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
114 msn_object_destroy(obj);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
115 return NULL;
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
116 /* Buddy icon object can contain Url/Url1 instead */
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
117 } else if (obj->url == NULL || obj->url1 == NULL) {
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
118 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
119 msn_object_destroy(obj);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
120 return NULL;
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
121 }
9776
18190cb3c009 [gaim-migrate @ 10644]
Daniel Atallah <datallah@pidgin.im>
parents: 9198
diff changeset
122 }
18190cb3c009 [gaim-migrate @ 10644]
Daniel Atallah <datallah@pidgin.im>
parents: 9198
diff changeset
123
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
124 return obj;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
125 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
126
22653
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
127 MsnObject*
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
128 msn_object_new_from_image(PurpleStoredImage *img, const char *location,
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
129 const char *creator, MsnObjectType type)
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
130 {
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
131 MsnObject *msnobj;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
132
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
133 PurpleCipherContext *ctx;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
134 char *buf;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
135 gconstpointer data;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
136 size_t size;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
137 char *base64;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
138 unsigned char digest[20];
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
139
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
140 msnobj = NULL;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
141
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
142 if (img == NULL)
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
143 return msnobj;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
144
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
145 size = purple_imgstore_get_size(img);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
146 data = purple_imgstore_get_data(img);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
147
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
148 /* New object */
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
149 msnobj = msn_object_new();
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
150 msn_object_set_local(msnobj);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
151 msn_object_set_type(msnobj, type);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
152 msn_object_set_location(msnobj, location);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
153 msn_object_set_creator(msnobj, creator);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
154
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
155 msn_object_set_image(msnobj, img);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
156
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
157 /* Compute the SHA1D field. */
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
158 memset(digest, 0, sizeof(digest));
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
159
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
160 ctx = purple_cipher_context_new_by_name("sha1", NULL);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
161 purple_cipher_context_append(ctx, data, size);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
162 purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
163
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
164 base64 = purple_base64_encode(digest, sizeof(digest));
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
165 msn_object_set_sha1d(msnobj, base64);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
166 g_free(base64);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
167
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
168 msn_object_set_size(msnobj, size);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
169
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
170 /* Compute the SHA1C field. */
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
171 buf = g_strdup_printf(
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
172 "Creator%sSize%dType%dLocation%sFriendly%sSHA1D%s",
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
173 msn_object_get_creator(msnobj),
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
174 msn_object_get_size(msnobj),
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
175 msn_object_get_type(msnobj),
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
176 msn_object_get_location(msnobj),
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
177 msn_object_get_friendly(msnobj),
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
178 msn_object_get_sha1d(msnobj));
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
179
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
180 memset(digest, 0, sizeof(digest));
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
181
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
182 purple_cipher_context_reset(ctx, NULL);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
183 purple_cipher_context_append(ctx, (const guchar *)buf, strlen(buf));
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
184 purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
185 purple_cipher_context_destroy(ctx);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
186 g_free(buf);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
187
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
188 base64 = purple_base64_encode(digest, sizeof(digest));
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
189 msn_object_set_sha1c(msnobj, base64);
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
190 g_free(base64);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22653
diff changeset
191
22653
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
192 return msnobj;
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
193 }
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21067
diff changeset
194
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
195 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
196 msn_object_destroy(MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
197 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
198 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
199
15049
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
200 g_free(obj->creator);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
201 g_free(obj->location);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
202 g_free(obj->friendly);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
203 g_free(obj->sha1d);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
204 g_free(obj->sha1c);
31136
643ef83b4c67 Fix a lot more leaks, some old, some new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31076
diff changeset
205 g_free(obj->url);
643ef83b4c67 Fix a lot more leaks, some old, some new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31076
diff changeset
206 g_free(obj->url1);
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
207
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
208 purple_imgstore_unref(obj->img);
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
209
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
210 if (obj->local)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
211 local_objs = g_list_remove(local_objs, obj);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
212
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
213 g_free(obj);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
214 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
215
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
216 char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
217 msn_object_to_string(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
218 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
219 char *str;
15870
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
220 const char *sha1c;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
221
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
222 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
223
15870
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
224 sha1c = msn_object_get_sha1c(obj);
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
225
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
226 str = g_strdup_printf("<msnobj Creator=\"%s\" Size=\"%d\" Type=\"%d\" "
15870
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
227 "Location=\"%s\" Friendly=\"%s\" SHA1D=\"%s\""
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
228 "%s%s%s/>",
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
229 msn_object_get_creator(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
230 msn_object_get_size(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
231 msn_object_get_type(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
232 msn_object_get_location(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
233 msn_object_get_friendly(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
234 msn_object_get_sha1d(obj),
15870
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
235 sha1c ? " SHA1C=\"" : "",
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
236 sha1c ? sha1c : "",
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
237 sha1c ? "\"" : "");
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
238
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
239 return str;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
240 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
241
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
242 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
243 msn_object_set_creator(MsnObject *obj, const char *creator)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
244 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
245 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
246
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
247 g_free(obj->creator);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
248 obj->creator = g_strdup(creator);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
249 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
250
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
251 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
252 msn_object_set_size(MsnObject *obj, int size)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
253 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
254 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
255
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
256 obj->size = size;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
257 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
258
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
259 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
260 msn_object_set_type(MsnObject *obj, MsnObjectType type)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
261 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
262 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
263
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
264 obj->type = type;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
265 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
266
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
267 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
268 msn_object_set_location(MsnObject *obj, const char *location)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
269 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
270 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
271
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
272 g_free(obj->location);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
273 obj->location = g_strdup(location);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
274 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
275
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
276 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
277 msn_object_set_friendly(MsnObject *obj, const char *friendly)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
278 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
279 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
280
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
281 g_free(obj->friendly);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
282 obj->friendly = g_strdup(friendly);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
283 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
284
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
285 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
286 msn_object_set_sha1d(MsnObject *obj, const char *sha1d)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
287 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
288 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
289
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
290 g_free(obj->sha1d);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
291 obj->sha1d = g_strdup(sha1d);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
292 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
293
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
294 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
295 msn_object_set_sha1c(MsnObject *obj, const char *sha1c)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
296 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
297 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
298
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
299 g_free(obj->sha1c);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
300 obj->sha1c = g_strdup(sha1c);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
301 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
302
30580
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
303 void
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
304 msn_object_set_url(MsnObject *obj, const char *url)
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
305 {
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
306 g_return_if_fail(obj != NULL);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
307
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
308 g_free(obj->url);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
309 obj->url = g_strdup(url);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
310 }
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
311
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
312 void
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
313 msn_object_set_url1(MsnObject *obj, const char *url)
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
314 {
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
315 g_return_if_fail(obj != NULL);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
316
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
317 g_free(obj->url1);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
318 obj->url1 = g_strdup(url);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
319 }
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
320
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
321 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
322 msn_object_get_creator(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
323 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
324 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
325
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
326 return obj->creator;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
327 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
328
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
329 int
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
330 msn_object_get_size(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
331 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
332 g_return_val_if_fail(obj != NULL, 0);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
333
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
334 return obj->size;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
335 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
336
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
337 MsnObjectType
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
338 msn_object_get_type(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
339 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
340 g_return_val_if_fail(obj != NULL, MSN_OBJECT_UNKNOWN);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
341
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
342 return obj->type;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
343 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
344
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
345 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
346 msn_object_get_location(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
347 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
348 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
349
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
350 return obj->location;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
351 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
352
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
353 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
354 msn_object_get_friendly(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
355 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
356 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
357
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
358 return obj->friendly;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
359 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
360
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
361 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
362 msn_object_get_sha1d(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
363 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
364 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
365
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
366 return obj->sha1d;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
367 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
368
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
369 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
370 msn_object_get_sha1c(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
371 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
372 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
373
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
374 return obj->sha1c;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
375 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
376
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
377 const char *
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
378 msn_object_get_sha1(const MsnObject *obj)
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
379 {
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
380 g_return_val_if_fail(obj != NULL, NULL);
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
381
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
382 if(obj->sha1c != NULL) {
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
383 return obj->sha1c;
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
384 } else {
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
385 return obj->sha1d;
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
386 }
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
387 }
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
388
30580
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
389 const char *
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
390 msn_object_get_url(const MsnObject *obj)
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
391 {
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
392 g_return_val_if_fail(obj != NULL, NULL);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
393
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
394 return obj->url;
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
395 }
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
396
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
397 const char *
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
398 msn_object_get_url1(const MsnObject *obj)
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
399 {
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
400 g_return_val_if_fail(obj != NULL, NULL);
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
401
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
402 return obj->url1;
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
403 }
bb4da51c1259 Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28981
diff changeset
404
31063
7df334acf090 Don't destroy our local object storing the display picture when a NLN command show us the same MsnObject.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 28981
diff changeset
405 MsnObject *
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
406 msn_object_find_local(const char *sha1)
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
407 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
408 GList *l;
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
409
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
410 g_return_val_if_fail(sha1 != NULL, NULL);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
411
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
412 for (l = local_objs; l != NULL; l = l->next)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
413 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
414 MsnObject *local_obj = l->data;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
415
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
416 if (!strcmp(msn_object_get_sha1(local_obj), sha1))
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
417 return local_obj;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
418 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
419
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
420 return NULL;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
421
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
422 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
423
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
424 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
425 msn_object_set_local(MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
426 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
427 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
428
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
429 obj->local = TRUE;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
430
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
431 local_objs = g_list_append(local_objs, obj);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
432 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
433
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
434 void
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
435 msn_object_set_image(MsnObject *obj, PurpleStoredImage *img)
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
436 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
437 g_return_if_fail(obj != NULL);
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
438 g_return_if_fail(img != NULL);
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
439
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
440 /* obj->local = TRUE; */
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
441
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
442 purple_imgstore_unref(obj->img);
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
443 obj->img = purple_imgstore_ref(img);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
444 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
445
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
446 PurpleStoredImage *
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
447 msn_object_get_image(const MsnObject *obj)
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
448 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
449 MsnObject *local_obj;
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
450
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
451 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
452
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
453 local_obj = msn_object_find_local(msn_object_get_sha1(obj));
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
454
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
455 if (local_obj != NULL)
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16090
diff changeset
456 return local_obj->img;
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
457
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
458 return NULL;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
459 }

mercurial