comparison src/protocols/yahoo/yahoo.h @ 9306:04a3e9e869ee

[gaim-migrate @ 10114] Ok, this is yahoo buddy icon uploading support. It's still not quite right, but it mostly works. We don't send out updates yet so changing it or unsetting it may not work. But setting it initally, or changing it and relogging will probably work. I never did figure out what hash function yahoo is using, so I just used g_string_hash. It probably won't matter. I hope to finish this up before release. But people probably won't notice the bugs too much anyway. It shouldn't crash or anything, people just might not always see your newest icon right away. Have fun kids. For the record, Simguy tells me Yahoo likes 96x96 PNGs. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Fri, 18 Jun 2004 07:28:25 +0000
parents 750d9b56a465
children 33693eea90d7
comparison
equal deleted inserted replaced
9305:0c201a2386c7 9306:04a3e9e869ee
42 #define YAHOOJP_MAIL_URL "http://mail.yahoo.co.jp/" 42 #define YAHOOJP_MAIL_URL "http://mail.yahoo.co.jp/"
43 #define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp" 43 #define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp"
44 #define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp" 44 #define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp"
45 45
46 #define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg" 46 #define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg"
47
48 #define YAHOO_ICON_CHECKSUM_KEY "icon_checksum"
49 #define YAHOO_PICURL_SETTING "picture_url"
50 #define YAHOO_PICCKSUM_SETTING "picture_checksum"
51 #define YAHOO_PICEXPIRE_SETTING "picture_expire"
47 52
48 enum yahoo_service { /* these are easier to see in hex */ 53 enum yahoo_service { /* these are easier to see in hex */
49 YAHOO_SERVICE_LOGON = 1, 54 YAHOO_SERVICE_LOGON = 1,
50 YAHOO_SERVICE_LOGOFF, 55 YAHOO_SERVICE_LOGOFF,
51 YAHOO_SERVICE_ISAWAY, 56 YAHOO_SERVICE_ISAWAY,
64 YAHOO_SERVICE_ADDIDENT, /* 0x10 */ 69 YAHOO_SERVICE_ADDIDENT, /* 0x10 */
65 YAHOO_SERVICE_ADDIGNORE, 70 YAHOO_SERVICE_ADDIGNORE,
66 YAHOO_SERVICE_PING, 71 YAHOO_SERVICE_PING,
67 YAHOO_SERVICE_GOTGROUPRENAME, 72 YAHOO_SERVICE_GOTGROUPRENAME,
68 YAHOO_SERVICE_SYSMESSAGE = 0x14, 73 YAHOO_SERVICE_SYSMESSAGE = 0x14,
74 YAHOO_SERVICE_SKINNAME = 0x15,
69 YAHOO_SERVICE_PASSTHROUGH2 = 0x16, 75 YAHOO_SERVICE_PASSTHROUGH2 = 0x16,
70 YAHOO_SERVICE_CONFINVITE = 0x18, 76 YAHOO_SERVICE_CONFINVITE = 0x18,
71 YAHOO_SERVICE_CONFLOGON, 77 YAHOO_SERVICE_CONFLOGON,
72 YAHOO_SERVICE_CONFDECLINE, 78 YAHOO_SERVICE_CONFDECLINE,
73 YAHOO_SERVICE_CONFLOGOFF, 79 YAHOO_SERVICE_CONFLOGOFF,
106 YAHOO_SERVICE_COMMENT = 0xa8, 112 YAHOO_SERVICE_COMMENT = 0xa8,
107 YAHOO_SERVICE_AVATAR = 0xbc, 113 YAHOO_SERVICE_AVATAR = 0xbc,
108 YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd, 114 YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd,
109 YAHOO_SERVICE_PICTURE = 0xbe, 115 YAHOO_SERVICE_PICTURE = 0xbe,
110 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, 116 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
117 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
111 YAHOO_SERVICE_AVATAR_UPDATE = 0xc7, 118 YAHOO_SERVICE_AVATAR_UPDATE = 0xc7,
112 YAHOO_SERVICE_WEBLOGIN = 0x0226 119 YAHOO_SERVICE_WEBLOGIN = 0x0226
113 }; 120 };
114 121
115 enum yahoo_status { 122 enum yahoo_status {
127 YAHOO_STATUS_CUSTOM = 99, 134 YAHOO_STATUS_CUSTOM = 99,
128 YAHOO_STATUS_IDLE = 999, 135 YAHOO_STATUS_IDLE = 999,
129 YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, 136 YAHOO_STATUS_WEBLOGIN = 0x5a55aa55,
130 YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ 137 YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */
131 YAHOO_STATUS_TYPING = 0x16 138 YAHOO_STATUS_TYPING = 0x16
139 };
140
141 struct yahoo_buddy_icon_upload_data {
142 GaimConnection *gc;
143 GString *str;
144 char *filename;
145 int pos;
146 int fd;
147 guint watcher;
132 }; 148 };
133 149
134 struct yahoo_data { 150 struct yahoo_data {
135 int fd; 151 int fd;
136 guchar *rxqueue; 152 guchar *rxqueue;
147 char *auth; 163 char *auth;
148 char *cookie_y; 164 char *cookie_y;
149 char *cookie_t; 165 char *cookie_t;
150 int session_id; 166 int session_id;
151 gboolean jp; 167 gboolean jp;
168 /* picture aka buddy icon stuff */
169 char *picture_url;
170 int picture_checksum;
171
172 /* ew. we have to check the icon before we connect,
173 * but can't upload it til we're connected. */
174 struct yahoo_buddy_icon_upload_data *picture_upload_todo;
152 }; 175 };
153 176
154 struct yahoo_pair { 177 struct yahoo_pair {
155 int key; 178 int key;
156 char *value; 179 char *value;
194 217
195 218
196 struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id); 219 struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id);
197 void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value); 220 void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value);
198 int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt); 221 int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt);
222 int yahoo_send_packet_special(int fd, struct yahoo_packet *pkt, int pad);
199 void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data); 223 void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data);
200 int yahoo_packet_length(struct yahoo_packet *pkt); 224 int yahoo_packet_length(struct yahoo_packet *pkt);
201 void yahoo_packet_free(struct yahoo_packet *pkt); 225 void yahoo_packet_free(struct yahoo_packet *pkt);
202 226
203 /* util.c */ 227 /* util.c */