Tue, 04 Jan 2011 06:55:30 +0000
Remove trailing whitespace
|
31250
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
2 | * @file tlv.c MSN TLV functions |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 | * purple |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
5 | * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 | * Purple is the legal property of its developers, whose names are too numerous |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
8 | * source distribution. |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 | * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
10 | * This program is free software; you can redistribute it and/or modify |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 | * the Free Software Foundation; either version 2 of the License, or |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
13 | * (at your option) any later version. |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 | * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
15 | * This program is distributed in the hope that it will be useful, |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 | * GNU General Public License for more details. |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 | * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 | * along with this program; if not, write to the Free Software |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 | */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
25 | #include "tlv.h" |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
26 | #include "msnutils.h" |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
27 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
28 | static msn_tlv_t * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
29 | createtlv(guint8 type, guint8 length, guint8 *value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
30 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
31 | msn_tlv_t *ret; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
32 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 | ret = g_new(msn_tlv_t, 1); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
34 | ret->type = type; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
35 | ret->length = length; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
36 | ret->value = value; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
37 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
38 | return ret; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
39 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
40 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
41 | static void |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
42 | freetlv(msn_tlv_t *oldtlv) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
43 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
44 | g_free(oldtlv->value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
45 | g_free(oldtlv); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
46 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
47 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
48 | static GSList * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
49 | msn_tlv_read(GSList *list, char *bs, size_t *bs_len) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
50 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
51 | guint8 type, length; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
52 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
53 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
54 | type = msn_read8(bs); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
55 | length = msn_read8(bs); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
56 | *bs_len -= 2; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
57 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
58 | if (length > *bs_len) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
59 | msn_tlvlist_free(list); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
60 | return NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
61 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
62 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
63 | tlv = createtlv(type, length, NULL); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
64 | if (length > 0) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
65 | tlv->value = g_memdup(bs, length); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
66 | if (!tlv->value) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
67 | freetlv(tlv); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
68 | msn_tlvlist_free(list); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
69 | return NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
70 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
71 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
72 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
73 | *bs_len -= length; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
74 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
75 | return g_slist_prepend(list, tlv); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
76 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
77 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
78 | GSList * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
79 | msn_tlvlist_read(char *bs, size_t bs_len) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
80 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
81 | GSList *list = NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
82 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
83 | while (bs_len > 0) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
84 | list = msn_tlv_read(list, bs, &bs_len); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
85 | if (list == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
86 | return NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
87 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
88 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
89 | return g_slist_reverse(list); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
90 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
91 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
92 | GSList *msn_tlvlist_copy(GSList *orig) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
93 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
94 | GSList *new = NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
95 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
96 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
97 | while (orig != NULL) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
98 | tlv = orig->data; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
99 | msn_tlvlist_add_raw(&new, tlv->type, tlv->length, (const char *)tlv->value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
100 | orig = orig->next; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
101 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
102 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
103 | return new; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
104 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
105 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
106 | gboolean |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
107 | msn_tlvlist_equal(GSList *one, GSList *two) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
108 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
109 | while (one && two) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
110 | msn_tlv_t *a = one->data; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
111 | msn_tlv_t *b = two->data; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
112 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
113 | if (a->type != b->type) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
114 | return FALSE; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
115 | else if (a->length != b->length) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
116 | return FALSE; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
117 | else if (!a->value && b->value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
118 | return FALSE; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
119 | else if (a->value && !b->value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
120 | return FALSE; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
121 | else if (a->value && b->value && memcmp(a->value, b->value, a->length) != 0) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
122 | return FALSE; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
123 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
124 | one = one->next; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
125 | two = two->next; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
126 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
127 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
128 | return one == two; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
129 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
130 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
131 | void |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
132 | msn_tlvlist_free(GSList *list) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
133 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
134 | while (list != NULL) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
135 | freetlv(list->data); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
136 | list = g_slist_delete_link(list, list); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
137 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
138 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
139 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
140 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
141 | msn_tlvlist_count(GSList *list) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
142 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
143 | return g_slist_length(list); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
144 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
145 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
146 | size_t |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
147 | msn_tlvlist_size(GSList *list) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
148 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
149 | int size; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
150 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
151 | if (list == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
152 | return 0; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
153 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
154 | for (size = 0; list; list = list->next) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
155 | size += (2 + ((msn_tlv_t *)list->data)->length); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
156 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
157 | return size; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
158 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
159 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
160 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
161 | msn_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const char *value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
162 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
163 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
164 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
165 | if (list == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
166 | return 0; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
167 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
168 | tlv = createtlv(type, length, NULL); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
169 | if (length > 0) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
170 | tlv->value = g_memdup(value, length); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
171 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
172 | *list = g_slist_append(*list, tlv); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
173 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
174 | return tlv->length; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
175 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
176 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
177 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
178 | msn_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
179 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
180 | char v8[1]; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
181 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
182 | msn_write8(v8, value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
184 | return msn_tlvlist_add_raw(list, type, 1, v8); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
185 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
186 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
187 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
188 | msn_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
189 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
190 | char v16[2]; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
191 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
192 | msn_write16be(v16, value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
193 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
194 | return msn_tlvlist_add_raw(list, type, 2, v16); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
195 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
196 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
197 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
198 | msn_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
200 | char v32[4]; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
202 | msn_write32be(v32, value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
203 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
204 | return msn_tlvlist_add_raw(list, type, 4, v32); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
205 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
206 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
207 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
208 | msn_tlvlist_add_str(GSList **list, const guint16 type, const char *value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
209 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
210 | return msn_tlvlist_add_raw(list, type, strlen(value), value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
211 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
212 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
213 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
214 | msn_tlvlist_add_empty(GSList **list, const guint16 type) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
215 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
216 | return msn_tlvlist_add_raw(list, type, 0, NULL); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
217 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
218 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
219 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
220 | msn_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 length, const char *value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
221 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
222 | GSList *cur; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
223 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
224 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
225 | if (list == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
226 | return 0; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
227 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
228 | for (cur = *list; cur != NULL; cur = cur->next) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
229 | tlv = cur->data; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
230 | if (tlv->type == type) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
231 | break; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
232 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
233 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
234 | if (cur == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
235 | /* TLV does not exist, so add a new one */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
236 | return msn_tlvlist_add_raw(list, type, length, value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
237 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
238 | g_free(tlv->value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
239 | tlv->length = length; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
240 | if (length > 0) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
241 | tlv->value = g_memdup(value, length); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
242 | } else |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
243 | tlv->value = NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
244 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
245 | return length; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
246 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
247 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
248 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
249 | msn_tlvlist_replace_str(GSList **list, const guint16 type, const char *str) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
250 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
251 | return msn_tlvlist_replace_raw(list, type, strlen(str), str); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
252 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
253 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
254 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
255 | msn_tlvlist_replace_empty(GSList **list, const guint16 type) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
256 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
257 | return msn_tlvlist_replace_raw(list, type, 0, NULL); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
258 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
259 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
260 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
261 | msn_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
262 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
263 | char v8[1]; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
264 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
265 | msn_write8(v8, value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
266 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
267 | return msn_tlvlist_replace_raw(list, type, 1, v8); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
268 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
269 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31250
diff
changeset
|
270 | int |
|
31250
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
271 | msn_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
272 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
273 | char v32[4]; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
274 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
275 | msn_write32be(v32, value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
276 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
277 | return msn_tlvlist_replace_raw(list, type, 4, v32); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
278 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
279 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
280 | void |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
281 | msn_tlvlist_remove(GSList **list, const guint16 type) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
282 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
283 | GSList *cur, *next; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
284 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
285 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
286 | if (list == NULL || *list == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
287 | return; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
288 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
289 | cur = *list; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
290 | while (cur != NULL) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
291 | tlv = cur->data; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
292 | next = cur->next; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
293 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
294 | if (tlv->type == type) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
295 | /* Delete this TLV */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
296 | *list = g_slist_delete_link(*list, cur); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
297 | g_free(tlv->value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
298 | g_free(tlv); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
299 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
300 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
301 | cur = next; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
302 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
303 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
304 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
305 | #if 0 |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
306 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
307 | msn_tlvlist_write(ByteStream *bs, GSList **list) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
308 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
309 | int goodbuflen; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
310 | GSList *cur; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
311 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
312 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
313 | /* do an initial run to test total length */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
314 | goodbuflen = msn_tlvlist_size(*list); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
315 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
316 | if (goodbuflen > byte_stream_bytes_left(bs)) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
317 | return 0; /* not enough buffer */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
318 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
319 | /* do the real write-out */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
320 | for (cur = *list; cur; cur = cur->next) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
321 | tlv = cur->data; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
322 | byte_stream_put16(bs, tlv->type); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
323 | byte_stream_put16(bs, tlv->length); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
324 | if (tlv->length > 0) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
325 | byte_stream_putraw(bs, tlv->value, tlv->length); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
326 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
327 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
328 | return 1; /* TODO: This is a nonsensical return */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
329 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
330 | #endif |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
331 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
332 | msn_tlv_t * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
333 | msn_tlv_gettlv(GSList *list, const guint16 type, const int nth) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
334 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
335 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
336 | int i; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
337 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
338 | for (i = 0; list != NULL; list = list->next) { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
339 | tlv = list->data; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
340 | if (tlv->type == type) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
341 | i++; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
342 | if (i >= nth) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
343 | return tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
344 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
345 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
346 | return NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
347 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
348 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
349 | int |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
350 | msn_tlv_getlength(GSList *list, const guint16 type, const int nth) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
351 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
352 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
353 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
354 | tlv = msn_tlv_gettlv(list, type, nth); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
355 | if (tlv == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
356 | return -1; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
357 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
358 | return tlv->length; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
359 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
360 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
361 | char * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
362 | msn_tlv_getvalue_as_string(msn_tlv_t *tlv) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
363 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
364 | char *ret; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
365 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
366 | ret = g_malloc(tlv->length + 1); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
367 | memcpy(ret, tlv->value, tlv->length); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
368 | ret[tlv->length] = '\0'; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
369 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
370 | return ret; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
371 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
372 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
373 | char * |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
374 | msn_tlv_getstr(GSList *list, const guint16 type, const int nth) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
375 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
376 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
377 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
378 | tlv = msn_tlv_gettlv(list, type, nth); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
379 | if (tlv == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
380 | return NULL; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
381 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
382 | return msn_tlv_getvalue_as_string(tlv); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
383 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
384 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
385 | guint8 |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
386 | msn_tlv_get8(GSList *list, const guint16 type, const int nth) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
387 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
388 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
389 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
390 | tlv = msn_tlv_gettlv(list, type, nth); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
391 | if (tlv == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
392 | return 0; /* erm */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
393 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
394 | return msn_read8((const char *)tlv->value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
395 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
396 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
397 | guint16 |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
398 | msn_tlv_get16(GSList *list, const guint16 type, const int nth) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
399 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
400 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
401 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
402 | tlv = msn_tlv_gettlv(list, type, nth); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
403 | if (tlv == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
404 | return 0; /* erm */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
405 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
406 | return msn_read16be((const char *)tlv->value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
407 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
408 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
409 | guint32 |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
410 | msn_tlv_get32(GSList *list, const guint16 type, const int nth) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
411 | { |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
412 | msn_tlv_t *tlv; |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
413 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
414 | tlv = msn_tlv_gettlv(list, type, nth); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
415 | if (tlv == NULL) |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
416 | return 0; /* erm */ |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
417 | |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
418 | return msn_read32be((const char *)tlv->value); |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
419 | } |
|
cf0af85538c0
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
420 |