Tue, 09 Jul 2013 15:48:17 +0530
Renamed buddy list functions to more appropriate/simler names.
* Replaced purple_blist_update_node_icon() with purple_blist_node_update()
* Replaced purple_blist_update_buddy_status() with purple_buddy_update_status()
* Replaced purple_blist_rename_buddy() with purple_buddy_set_name()
* Replaced purple_blist_alias_contact() with purple_contact_set_alias()
* Replaced purple_blist_alias_chat() with purple_chat_set_alias()
* Replaced purple_blist_alias_buddy() with purple_buddy_set_local_alias()
* Replaced purple_blist_server_alias_buddy() with purple_buddy_set_server_alias()
* Replaced purple_blist_rename_group() with purple_group_set_name()
* Replaced purple_blist_merge_contact() with purple_contact_merge()
* Replaced purple_find_buddy_in_group() with purple_blist_find_buddy_in_group()
* Replaced purple_find_buddy() with purple_blist_find_buddy()
* Replaced purple_find_buddies() with purple_blist_find_buddies()
* Replaced purple_find_group() with purple_blist_find_group()
| 9306 | 1 | /* |
| 15884 | 2 | * purple |
| 9306 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 9306 | 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:
18552
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 9306 | 21 | * |
| 22 | */ | |
| 23 | ||
| 24 | #include "internal.h" | |
| 25 | ||
| 26 | #include "account.h" | |
| 27 | #include "accountopt.h" | |
|
34706
02cb08146888
Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents:
34703
diff
changeset
|
28 | #include "buddylist.h" |
| 9306 | 29 | #include "debug.h" |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
30 | #include "http.h" |
| 9306 | 31 | #include "prpl.h" |
| 32 | #include "proxy.h" | |
| 33 | #include "util.h" | |
| 34 | ||
|
27555
afb7cb5c350c
Update for file renames.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27467
diff
changeset
|
35 | #include "libymsg.h" |
| 10392 | 36 | #include "yahoo_packet.h" |
| 9306 | 37 | #include "yahoo_friend.h" |
| 38 | #include "yahoo_picture.h" | |
| 39 | ||
| 40 | ||
| 41 | struct yahoo_fetch_picture_data { | |
| 15884 | 42 | PurpleConnection *gc; |
| 9306 | 43 | char *who; |
| 44 | int checksum; | |
| 45 | }; | |
| 46 | ||
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14321
diff
changeset
|
47 | static void |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
48 | yahoo_fetch_picture_cb(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
49 | gpointer _data) |
| 9306 | 50 | { |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
51 | struct yahoo_fetch_picture_data *d = _data; |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27958
diff
changeset
|
52 | YahooData *yd; |
| 9306 | 53 | |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
54 | yd = purple_connection_get_protocol_data(d->gc); |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
55 | yd->http_reqs = g_slist_remove(yd->http_reqs, http_conn); |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14321
diff
changeset
|
56 | |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
57 | if (!purple_http_response_is_successfull(response)) { |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
58 | purple_debug_error("yahoo", "Fetching buddy icon failed: %s\n", |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
59 | purple_http_response_get_error(response)); |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14321
diff
changeset
|
60 | } else { |
|
16534
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16076
diff
changeset
|
61 | char *checksum = g_strdup_printf("%i", d->checksum); |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
62 | const gchar *pic_data; |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
63 | size_t pic_len; |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
64 | |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
65 | pic_data = purple_http_response_get_data(response, &pic_len); |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
66 | |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
67 | purple_buddy_icons_set_for_user( |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
68 | purple_connection_get_account(d->gc), d->who, |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
69 | g_memdup(pic_data, pic_len), pic_len, checksum); |
|
16534
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16076
diff
changeset
|
70 | g_free(checksum); |
| 9306 | 71 | } |
| 72 | ||
| 73 | g_free(d->who); | |
| 74 | g_free(d); | |
| 75 | } | |
| 76 | ||
| 15884 | 77 | void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 9306 | 78 | { |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27958
diff
changeset
|
79 | YahooData *yd; |
| 9306 | 80 | GSList *l = pkt->hash; |
|
33892
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33424
diff
changeset
|
81 | char *who = NULL; |
| 9306 | 82 | gboolean got_icon_info = FALSE, send_icon_info = FALSE; |
| 83 | char *url = NULL; | |
| 84 | int checksum = 0; | |
| 85 | ||
| 86 | while (l) { | |
| 87 | struct yahoo_pair *pair = l->data; | |
| 88 | ||
| 89 | switch (pair->key) { | |
| 90 | case 1: | |
| 91 | case 4: | |
| 92 | who = pair->value; | |
| 93 | break; | |
|
33892
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33424
diff
changeset
|
94 | case 5: /* us */ |
| 9306 | 95 | break; |
| 96 | case 13: { | |
| 97 | int tmp; | |
| 98 | tmp = strtol(pair->value, NULL, 10); | |
| 99 | if (tmp == 1) { | |
| 100 | send_icon_info = TRUE; | |
| 101 | } else if (tmp == 2) { | |
| 102 | got_icon_info = TRUE; | |
| 103 | } | |
| 104 | break; | |
| 105 | } | |
| 106 | case 20: | |
| 107 | url = pair->value; | |
| 108 | break; | |
| 109 | case 192: | |
| 110 | checksum = strtol(pair->value, NULL, 10); | |
| 111 | break; | |
| 112 | } | |
| 113 | ||
| 114 | l = l->next; | |
| 115 | } | |
| 116 | ||
|
27400
d8c31c7e084d
This should prevent pidgin from crashing, as reported by the ticket #9426.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27361
diff
changeset
|
117 | if (!who) |
|
d8c31c7e084d
This should prevent pidgin from crashing, as reported by the ticket #9426.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27361
diff
changeset
|
118 | return; |
|
d8c31c7e084d
This should prevent pidgin from crashing, as reported by the ticket #9426.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27361
diff
changeset
|
119 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
33892
diff
changeset
|
120 | if (!purple_account_privacy_check(purple_connection_get_account(gc), who)) { |
|
23960
e57706b32d2a
Patch from "Chris G." to extend the yahoo privacy to picture requests to help
Daniel Atallah <datallah@pidgin.im>
parents:
23181
diff
changeset
|
121 | purple_debug_info("yahoo", "Picture packet from %s dropped.\n", who); |
|
e57706b32d2a
Patch from "Chris G." to extend the yahoo privacy to picture requests to help
Daniel Atallah <datallah@pidgin.im>
parents:
23181
diff
changeset
|
122 | return; |
|
e57706b32d2a
Patch from "Chris G." to extend the yahoo privacy to picture requests to help
Daniel Atallah <datallah@pidgin.im>
parents:
23181
diff
changeset
|
123 | } |
|
e57706b32d2a
Patch from "Chris G." to extend the yahoo privacy to picture requests to help
Daniel Atallah <datallah@pidgin.im>
parents:
23181
diff
changeset
|
124 | |
|
9675
127db3bbb4f2
[gaim-migrate @ 10527]
Peter Lawler <pidgin@bleeter.id.au>
parents:
9329
diff
changeset
|
125 | /* Yahoo IM 6 spits out 0.png as the URL if the buddy icon is not set */ |
|
18552
810a338ef085
Use the glib strcasecmp functions everywhere, as we've had reports of
Richard Laager <rlaager@pidgin.im>
parents:
17151
diff
changeset
|
126 | if (who && got_icon_info && url && !g_ascii_strncasecmp(url, "http://", 7)) { |
| 9306 | 127 | /* TODO: make this work p2p, try p2p before the url */ |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
128 | PurpleHttpConnection *hc; |
| 9306 | 129 | struct yahoo_fetch_picture_data *data; |
|
16534
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16076
diff
changeset
|
130 | |
| 9306 | 131 | data = g_new0(struct yahoo_fetch_picture_data, 1); |
| 132 | data->gc = gc; | |
| 133 | data->who = g_strdup(who); | |
| 134 | data->checksum = checksum; | |
|
34233
8bdcc4f84a5e
HTTP: introduce purple_http_get_printf, make purple_http_get consistent with it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34227
diff
changeset
|
135 | hc = purple_http_get(gc, yahoo_fetch_picture_cb, data, url); |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
136 | yd = purple_connection_get_protocol_data(gc); |
|
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
137 | yd->http_reqs = g_slist_prepend(yd->http_reqs, hc); |
| 9306 | 138 | } else if (who && send_icon_info) { |
| 139 | yahoo_send_picture_info(gc, who); | |
| 140 | } | |
| 141 | } | |
| 142 | ||
| 15884 | 143 | void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 9306 | 144 | { |
| 145 | GSList *l = pkt->hash; | |
| 146 | char *who = NULL; | |
| 147 | int checksum = 0; | |
| 148 | ||
| 149 | while (l) { | |
| 150 | struct yahoo_pair *pair = l->data; | |
| 151 | ||
| 152 | switch (pair->key) { | |
| 153 | case 4: | |
| 154 | who = pair->value; | |
| 155 | break; | |
| 156 | case 5: | |
| 157 | /* us */ | |
| 158 | break; | |
| 159 | case 192: | |
| 160 | checksum = strtol(pair->value, NULL, 10); | |
| 161 | break; | |
| 162 | } | |
| 163 | l = l->next; | |
| 164 | } | |
| 165 | ||
| 166 | if (who) { | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
167 | PurpleBuddy *b = purple_blist_find_buddy(purple_connection_get_account(gc), who); |
|
16606
b31fca4f6f60
Thanks to Bleeter, yahoo will not crash for non-existent buddyicons anymore.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16539
diff
changeset
|
168 | const char *locksum = NULL; |
|
16534
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16076
diff
changeset
|
169 | |
|
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16076
diff
changeset
|
170 | /* FIXME: Cleanup this strtol() stuff if possible. */ |
|
17151
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
16757
diff
changeset
|
171 | if (b) { |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
16757
diff
changeset
|
172 | locksum = purple_buddy_icons_get_checksum_for_user(b); |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
16757
diff
changeset
|
173 | if (!locksum || (checksum != strtol(locksum, NULL, 10))) |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
16757
diff
changeset
|
174 | yahoo_send_picture_request(gc, who); |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
16757
diff
changeset
|
175 | } |
| 9306 | 176 | } |
| 177 | } | |
| 178 | ||
| 15884 | 179 | void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 9306 | 180 | { |
| 15884 | 181 | PurpleAccount *account = purple_connection_get_account(gc); |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
182 | YahooData *yd = purple_connection_get_protocol_data(gc); |
| 9306 | 183 | GSList *l = pkt->hash; |
| 184 | char *url = NULL; | |
| 185 | ||
| 186 | while (l) { | |
| 187 | struct yahoo_pair *pair = l->data; | |
| 188 | ||
| 189 | switch (pair->key) { | |
| 190 | case 5: | |
| 191 | /* us */ | |
| 192 | break; | |
| 193 | case 27: | |
| 194 | /* filename on our computer. */ | |
| 195 | break; | |
| 196 | case 20: /* url at yahoo */ | |
| 197 | url = pair->value; | |
| 198 | case 38: /* timestamp */ | |
| 199 | break; | |
| 200 | } | |
| 201 | l = l->next; | |
| 202 | } | |
| 203 | ||
| 204 | if (url) { | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
205 | g_free(yd->picture_url); |
| 9306 | 206 | yd->picture_url = g_strdup(url); |
| 15884 | 207 | purple_account_set_string(account, YAHOO_PICURL_SETTING, url); |
| 208 | purple_account_set_int(account, YAHOO_PICCKSUM_SETTING, yd->picture_checksum); | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
209 | yahoo_send_picture_checksum(gc); |
| 9310 | 210 | yahoo_send_picture_update(gc, 2); |
| 9306 | 211 | } |
| 212 | } | |
| 213 | ||
| 15884 | 214 | void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt) |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
215 | { |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
216 | GSList *l = pkt->hash; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
217 | char *who = NULL; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
218 | int avatar = 0; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
219 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
220 | while (l) { |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
221 | struct yahoo_pair *pair = l->data; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
222 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
223 | switch (pair->key) { |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
224 | case 4: |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
225 | who = pair->value; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
226 | break; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
227 | case 5: |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
228 | /* us */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
229 | break; |
|
27467
5fd6936c4ed7
Some more fixes for when unsetting buddy picture, for both when sending and receiving updates.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27413
diff
changeset
|
230 | case 206: /* Older versions. Still needed? */ |
|
5fd6936c4ed7
Some more fixes for when unsetting buddy picture, for both when sending and receiving updates.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27413
diff
changeset
|
231 | case 213: /* Newer versions */ |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
232 | /* |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
233 | * 0 - No icon or avatar |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
234 | * 1 - Using an avatar |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
235 | * 2 - Using an icon |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
236 | */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
237 | avatar = strtol(pair->value, NULL, 10); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
238 | break; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
239 | } |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
240 | l = l->next; |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
241 | } |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
242 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
243 | if (who) { |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
244 | if (avatar == 2) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
245 | yahoo_send_picture_request(gc, who); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
246 | else if ((avatar == 0) || (avatar == 1)) { |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
247 | YahooFriend *f; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32596
diff
changeset
|
248 | purple_buddy_icons_set_for_user(purple_connection_get_account(gc), who, NULL, 0, NULL); |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
249 | if ((f = yahoo_friend_find(gc, who))) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
250 | yahoo_friend_set_buddy_icon_need_request(f, TRUE); |
| 15884 | 251 | purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who); |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
252 | } |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
253 | } |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
254 | } |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13277
diff
changeset
|
255 | |
| 15884 | 256 | void yahoo_send_picture_info(PurpleConnection *gc, const char *who) |
| 9322 | 257 | { |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
258 | YahooData *yd = purple_connection_get_protocol_data(gc); |
| 9322 | 259 | struct yahoo_packet *pkt; |
| 260 | ||
| 9329 | 261 | if (!yd->picture_url) { |
| 15884 | 262 | purple_debug_warning("yahoo", "Attempted to send picture info without a picture\n"); |
| 9322 | 263 | return; |
| 9329 | 264 | } |
| 9322 | 265 | |
|
27866
4a8d47263e98
Change a bunch more of our yahoo packets to use the session ID. I believe this
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27555
diff
changeset
|
266 | pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
27413
2c10bbbac69c
This fixes sending updates to buddies when I change my pic.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27412
diff
changeset
|
267 | yahoo_packet_hash(pkt, "ssssi", 1, purple_connection_get_display_name(gc), |
|
2c10bbbac69c
This fixes sending updates to buddies when I change my pic.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27412
diff
changeset
|
268 | 5, who, |
| 10394 | 269 | 13, "2", 20, yd->picture_url, 192, yd->picture_checksum); |
| 10392 | 270 | yahoo_packet_send_and_free(pkt, yd); |
| 9322 | 271 | } |
| 9306 | 272 | |
| 15884 | 273 | void yahoo_send_picture_request(PurpleConnection *gc, const char *who) |
| 9306 | 274 | { |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
275 | YahooData *yd = purple_connection_get_protocol_data(gc); |
| 9306 | 276 | struct yahoo_packet *pkt; |
| 277 | ||
|
27866
4a8d47263e98
Change a bunch more of our yahoo packets to use the session ID. I believe this
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27555
diff
changeset
|
278 | pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
27412
1db60cfcad9b
This fixes buddyicon fetches for me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27409
diff
changeset
|
279 | yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); /* me */ |
| 10394 | 280 | yahoo_packet_hash_str(pkt, 5, who); /* the other guy */ |
| 281 | yahoo_packet_hash_str(pkt, 13, "1"); /* 1 = request, 2 = reply */ | |
| 10392 | 282 | yahoo_packet_send_and_free(pkt, yd); |
| 9306 | 283 | } |
| 284 | ||
| 15884 | 285 | void yahoo_send_picture_checksum(PurpleConnection *gc) |
| 9310 | 286 | { |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
287 | YahooData *yd = purple_connection_get_protocol_data(gc); |
| 9310 | 288 | struct yahoo_packet *pkt; |
| 289 | ||
|
27866
4a8d47263e98
Change a bunch more of our yahoo packets to use the session ID. I believe this
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27555
diff
changeset
|
290 | pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); |
| 15884 | 291 | yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), |
| 10394 | 292 | 212, "1", 192, yd->picture_checksum); |
| 10392 | 293 | yahoo_packet_send_and_free(pkt, yd); |
| 9310 | 294 | } |
| 295 | ||
| 15884 | 296 | void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) |
| 9310 | 297 | { |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
298 | YahooData *yd = purple_connection_get_protocol_data(gc); |
| 9310 | 299 | struct yahoo_packet *pkt; |
| 300 | ||
|
27866
4a8d47263e98
Change a bunch more of our yahoo packets to use the session ID. I believe this
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27555
diff
changeset
|
301 | pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
27467
5fd6936c4ed7
Some more fixes for when unsetting buddy picture, for both when sending and receiving updates.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27413
diff
changeset
|
302 | yahoo_packet_hash(pkt, "si", 3, who, 213, type); |
| 10392 | 303 | yahoo_packet_send_and_free(pkt, yd); |
| 9310 | 304 | } |
| 305 | ||
| 306 | struct yspufe { | |
| 15884 | 307 | PurpleConnection *gc; |
| 9310 | 308 | int type; |
| 309 | }; | |
| 310 | ||
| 311 | static void yahoo_send_picture_update_foreach(gpointer key, gpointer value, gpointer data) | |
| 312 | { | |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
313 | const char *who = key; |
| 9310 | 314 | YahooFriend *f = value; |
| 315 | struct yspufe *d = data; | |
| 316 | ||
| 317 | if (f->status != YAHOO_STATUS_OFFLINE) | |
| 318 | yahoo_send_picture_update_to_user(d->gc, who, d->type); | |
| 319 | } | |
| 320 | ||
| 15884 | 321 | void yahoo_send_picture_update(PurpleConnection *gc, int type) |
| 9310 | 322 | { |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
323 | YahooData *yd = purple_connection_get_protocol_data(gc); |
| 9310 | 324 | struct yspufe data; |
| 325 | ||
| 326 | data.gc = gc; | |
| 327 | data.type = type; | |
| 328 | ||
| 329 | g_hash_table_foreach(yd->friends, yahoo_send_picture_update_foreach, &data); | |
| 330 | } | |
| 331 | ||
| 9306 | 332 | void yahoo_buddy_icon_upload_data_free(struct yahoo_buddy_icon_upload_data *d) |
| 333 | { | |
| 15884 | 334 | purple_debug_misc("yahoo", "In yahoo_buddy_icon_upload_data_free()\n"); |
| 9306 | 335 | |
| 336 | if (d->str) | |
| 337 | g_string_free(d->str, TRUE); | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
338 | g_free(d->filename); |
| 9306 | 339 | if (d->watcher) |
| 15884 | 340 | purple_input_remove(d->watcher); |
| 9306 | 341 | if (d->fd != -1) |
| 342 | close(d->fd); | |
| 343 | g_free(d); | |
| 344 | } | |
| 345 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
346 | /* we couldn't care less about the server's response, but yahoo gets grumpy if we close before it sends it */ |
| 15884 | 347 | static void yahoo_buddy_icon_upload_reading(gpointer data, gint source, PurpleInputCondition condition) |
| 9306 | 348 | { |
| 349 | struct yahoo_buddy_icon_upload_data *d = data; | |
| 15884 | 350 | PurpleConnection *gc = d->gc; |
| 9306 | 351 | char buf[1024]; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
352 | int ret; |
| 9306 | 353 | |
| 15884 | 354 | if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 9306 | 355 | yahoo_buddy_icon_upload_data_free(d); |
| 356 | return; | |
| 357 | } | |
| 358 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
359 | ret = read(d->fd, buf, sizeof(buf)); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
360 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
361 | if (ret < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
362 | return; |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
363 | else if (ret <= 0) { |
|
25152
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24181
diff
changeset
|
364 | /* There are other problems if d->str->len overflows, so shut up the |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24181
diff
changeset
|
365 | * warning on 64-bit. */ |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24181
diff
changeset
|
366 | purple_debug_info("yahoo", "Buddy icon upload response (%" G_GSIZE_FORMAT ") bytes (> ~400 indicates failure):\n%.*s\n", |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24181
diff
changeset
|
367 | d->str->len, (guint)d->str->len, d->str->str); |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
368 | |
| 9306 | 369 | yahoo_buddy_icon_upload_data_free(d); |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
370 | return; |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
371 | } |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
372 | |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
373 | g_string_append_len(d->str, buf, ret); |
| 9306 | 374 | } |
| 375 | ||
| 15884 | 376 | static void yahoo_buddy_icon_upload_pending(gpointer data, gint source, PurpleInputCondition condition) |
| 9306 | 377 | { |
| 378 | struct yahoo_buddy_icon_upload_data *d = data; | |
| 15884 | 379 | PurpleConnection *gc = d->gc; |
|
23073
e731fbd84c71
Use gssize instead of ssize_t as the latter isn't available everywhere.
Daniel Atallah <datallah@pidgin.im>
parents:
22145
diff
changeset
|
380 | gssize wrote; |
| 9306 | 381 | |
| 15884 | 382 | if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 9306 | 383 | yahoo_buddy_icon_upload_data_free(d); |
| 384 | return; | |
| 385 | } | |
| 386 | ||
| 387 | wrote = write(d->fd, d->str->str + d->pos, d->str->len - d->pos); | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
388 | if (wrote < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
389 | return; |
| 9306 | 390 | if (wrote <= 0) { |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
391 | purple_debug_info("yahoo", "Error uploading buddy icon.\n"); |
| 9306 | 392 | yahoo_buddy_icon_upload_data_free(d); |
| 393 | return; | |
| 394 | } | |
| 395 | d->pos += wrote; | |
| 396 | if (d->pos >= d->str->len) { | |
| 15884 | 397 | purple_debug_misc("yahoo", "Finished uploading buddy icon.\n"); |
| 398 | purple_input_remove(d->watcher); | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
399 | /* Clean out the sent buffer and reuse it to read the result */ |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
400 | g_string_free(d->str, TRUE); |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
401 | d->str = g_string_new(""); |
| 15884 | 402 | d->watcher = purple_input_add(d->fd, PURPLE_INPUT_READ, yahoo_buddy_icon_upload_reading, d); |
| 9306 | 403 | } |
| 404 | } | |
| 405 | ||
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
406 | static void yahoo_buddy_icon_upload_connected(gpointer data, gint source, const gchar *error_message) |
| 9306 | 407 | { |
| 408 | struct yahoo_buddy_icon_upload_data *d = data; | |
| 409 | struct yahoo_packet *pkt; | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
410 | gchar *tmp, *header; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
411 | guchar *pkt_buf; |
|
10576
ce7a6c585bc6
[gaim-migrate @ 11970]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10394
diff
changeset
|
412 | const char *host; |
|
13272
fd4f3356640f
[gaim-migrate @ 15637]
Daniel Atallah <datallah@pidgin.im>
parents:
13201
diff
changeset
|
413 | int port; |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
414 | gsize pkt_buf_len; |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
415 | PurpleConnection *gc = d->gc; |
| 15884 | 416 | PurpleAccount *account; |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27958
diff
changeset
|
417 | YahooData *yd; |
|
24181
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
23960
diff
changeset
|
418 | /* use whole URL if using HTTP Proxy */ |
|
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
23960
diff
changeset
|
419 | gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
| 9306 | 420 | |
| 15884 | 421 | account = purple_connection_get_account(gc); |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
422 | yd = purple_connection_get_protocol_data(gc); |
| 9306 | 423 | |
| 15884 | 424 | /* Buddy icon connect is now complete; clear the PurpleProxyConnectData */ |
|
14693
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
425 | yd->buddy_icon_connect_data = NULL; |
|
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
426 | |
| 9306 | 427 | if (source < 0) { |
| 15884 | 428 | purple_debug_error("yahoo", "Buddy icon upload failed: %s\n", error_message); |
| 9306 | 429 | yahoo_buddy_icon_upload_data_free(d); |
| 430 | return; | |
| 431 | } | |
| 432 | ||
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
433 | pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPLOAD, YAHOO_STATUS_AVAILABLE, yd->session_id); |
| 9306 | 434 | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
435 | tmp = g_strdup_printf("%" G_GSIZE_FORMAT, d->str->len); |
| 9306 | 436 | /* 1 = me, 38 = expire time(?), 0 = me, 28 = size, 27 = filename, 14 = NULL, 29 = data */ |
| 15884 | 437 | yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); |
| 10394 | 438 | yahoo_packet_hash_str(pkt, 38, "604800"); /* time til expire */ |
| 15884 | 439 | purple_account_set_int(account, YAHOO_PICEXPIRE_SETTING, time(NULL) + 604800); |
| 440 | yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc)); | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
441 | yahoo_packet_hash_str(pkt, 28, tmp); |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
442 | g_free(tmp); |
| 10394 | 443 | yahoo_packet_hash_str(pkt, 27, d->filename); |
| 444 | yahoo_packet_hash_str(pkt, 14, ""); | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
445 | /* 4 padding for the 29 key name */ |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
446 | pkt_buf_len = yahoo_packet_build(pkt, 4, FALSE, yd->jp, &pkt_buf); |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
447 | yahoo_packet_free(pkt); |
| 9306 | 448 | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
449 | /* header + packet + "29" + 0xc0 + 0x80) + pictureblob */ |
| 9306 | 450 | |
|
27958
761556eeff82
And clean up two instances where Yahoo Japan needs to be correctly detected
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27866
diff
changeset
|
451 | host = purple_account_get_string(account, "xfer_host", yd->jp? YAHOOJP_XFER_HOST : YAHOO_XFER_HOST); |
| 15884 | 452 | port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT); |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
453 | tmp = g_strdup_printf("%s:%d", host, port); |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
454 | header = g_strdup_printf("POST %s%s/notifyft HTTP/1.1\r\n" |
|
25762
0c1a4287c70c
Backport the parts of b859960a4a19f57f20db0536c1815a6d79e08e36 that apply to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25152
diff
changeset
|
455 | "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
456 | "Cookie: T=%s; Y=%s\r\n" |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
457 | "Host: %s\r\n" |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
458 | "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
459 | "Cache-Control: no-cache\r\n\r\n", |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
460 | use_whole_url ? "http://" : "", use_whole_url ? tmp : "", |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27052
diff
changeset
|
461 | yd->cookie_t, yd->cookie_y, |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
462 | tmp, |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
463 | pkt_buf_len + 4 + d->str->len); |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
464 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
465 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
466 | /* There's no magic here, we just need to prepend in reverse order */ |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
467 | g_string_prepend(d->str, "29\xc0\x80"); |
| 9306 | 468 | |
| 14321 | 469 | g_string_prepend_len(d->str, (char *)pkt_buf, pkt_buf_len); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
470 | g_free(pkt_buf); |
| 9306 | 471 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
472 | g_string_prepend(d->str, header); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
473 | g_free(header); |
| 9306 | 474 | |
|
25152
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24181
diff
changeset
|
475 | /* There are other problems if we're uploading over 4GB of data */ |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24181
diff
changeset
|
476 | purple_debug_info("yahoo", "Buddy icon upload data:\n%.*s\n", (guint)d->str->len, d->str->str); |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
477 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
478 | d->fd = source; |
| 15884 | 479 | d->watcher = purple_input_add(d->fd, PURPLE_INPUT_WRITE, yahoo_buddy_icon_upload_pending, d); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12412
diff
changeset
|
480 | |
| 15884 | 481 | yahoo_buddy_icon_upload_pending(d, d->fd, PURPLE_INPUT_WRITE); |
| 9306 | 482 | } |
| 483 | ||
| 15884 | 484 | void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) |
| 9306 | 485 | { |
| 15884 | 486 | PurpleAccount *account = purple_connection_get_account(gc); |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
487 | YahooData *yd = purple_connection_get_protocol_data(gc); |
| 9306 | 488 | |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
489 | if (yd->buddy_icon_connect_data != NULL) { |
|
14693
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
490 | /* Cancel any in-progress buddy icon upload */ |
| 15884 | 491 | purple_proxy_connect_cancel(yd->buddy_icon_connect_data); |
|
14693
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
492 | yd->buddy_icon_connect_data = NULL; |
|
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
493 | } |
|
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
494 | |
| 15884 | 495 | yd->buddy_icon_connect_data = purple_proxy_connect(NULL, account, |
|
27958
761556eeff82
And clean up two instances where Yahoo Japan needs to be correctly detected
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27866
diff
changeset
|
496 | purple_account_get_string(account, "xfer_host", |
|
761556eeff82
And clean up two instances where Yahoo Japan needs to be correctly detected
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27866
diff
changeset
|
497 | yd->jp? YAHOOJP_XFER_HOST : YAHOO_XFER_HOST), |
| 15884 | 498 | purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
499 | yahoo_buddy_icon_upload_connected, d); |
|
14693
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
500 | |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
501 | if (yd->buddy_icon_connect_data == NULL) |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
502 | { |
| 15884 | 503 | purple_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
504 | yahoo_buddy_icon_upload_data_free(d); |
|
14693
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14686
diff
changeset
|
505 | } |
| 9306 | 506 | } |
| 507 | ||
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
508 | static int yahoo_buddy_icon_calculate_checksum(const guchar *data, gsize len) |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
509 | { |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
510 | /* This code is borrowed from Kopete, which seems to be managing to calculate |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
511 | checksums in such a manner that Yahoo!'s servers are happy */ |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
512 | |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
513 | const guchar *p = data; |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
514 | int checksum = 0, g, i = len; |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
515 | |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
516 | while(i--) { |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
517 | checksum = (checksum << 4) + *p++; |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
518 | |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
519 | if((g = (checksum & 0xf0000000)) != 0) |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
520 | checksum ^= g >> 23; |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
521 | |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
522 | checksum &= ~g; |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
523 | } |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
524 | |
|
25895
ab35a3dda3c5
Add a newline to this log message
Mark Doliner <markdoliner@pidgin.im>
parents:
25152
diff
changeset
|
525 | purple_debug_misc("yahoo", "Calculated buddy icon checksum: %d\n", checksum); |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
526 | |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
527 | return checksum; |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27052
diff
changeset
|
528 | } |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
529 | |
|
16538
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
530 | void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) |
| 9306 | 531 | { |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
27959
diff
changeset
|
532 | YahooData *yd = purple_connection_get_protocol_data(gc); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32596
diff
changeset
|
533 | PurpleAccount *account = purple_connection_get_account(gc); |
| 9306 | 534 | |
|
16538
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
535 | if (img == NULL) { |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
536 | g_free(yd->picture_url); |
| 9306 | 537 | yd->picture_url = NULL; |
| 538 | ||
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
539 | /* TODO: don't we have to clear it on the server too?! */ |
|
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
540 | |
| 15884 | 541 | purple_account_set_string(account, YAHOO_PICURL_SETTING, NULL); |
| 542 | purple_account_set_int(account, YAHOO_PICCKSUM_SETTING, 0); | |
| 543 | purple_account_set_int(account, YAHOO_PICEXPIRE_SETTING, 0); | |
| 9310 | 544 | if (yd->logged_in) |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
545 | /* Tell everyone we ain't got one no more */ |
| 9310 | 546 | yahoo_send_picture_update(gc, 0); |
| 9306 | 547 | |
|
16538
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
548 | } else { |
|
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
549 | gconstpointer data = purple_imgstore_get_data(img); |
|
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
550 | size_t len = purple_imgstore_get_size(img); |
|
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
551 | GString *s = g_string_new_len(data, len); |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
552 | struct yahoo_buddy_icon_upload_data *d; |
| 15884 | 553 | int oldcksum = purple_account_get_int(account, YAHOO_PICCKSUM_SETTING, 0); |
| 554 | int expire = purple_account_get_int(account, YAHOO_PICEXPIRE_SETTING, 0); | |
| 555 | const char *oldurl = purple_account_get_string(account, YAHOO_PICURL_SETTING, NULL); | |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
556 | |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
557 | yd->picture_checksum = yahoo_buddy_icon_calculate_checksum(data, len); |
| 9306 | 558 | |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
559 | if ((yd->picture_checksum == oldcksum) && |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
560 | (expire > (time(NULL) + 60*60*24)) && oldurl) |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
561 | { |
| 15884 | 562 | purple_debug_misc("yahoo", "buddy icon is up to date. Not reuploading.\n"); |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
563 | g_string_free(s, TRUE); |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
564 | g_free(yd->picture_url); |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
565 | yd->picture_url = g_strdup(oldurl); |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
566 | return; |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
567 | } |
| 9306 | 568 | |
|
16757
aae5c0ced2da
Update the comments about yahoo buddy icons. Only send the filename and not the whole path.
Tim Ringenbach <marv@pidgin.im>
parents:
16606
diff
changeset
|
569 | /* We use this solely for sending a filename to the server */ |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
570 | d = g_new0(struct yahoo_buddy_icon_upload_data, 1); |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
571 | d->gc = gc; |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
572 | d->str = s; |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
573 | d->fd = -1; |
|
23170
456cbed76e54
applied changes from c7504bbbe35f5bef52032c0cdf6bc7182128a469
Daniel Atallah <datallah@pidgin.im>
parents:
23156
diff
changeset
|
574 | d->filename = g_strdup(purple_imgstore_get_filename(img)); |
| 9306 | 575 | |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
576 | if (!yd->logged_in) { |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
577 | yd->picture_upload_todo = d; |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
578 | return; |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
579 | } |
| 9306 | 580 | |
|
15239
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
581 | yahoo_buddy_icon_upload(gc, d); |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
582 | |
|
f31e2c11334e
[gaim-migrate @ 17964]
Mark Doliner <markdoliner@pidgin.im>
parents:
15042
diff
changeset
|
583 | } |
|
15245
3abed8bd82fb
[gaim-migrate @ 17972]
Mark Doliner <markdoliner@pidgin.im>
parents:
15239
diff
changeset
|
584 | } |