Wed, 20 Aug 2008 21:11:56 +0000
MSN Interoperability, add, remove buddies, change group, send im, etc
| 9278 | 1 | /* |
| 15884 | 2 | * purple |
| 9278 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 9278 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * 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:
19534
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 9278 | 21 | * |
| 22 | */ | |
| 23 | ||
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
24 | #include "internal.h" |
| 9278 | 25 | #include "prpl.h" |
| 9279 | 26 | #include "util.h" |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
27 | #include "debug.h" |
| 9278 | 28 | |
| 29 | #include "yahoo_friend.h" | |
| 30 | ||
| 9283 | 31 | static YahooFriend *yahoo_friend_new(void) |
| 9278 | 32 | { |
| 33 | YahooFriend *ret; | |
| 34 | ||
| 35 | ret = g_new0(YahooFriend, 1); | |
| 36 | ret->status = YAHOO_STATUS_OFFLINE; | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
37 | ret->presence = YAHOO_PRESENCE_DEFAULT; |
| 9278 | 38 | |
| 39 | return ret; | |
| 40 | } | |
| 41 | ||
| 15884 | 42 | YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name) |
| 9279 | 43 | { |
| 44 | struct yahoo_data *yd; | |
| 45 | const char *norm; | |
| 46 | ||
| 47 | g_return_val_if_fail(gc != NULL, NULL); | |
| 48 | g_return_val_if_fail(gc->proto_data != NULL, NULL); | |
| 49 | ||
| 50 | yd = gc->proto_data; | |
| 15884 | 51 | norm = purple_normalize(purple_connection_get_account(gc), name); |
| 9279 | 52 | |
| 53 | return g_hash_table_lookup(yd->friends, norm); | |
| 54 | } | |
| 55 | ||
| 15884 | 56 | YahooFriend *yahoo_friend_find_or_new(PurpleConnection *gc, const char *name) |
| 9279 | 57 | { |
| 58 | YahooFriend *f; | |
| 59 | struct yahoo_data *yd; | |
| 60 | const char *norm; | |
| 61 | ||
| 62 | g_return_val_if_fail(gc != NULL, NULL); | |
| 63 | g_return_val_if_fail(gc->proto_data != NULL, NULL); | |
| 64 | ||
| 65 | yd = gc->proto_data; | |
| 15884 | 66 | norm = purple_normalize(purple_connection_get_account(gc), name); |
| 9279 | 67 | |
| 68 | f = g_hash_table_lookup(yd->friends, norm); | |
| 69 | if (!f) { | |
| 70 | f = yahoo_friend_new(); | |
| 71 | g_hash_table_insert(yd->friends, g_strdup(norm), f); | |
| 72 | } | |
| 73 | ||
| 74 | return f; | |
| 75 | } | |
| 76 | ||
| 9281 | 77 | void yahoo_friend_set_ip(YahooFriend *f, const char *ip) |
| 78 | { | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
79 | g_free(f->ip); |
| 9281 | 80 | f->ip = g_strdup(ip); |
| 81 | } | |
| 82 | ||
| 83 | const char *yahoo_friend_get_ip(YahooFriend *f) | |
| 84 | { | |
| 85 | return f->ip; | |
| 86 | } | |
| 87 | ||
| 9283 | 88 | void yahoo_friend_set_game(YahooFriend *f, const char *game) |
| 89 | { | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
90 | g_free(f->game); |
| 9283 | 91 | |
| 92 | if (game) | |
| 93 | f->game = g_strdup(game); | |
| 94 | else | |
| 95 | f->game = NULL; | |
| 96 | } | |
| 97 | ||
| 98 | const char *yahoo_friend_get_game(YahooFriend *f) | |
| 99 | { | |
| 100 | return f->game; | |
| 101 | } | |
| 102 | ||
| 103 | void yahoo_friend_set_status_message(YahooFriend *f, char *msg) | |
| 104 | { | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
105 | g_free(f->msg); |
| 9283 | 106 | |
| 107 | f->msg = msg; | |
| 108 | } | |
| 109 | ||
| 110 | const char *yahoo_friend_get_status_message(YahooFriend *f) | |
| 111 | { | |
| 112 | return f->msg; | |
| 113 | } | |
| 114 | ||
| 9284 | 115 | void yahoo_friend_set_buddy_icon_need_request(YahooFriend *f, gboolean needs) |
| 116 | { | |
| 117 | f->bicon_sent_request = !needs; | |
| 118 | } | |
| 119 | ||
| 120 | gboolean yahoo_friend_get_buddy_icon_need_request(YahooFriend *f) | |
| 121 | { | |
| 122 | return !f->bicon_sent_request; | |
| 123 | } | |
| 124 | ||
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
125 | void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id) |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
126 | { |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
127 | g_free(f->alias_id); |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
128 | f->alias_id = g_strdup(alias_id); |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
129 | } |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
130 | |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
131 | const char *yahoo_friend_get_alias_id(YahooFriend *f) |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
132 | { |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
133 | return f->alias_id; |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
134 | } |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
135 | |
| 9278 | 136 | void yahoo_friend_free(gpointer p) |
| 137 | { | |
| 138 | YahooFriend *f = p; | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
139 | g_free(f->msg); |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
140 | g_free(f->game); |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
141 | g_free(f->ip); |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
142 | g_free(f->alias_id); |
| 9278 | 143 | g_free(f); |
| 144 | } | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
145 | |
| 15884 | 146 | void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
147 | { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
148 | GSList *l = pkt->hash; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
149 | YahooFriend *f; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
150 | char *who = NULL; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
151 | int value = 0; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
152 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
153 | while (l) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
154 | struct yahoo_pair *pair = l->data; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
155 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
156 | switch (pair->key) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
157 | case 7: |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
158 | who = pair->value; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
159 | break; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
160 | case 31: |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
161 | value = strtol(pair->value, NULL, 10); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
162 | break; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
163 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
164 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
165 | l = l->next; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
166 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
167 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
168 | if (value != 1 && value != 2) { |
| 15884 | 169 | purple_debug_error("yahoo", "Received unknown value for presence key: %d\n", value); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
170 | return; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
171 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
172 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
173 | g_return_if_fail(who != NULL); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
174 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
175 | f = yahoo_friend_find(gc, who); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
176 | if (!f) |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
177 | return; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
178 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
179 | if (pkt->service == YAHOO_SERVICE_PRESENCE_PERM) { |
| 15884 | 180 | purple_debug_info("yahoo", "Setting permanent presence for %s to %d.\n", who, (value == 1)); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
181 | /* If setting from perm offline to online when in invisible status, |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
182 | * this has already been taken care of (when the temp status changed) */ |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
183 | if (value == 2 && f->presence == YAHOO_PRESENCE_ONLINE) { |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
184 | } else { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
185 | if (value == 1) /* Setting Perm offline */ |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
186 | f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
187 | else |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
188 | f->presence = YAHOO_PRESENCE_DEFAULT; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
189 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
190 | } else { |
| 15884 | 191 | purple_debug_info("yahoo", "Setting session presence for %s to %d.\n", who, (value == 1)); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
192 | if (value == 1) |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
193 | f->presence = YAHOO_PRESENCE_ONLINE; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
194 | else |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
195 | f->presence = YAHOO_PRESENCE_DEFAULT; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
196 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
197 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
198 | |
| 15884 | 199 | void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
200 | YahooPresenceVisibility presence) |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
201 | { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
202 | struct yahoo_data *yd = gc->proto_data; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
203 | struct yahoo_packet *pkt = NULL; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
204 | YahooFriend *f; |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
205 | const char *thirtyone, *thirteen; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
206 | int service = -1; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
207 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
208 | if (!yd->logged_in) |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
209 | return; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
210 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
211 | f = yahoo_friend_find(gc, name); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
212 | if (!f) |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
213 | return; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
214 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
215 | /* No need to change the value if it is already correct */ |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
216 | if (f->presence == presence) { |
| 15884 | 217 | purple_debug_info("yahoo", "Not setting presence because there are no changes.\n"); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
218 | return; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
219 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
220 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
221 | if (presence == YAHOO_PRESENCE_PERM_OFFLINE) { |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
222 | service = YAHOO_SERVICE_PRESENCE_PERM; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
223 | thirtyone = "1"; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
224 | thirteen = "2"; |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
225 | } else if (presence == YAHOO_PRESENCE_DEFAULT) { |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
226 | if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
227 | service = YAHOO_SERVICE_PRESENCE_PERM; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
228 | thirtyone = "2"; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
229 | thirteen = "2"; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
230 | } else if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
231 | service = YAHOO_SERVICE_PRESENCE_SESSION; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
232 | thirtyone = "2"; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
233 | thirteen = "1"; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
234 | } |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
235 | } else if (presence == YAHOO_PRESENCE_ONLINE) { |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
236 | if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11644
diff
changeset
|
237 | pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM, |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
238 | YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
26348
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
239 | if(f->protocol) |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
240 | yahoo_packet_hash(pkt, "ssssssiss", |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
241 | 1, purple_connection_get_display_name(gc), |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
242 | 31, "2", 13, "2", |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
243 | 302, "319", 300, "319", |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
244 | 7, name, 241, f->protocol, |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
245 | 301, "319", 303, "319"); |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
246 | else |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
247 | yahoo_packet_hash(pkt, "ssssssss", |
| 15884 | 248 | 1, purple_connection_get_display_name(gc), |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
249 | 31, "2", 13, "2", |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
250 | 302, "319", 300, "319", |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
251 | 7, name, |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
252 | 301, "319", 303, "319"); |
|
26348
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
253 | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
254 | yahoo_packet_send_and_free(pkt, yd); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
255 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
256 | |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
257 | service = YAHOO_SERVICE_PRESENCE_SESSION; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
258 | thirtyone = "1"; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
259 | thirteen = "1"; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
260 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
261 | |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
262 | if (service > 0) { |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
263 | pkt = yahoo_packet_new(service, |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
264 | YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
265 | |
|
26348
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
266 | if(f->protocol) |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
267 | yahoo_packet_hash(pkt, "ssssssiss", |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
268 | 1, purple_connection_get_display_name(gc), |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
269 | 31, thirtyone, 13, thirteen, |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
270 | 302, "319", 300, "319", |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
271 | 7, name, 241, f->protocol, |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
272 | 301, "319", 303, "319"); |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
273 | else |
|
3992ecfbc7e2
MSN Interoperability, add, remove buddies, change group, send im, etc
Sulabh Mahajan <sulabh@pidgin.im>
parents:
23689
diff
changeset
|
274 | yahoo_packet_hash(pkt, "ssssssss", |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
275 | 1, purple_connection_get_display_name(gc), |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
276 | 31, thirtyone, 13, thirteen, |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
277 | 302, "319", 300, "319", |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
278 | 7, name, |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
279 | 301, "319", 303, "319"); |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
280 | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
281 | yahoo_packet_send_and_free(pkt, yd); |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
282 | } |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
9284
diff
changeset
|
283 | } |
|
23681
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
284 | |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
285 | void yahoo_friend_set_p2p_status(YahooFriend *f, YahooP2PStatus p2p_status) |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
286 | { |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
287 | f->p2p_status = p2p_status; |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
288 | } |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
289 | |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
290 | YahooP2PStatus yahoo_friend_get_p2p_status(YahooFriend *f) |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
291 | { |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
292 | return f->p2p_status; |
|
f8841c9d3e39
Sending of p2p packet, providing peer with our IP address to make a connection to us.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
22980
diff
changeset
|
293 | } |