libpurple/protocols/msn/object.c

Sat, 11 Jul 2015 14:45:46 -0400

author
James Geboski <jgeboski@gmail.com>
date
Sat, 11 Jul 2015 14:45:46 -0400
branch
facebook
changeset 37293
dc35ba3e7fac
parent 35827
c7c855c36c9b
child 37426
6fd4989b77e4
permissions
-rw-r--r--

facebook: fixed all errors being marked as fatal

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 */
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
29 #include "ciphers/sha1hash.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
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);
32312
44c2bc252f60 Be a bit more specific about removing non-local MSN objects, which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31136
diff changeset
106 msn_object_destroy(obj, FALSE);
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);
32312
44c2bc252f60 Be a bit more specific about removing non-local MSN objects, which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31136
diff changeset
114 msn_object_destroy(obj, FALSE);
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
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);
32312
44c2bc252f60 Be a bit more specific about removing non-local MSN objects, which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31136
diff changeset
119 msn_object_destroy(obj, FALSE);
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
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*
35827
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
128 msn_object_new_from_image(PurpleImage *img, const char *location,
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
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
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
133 PurpleHash *hash;
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
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)
35827
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
143 return NULL;
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
144
35827
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
145 size = purple_image_get_size(img);
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
146 data = purple_image_get_data(img);
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
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
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
160 hash = purple_sha1_hash_new();
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
161 purple_hash_append(hash, data, size);
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
162 purple_hash_digest(hash, digest, sizeof(digest));
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
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
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
182 purple_hash_reset(hash);
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
183 purple_hash_append(hash, (const guchar *)buf, strlen(buf));
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
184 purple_hash_digest(hash, digest, sizeof(digest));
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
185 g_object_unref(hash);
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
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
32312
44c2bc252f60 Be a bit more specific about removing non-local MSN objects, which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31136
diff changeset
196 msn_object_destroy(MsnObject *obj, gboolean only_remote)
9193
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
32312
44c2bc252f60 Be a bit more specific about removing non-local MSN objects, which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31136
diff changeset
200 if (only_remote && obj->local)
44c2bc252f60 Be a bit more specific about removing non-local MSN objects, which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31136
diff changeset
201 return;
44c2bc252f60 Be a bit more specific about removing non-local MSN objects, which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31136
diff changeset
202
15049
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
203 g_free(obj->creator);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
204 g_free(obj->location);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
205 g_free(obj->friendly);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
206 g_free(obj->sha1d);
d8749c39e1e4 [gaim-migrate @ 17766]
Daniel Atallah <datallah@pidgin.im>
parents: 14419
diff changeset
207 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
208 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
209 g_free(obj->url1);
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
210
35827
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
211 if (obj->img)
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
212 g_object_unref(obj->img);
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
213
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
214 if (obj->local)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
215 local_objs = g_list_remove(local_objs, obj);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
216
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
217 g_free(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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
220 char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
221 msn_object_to_string(const MsnObject *obj)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
222 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
223 char *str;
15870
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
224 const char *sha1c;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
225
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
226 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
227
15870
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
228 sha1c = msn_object_get_sha1c(obj);
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
229
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
230 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
231 "Location=\"%s\" Friendly=\"%s\" SHA1D=\"%s\""
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
232 "%s%s%s/>",
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
233 msn_object_get_creator(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
234 msn_object_get_size(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
235 msn_object_get_type(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
236 msn_object_get_location(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
237 msn_object_get_friendly(obj),
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
238 msn_object_get_sha1d(obj),
15870
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
239 sha1c ? " SHA1C=\"" : "",
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
240 sha1c ? sha1c : "",
845136ee546d Protection against missing SHA1C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
241 sha1c ? "\"" : "");
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
242
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
243 return str;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
246 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
247 msn_object_set_creator(MsnObject *obj, const char *creator)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
248 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
249 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
250
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
251 g_free(obj->creator);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
252 obj->creator = g_strdup(creator);
9193
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
255 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
256 msn_object_set_size(MsnObject *obj, int 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 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
259
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
260 obj->size = size;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
263 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
264 msn_object_set_type(MsnObject *obj, MsnObjectType 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 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
267
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
268 obj->type = type;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
271 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
272 msn_object_set_location(MsnObject *obj, const char *location)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
273 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
274 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
275
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
276 g_free(obj->location);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
277 obj->location = g_strdup(location);
9193
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
280 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
281 msn_object_set_friendly(MsnObject *obj, const char *friendly)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
282 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
283 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
284
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
285 g_free(obj->friendly);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
286 obj->friendly = g_strdup(friendly);
9193
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
289 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
290 msn_object_set_sha1d(MsnObject *obj, const char *sha1d)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
291 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
292 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
293
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
294 g_free(obj->sha1d);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
295 obj->sha1d = g_strdup(sha1d);
9193
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
298 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
299 msn_object_set_sha1c(MsnObject *obj, const char *sha1c)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
300 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
301 g_return_if_fail(obj != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
302
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
303 g_free(obj->sha1c);
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
304 obj->sha1c = g_strdup(sha1c);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
305 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
306
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
307 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
308 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
309 {
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 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
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 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
313 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
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
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 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
317 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
318 {
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 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
320
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
321 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
322 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
323 }
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
324
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
325 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
326 msn_object_get_creator(const MsnObject *obj)
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 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
329
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
330 return obj->creator;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
333 int
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
334 msn_object_get_size(const MsnObject *obj)
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 g_return_val_if_fail(obj != NULL, 0);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
337
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
338 return obj->size;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
341 MsnObjectType
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
342 msn_object_get_type(const MsnObject *obj)
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 g_return_val_if_fail(obj != NULL, MSN_OBJECT_UNKNOWN);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
345
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
346 return obj->type;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
349 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
350 msn_object_get_location(const MsnObject *obj)
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 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
353
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
354 return obj->location;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
357 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
358 msn_object_get_friendly(const MsnObject *obj)
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 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
361
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
362 return obj->friendly;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
365 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
366 msn_object_get_sha1d(const MsnObject *obj)
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 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
369
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
370 return obj->sha1d;
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
373 const char *
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
374 msn_object_get_sha1c(const MsnObject *obj)
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 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
377
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
378 return obj->sha1c;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
379 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
380
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
381 const char *
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
382 msn_object_get_sha1(const MsnObject *obj)
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
383 {
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
384 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
385
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
386 if(obj->sha1c != NULL) {
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
387 return obj->sha1c;
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
388 } else {
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
389 return obj->sha1d;
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
390 }
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
391 }
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
392
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
393 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
394 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
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 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
397
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 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
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
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 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
402 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
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 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
405
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
406 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
407 }
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
408
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
409 MsnObject *
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
410 msn_object_find_local(const char *sha1)
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 GList *l;
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
413
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
414 g_return_val_if_fail(sha1 != NULL, NULL);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
415
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
416 for (l = local_objs; l != NULL; l = l->next)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
417 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
418 MsnObject *local_obj = l->data;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
419
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
420 if (!strcmp(msn_object_get_sha1(local_obj), sha1))
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
421 return local_obj;
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 return NULL;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
425
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
428 void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
429 msn_object_set_local(MsnObject *obj)
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 g_return_if_fail(obj != NULL);
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 obj->local = TRUE;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
434
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
435 local_objs = g_list_append(local_objs, obj);
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
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
438 void
35827
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
439 msn_object_set_image(MsnObject *obj, PurpleImage *img)
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
440 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
441 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
442 g_return_if_fail(img != NULL);
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
443
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
444 /* obj->local = TRUE; */
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
445
35827
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
446 if (obj->img)
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
447 g_object_unref(obj->img);
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
448 g_object_ref(img);
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
449 obj->img = img;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
450 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
451
35827
c7c855c36c9b imgstore: unref msn
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34567
diff changeset
452 PurpleImage *
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
453 msn_object_get_image(const MsnObject *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 MsnObject *local_obj;
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
456
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
457 g_return_val_if_fail(obj != NULL, NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
458
16090
57832613774a Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
459 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
460
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
461 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
462 return local_obj->img;
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
463
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
464 return NULL;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff changeset
465 }

mercurial