Mercurial > pidgin
annotate src/protocols/yahoo/yahoo.c @ 3768:f53370197bb9
[gaim-migrate @ 3907]
Tri-state typing notification (typing, typed, and no longer typing) by
Nathan D. Walp
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Sun, 20 Oct 2002 19:38:36 +0000 |
| parents | 34c95669952f |
| children | 3fdfe7872118 |
| rev | line source |
|---|---|
| 2681 | 1 /* |
| 2 * gaim | |
| 3 * | |
| 4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
| 5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx> | |
| 6 * | |
| 7 * This program is free software; you can redistribute it and/or modify | |
| 8 * it under the terms of the GNU General Public License as published by | |
| 9 * the Free Software Foundation; either version 2 of the License, or | |
| 10 * (at your option) any later version. | |
| 11 * | |
| 12 * This program is distributed in the hope that it will be useful, | |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 * GNU General Public License for more details. | |
| 16 * | |
| 17 * You should have received a copy of the GNU General Public License | |
| 18 * along with this program; if not, write to the Free Software | |
| 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 20 * | |
| 21 */ | |
| 22 | |
| 23 #ifdef HAVE_CONFIG_H | |
| 24 #include "config.h" | |
| 25 #endif | |
| 26 | |
| 3630 | 27 #ifndef _WIN32 |
| 2681 | 28 #include <netdb.h> |
| 29 #include <unistd.h> | |
| 30 #include <netinet/in.h> | |
| 31 #include <arpa/inet.h> | |
| 3630 | 32 #include <sys/socket.h> |
| 33 #else | |
| 34 #include <winsock.h> | |
| 35 #endif | |
| 36 | |
| 37 #include <errno.h> | |
| 2681 | 38 #include <string.h> |
| 39 #include <stdlib.h> | |
| 40 #include <stdio.h> | |
| 41 #include <time.h> | |
| 42 #include <sys/stat.h> | |
| 43 #include <ctype.h> | |
| 44 #include "multi.h" | |
| 45 #include "prpl.h" | |
| 46 #include "gaim.h" | |
| 47 #include "proxy.h" | |
| 3147 | 48 #include "md5.h" |
| 2681 | 49 |
| 3630 | 50 #ifdef _WIN32 |
| 51 #include "win32dep.h" | |
| 52 #endif | |
| 53 | |
|
2795
536bb833fdeb
[gaim-migrate @ 2808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2786
diff
changeset
|
54 extern char *yahoo_crypt(char *, char *); |
|
536bb833fdeb
[gaim-migrate @ 2808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2786
diff
changeset
|
55 |
| 3630 | 56 /* for win32 compatability */ |
| 57 G_MODULE_IMPORT GSList *connections; | |
| 58 | |
| 2681 | 59 #include "pixmaps/status-away.xpm" |
| 60 #include "pixmaps/status-here.xpm" | |
| 61 #include "pixmaps/status-idle.xpm" | |
| 3019 | 62 #include "pixmaps/status-game.xpm" |
| 2681 | 63 |
| 3035 | 64 /* Yahoo Smilies go here */ |
| 65 #include "pixmaps/protocols/yahoo/yahoo_alien.xpm" | |
| 66 #include "pixmaps/protocols/yahoo/yahoo_angel.xpm" | |
| 67 #include "pixmaps/protocols/yahoo/yahoo_angry.xpm" | |
| 68 #include "pixmaps/protocols/yahoo/yahoo_bigsmile.xpm" | |
| 69 #include "pixmaps/protocols/yahoo/yahoo_blush.xpm" | |
| 70 #include "pixmaps/protocols/yahoo/yahoo_bye.xpm" | |
| 71 #include "pixmaps/protocols/yahoo/yahoo_clown.xpm" | |
| 72 #include "pixmaps/protocols/yahoo/yahoo_cow.xpm" | |
| 73 #include "pixmaps/protocols/yahoo/yahoo_cowboy.xpm" | |
| 74 #include "pixmaps/protocols/yahoo/yahoo_cry.xpm" | |
| 75 #include "pixmaps/protocols/yahoo/yahoo_devil.xpm" | |
| 76 #include "pixmaps/protocols/yahoo/yahoo_flower.xpm" | |
| 77 #include "pixmaps/protocols/yahoo/yahoo_ghost.xpm" | |
| 78 #include "pixmaps/protocols/yahoo/yahoo_glasses.xpm" | |
| 79 #include "pixmaps/protocols/yahoo/yahoo_laughloud.xpm" | |
| 80 #include "pixmaps/protocols/yahoo/yahoo_love.xpm" | |
| 81 #include "pixmaps/protocols/yahoo/yahoo_mean.xpm" | |
| 82 #include "pixmaps/protocols/yahoo/yahoo_neutral.xpm" | |
| 83 #include "pixmaps/protocols/yahoo/yahoo_ooooh.xpm" | |
| 84 #include "pixmaps/protocols/yahoo/yahoo_question.xpm" | |
| 85 #include "pixmaps/protocols/yahoo/yahoo_sad.xpm" | |
| 86 #include "pixmaps/protocols/yahoo/yahoo_sleep.xpm" | |
| 87 #include "pixmaps/protocols/yahoo/yahoo_smiley.xpm" | |
| 88 #include "pixmaps/protocols/yahoo/yahoo_sunglas.xpm" | |
| 89 #include "pixmaps/protocols/yahoo/yahoo_tongue.xpm" | |
| 90 #include "pixmaps/protocols/yahoo/yahoo_wink.xpm" | |
| 91 | |
| 2993 | 92 #define YAHOO_DEBUG |
| 2681 | 93 |
| 94 #define USEROPT_MAIL 0 | |
| 95 | |
| 96 #define USEROPT_PAGERHOST 3 | |
| 3147 | 97 #define YAHOO_PAGER_HOST "scs.yahoo.com" |
| 2681 | 98 #define USEROPT_PAGERPORT 4 |
| 99 #define YAHOO_PAGER_PORT 5050 | |
| 100 | |
| 3467 | 101 #define YAHOO_PROTO_VER 0x0900 |
| 102 | |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
103 enum yahoo_service { /* these are easier to see in hex */ |
| 2681 | 104 YAHOO_SERVICE_LOGON = 1, |
| 105 YAHOO_SERVICE_LOGOFF, | |
| 106 YAHOO_SERVICE_ISAWAY, | |
| 107 YAHOO_SERVICE_ISBACK, | |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
108 YAHOO_SERVICE_IDLE, /* 5 (placemarker) */ |
| 2681 | 109 YAHOO_SERVICE_MESSAGE, |
| 110 YAHOO_SERVICE_IDACT, | |
| 111 YAHOO_SERVICE_IDDEACT, | |
| 112 YAHOO_SERVICE_MAILSTAT, | |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
113 YAHOO_SERVICE_USERSTAT, /* 0xa */ |
| 2681 | 114 YAHOO_SERVICE_NEWMAIL, |
| 115 YAHOO_SERVICE_CHATINVITE, | |
| 116 YAHOO_SERVICE_CALENDAR, | |
| 117 YAHOO_SERVICE_NEWPERSONALMAIL, | |
| 118 YAHOO_SERVICE_NEWCONTACT, | |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
119 YAHOO_SERVICE_ADDIDENT, /* 0x10 */ |
| 2681 | 120 YAHOO_SERVICE_ADDIGNORE, |
| 121 YAHOO_SERVICE_PING, | |
| 122 YAHOO_SERVICE_GROUPRENAME, | |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
123 YAHOO_SERVICE_SYSMESSAGE = 0x14, |
|
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
124 YAHOO_SERVICE_PASSTHROUGH2 = 0x16, |
|
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
125 YAHOO_SERVICE_CONFINVITE = 0x18, |
| 2681 | 126 YAHOO_SERVICE_CONFLOGON, |
| 127 YAHOO_SERVICE_CONFDECLINE, | |
| 128 YAHOO_SERVICE_CONFLOGOFF, | |
| 129 YAHOO_SERVICE_CONFADDINVITE, | |
| 130 YAHOO_SERVICE_CONFMSG, | |
| 131 YAHOO_SERVICE_CHATLOGON, | |
| 132 YAHOO_SERVICE_CHATLOGOFF, | |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
133 YAHOO_SERVICE_CHATMSG = 0x20, |
|
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
134 YAHOO_SERVICE_GAMELOGON = 0x28, |
|
2786
318f846120e2
[gaim-migrate @ 2799]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2772
diff
changeset
|
135 YAHOO_SERVICE_GAMELOGOFF, |
|
318f846120e2
[gaim-migrate @ 2799]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2772
diff
changeset
|
136 YAHOO_SERVICE_GAMEMSG = 0x2a, |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
137 YAHOO_SERVICE_FILETRANSFER = 0x46, |
| 3019 | 138 YAHOO_SERVICE_NOTIFY = 0x4B, |
| 3147 | 139 YAHOO_SERVICE_AUTHRESP = 0x54, |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
140 YAHOO_SERVICE_LIST = 0x55, |
| 3147 | 141 YAHOO_SERVICE_AUTH = 0x57, |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
142 YAHOO_SERVICE_ADDBUDDY = 0x83, |
|
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
143 YAHOO_SERVICE_REMBUDDY = 0x84 |
| 2681 | 144 }; |
| 145 | |
| 146 enum yahoo_status { | |
|
2686
7b21c5446baf
[gaim-migrate @ 2699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2683
diff
changeset
|
147 YAHOO_STATUS_AVAILABLE = 0, |
| 2681 | 148 YAHOO_STATUS_BRB, |
| 149 YAHOO_STATUS_BUSY, | |
| 150 YAHOO_STATUS_NOTATHOME, | |
| 151 YAHOO_STATUS_NOTATDESK, | |
| 152 YAHOO_STATUS_NOTINOFFICE, | |
| 153 YAHOO_STATUS_ONPHONE, | |
| 154 YAHOO_STATUS_ONVACATION, | |
| 155 YAHOO_STATUS_OUTTOLUNCH, | |
| 156 YAHOO_STATUS_STEPPEDOUT, | |
| 157 YAHOO_STATUS_INVISIBLE = 12, | |
| 158 YAHOO_STATUS_CUSTOM = 99, | |
| 159 YAHOO_STATUS_IDLE = 999, | |
| 2993 | 160 YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ |
| 161 YAHOO_STATUS_TYPING = 0x16 | |
| 2681 | 162 }; |
| 3019 | 163 #define YAHOO_STATUS_GAME 0x2 /* Games don't fit into the regular status model */ |
| 2681 | 164 |
| 165 struct yahoo_data { | |
| 166 int fd; | |
| 167 guchar *rxqueue; | |
| 168 int rxlen; | |
| 169 GHashTable *hash; | |
| 3019 | 170 GHashTable *games; |
| 2681 | 171 int current_status; |
| 172 gboolean logged_in; | |
| 173 }; | |
| 174 | |
| 175 struct yahoo_pair { | |
| 176 int key; | |
| 177 char *value; | |
| 178 }; | |
| 179 | |
| 180 struct yahoo_packet { | |
| 181 guint16 service; | |
| 182 guint32 status; | |
| 183 guint32 id; | |
| 184 GSList *hash; | |
| 185 }; | |
| 186 | |
| 187 #define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4) | |
| 188 | |
| 189 static struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id) | |
| 190 { | |
| 191 struct yahoo_packet *pkt = g_new0(struct yahoo_packet, 1); | |
| 192 | |
| 193 pkt->service = service; | |
| 194 pkt->status = status; | |
| 195 pkt->id = id; | |
| 196 | |
| 197 return pkt; | |
| 198 } | |
| 199 | |
| 3466 | 200 static void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value) |
| 2681 | 201 { |
| 202 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); | |
| 203 pair->key = key; | |
| 204 pair->value = g_strdup(value); | |
| 205 pkt->hash = g_slist_append(pkt->hash, pair); | |
| 206 } | |
| 207 | |
| 208 static int yahoo_packet_length(struct yahoo_packet *pkt) | |
| 209 { | |
| 210 GSList *l; | |
| 211 | |
| 212 int len = 0; | |
| 213 | |
| 214 l = pkt->hash; | |
| 215 while (l) { | |
| 216 struct yahoo_pair *pair = l->data; | |
| 217 int tmp = pair->key; | |
| 218 do { | |
| 219 tmp /= 10; | |
| 220 len++; | |
| 221 } while (tmp); | |
| 222 len += 2; | |
| 223 len += strlen(pair->value); | |
| 224 len += 2; | |
| 225 l = l->next; | |
| 226 } | |
| 227 | |
| 228 return len; | |
| 229 } | |
| 230 | |
| 231 /* sometimes i wish prpls could #include things from other prpls. then i could just | |
| 232 * use the routines from libfaim and not have to admit to knowing how they work. */ | |
| 233 #define yahoo_put16(buf, data) ( \ | |
| 234 (*(buf) = (u_char)((data)>>8)&0xff), \ | |
| 235 (*((buf)+1) = (u_char)(data)&0xff), \ | |
| 236 2) | |
| 237 #define yahoo_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) | |
| 238 #define yahoo_put32(buf, data) ( \ | |
| 239 (*((buf)) = (u_char)((data)>>24)&0xff), \ | |
| 240 (*((buf)+1) = (u_char)((data)>>16)&0xff), \ | |
| 241 (*((buf)+2) = (u_char)((data)>>8)&0xff), \ | |
| 242 (*((buf)+3) = (u_char)(data)&0xff), \ | |
| 243 4) | |
| 244 #define yahoo_get32(buf) ((((*(buf))<<24)&0xff000000) + \ | |
| 245 (((*((buf)+1))<<16)&0x00ff0000) + \ | |
| 246 (((*((buf)+2))<< 8)&0x0000ff00) + \ | |
| 247 (((*((buf)+3) )&0x000000ff))) | |
| 248 | |
| 249 static void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len) | |
| 250 { | |
| 251 int pos = 0; | |
| 252 | |
| 253 while (pos + 1 < len) { | |
|
2724
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
254 char key[64], *value = NULL; |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
255 int accept; |
| 2681 | 256 int x; |
| 257 | |
| 258 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); | |
| 259 | |
| 260 x = 0; | |
| 261 while (pos + 1 < len) { | |
| 262 if (data[pos] == 0xc0 && data[pos + 1] == 0x80) | |
| 263 break; | |
| 264 key[x++] = data[pos++]; | |
| 265 } | |
| 266 key[x] = 0; | |
| 267 pos += 2; | |
| 268 pair->key = strtol(key, NULL, 10); | |
|
2724
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
269 accept = x; /* if x is 0 there was no key, so don't accept it */ |
| 2681 | 270 |
|
2724
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
271 if (accept) |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
272 value = g_malloc(len - pos + 1); |
| 2681 | 273 x = 0; |
| 274 while (pos + 1 < len) { | |
| 275 if (data[pos] == 0xc0 && data[pos + 1] == 0x80) | |
| 276 break; | |
|
2724
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
277 if (accept) |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
278 value[x++] = data[pos++]; |
| 2681 | 279 } |
|
2724
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
280 if (accept) |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
281 value[x] = 0; |
| 2681 | 282 pos += 2; |
|
2724
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
283 if (accept) { |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
284 pair->value = g_strdup(value); |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
285 g_free(value); |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
286 pkt->hash = g_slist_append(pkt->hash, pair); |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
287 debug_printf("Key: %d \tValue: %s\n", pair->key, pair->value); |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
288 } else { |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
289 g_free(pair); |
|
7f3f4aa114ad
[gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2723
diff
changeset
|
290 } |
| 2681 | 291 } |
| 292 } | |
| 293 | |
| 294 static void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data) | |
| 295 { | |
| 296 GSList *l = pkt->hash; | |
| 297 int pos = 0; | |
| 298 | |
| 299 while (l) { | |
| 300 struct yahoo_pair *pair = l->data; | |
| 301 guchar buf[100]; | |
| 302 | |
| 303 g_snprintf(buf, sizeof(buf), "%d", pair->key); | |
| 304 strcpy(data + pos, buf); | |
| 305 pos += strlen(buf); | |
| 306 data[pos++] = 0xc0; | |
| 307 data[pos++] = 0x80; | |
| 308 | |
| 309 strcpy(data + pos, pair->value); | |
| 310 pos += strlen(pair->value); | |
| 311 data[pos++] = 0xc0; | |
| 312 data[pos++] = 0x80; | |
| 313 | |
| 314 l = l->next; | |
| 315 } | |
| 316 } | |
| 317 | |
| 318 static void yahoo_packet_dump(guchar *data, int len) | |
| 319 { | |
| 320 #ifdef YAHOO_DEBUG | |
| 321 int i; | |
| 322 for (i = 0; i + 1 < len; i += 2) { | |
| 323 if ((i % 16 == 0) && i) | |
| 324 debug_printf("\n"); | |
| 325 debug_printf("%02x", data[i]); | |
| 326 debug_printf("%02x ", data[i+1]); | |
| 327 } | |
| 328 if (i < len) | |
| 329 debug_printf("%02x", data[i]); | |
| 330 debug_printf("\n"); | |
| 331 for (i = 0; i < len; i++) { | |
| 332 if ((i % 16 == 0) && i) | |
| 333 debug_printf("\n"); | |
| 334 if (isprint(data[i])) | |
| 335 debug_printf("%c ", data[i]); | |
| 336 else | |
| 337 debug_printf(". "); | |
| 338 } | |
| 339 debug_printf("\n"); | |
| 340 #endif | |
| 341 } | |
| 342 | |
| 343 static int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt) | |
| 344 { | |
| 345 int pktlen = yahoo_packet_length(pkt); | |
| 346 int len = YAHOO_PACKET_HDRLEN + pktlen; | |
| 347 int ret; | |
| 348 | |
| 349 guchar *data; | |
| 350 int pos = 0; | |
| 351 | |
| 352 if (yd->fd < 0) | |
| 353 return -1; | |
| 354 | |
| 355 data = g_malloc0(len + 1); | |
| 356 | |
| 357 memcpy(data + pos, "YMSG", 4); pos += 4; | |
| 3467 | 358 pos += yahoo_put16(data + pos, YAHOO_PROTO_VER); |
| 2681 | 359 pos += yahoo_put16(data + pos, 0x0000); |
| 360 pos += yahoo_put16(data + pos, pktlen); | |
| 361 pos += yahoo_put16(data + pos, pkt->service); | |
| 362 pos += yahoo_put32(data + pos, pkt->status); | |
| 363 pos += yahoo_put32(data + pos, pkt->id); | |
| 364 | |
| 365 yahoo_packet_write(pkt, data + pos); | |
| 366 | |
| 367 yahoo_packet_dump(data, len); | |
| 368 ret = write(yd->fd, data, len); | |
| 369 g_free(data); | |
| 370 | |
| 371 return ret; | |
| 372 } | |
| 373 | |
| 374 static void yahoo_packet_free(struct yahoo_packet *pkt) | |
| 375 { | |
| 376 while (pkt->hash) { | |
| 377 struct yahoo_pair *pair = pkt->hash->data; | |
| 378 g_free(pair->value); | |
| 379 g_free(pair); | |
| 380 pkt->hash = g_slist_remove(pkt->hash, pair); | |
| 381 } | |
| 382 g_free(pkt); | |
| 383 } | |
| 384 | |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
385 static void yahoo_process_status(struct gaim_connection *gc, struct yahoo_packet *pkt) |
| 2681 | 386 { |
| 387 struct yahoo_data *yd = gc->proto_data; | |
| 388 GSList *l = pkt->hash; | |
| 389 char *name = NULL; | |
| 390 int state = 0; | |
| 3019 | 391 int gamestate = 0; |
| 2681 | 392 char *msg = NULL; |
| 3019 | 393 |
| 2681 | 394 while (l) { |
| 395 struct yahoo_pair *pair = l->data; | |
| 396 | |
| 397 switch (pair->key) { | |
| 398 case 0: /* we won't actually do anything with this */ | |
| 399 break; | |
| 400 case 1: /* we don't get the full buddy list here. */ | |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
401 if (!yd->logged_in) { |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
402 account_online(gc); |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
403 serv_finish_login(gc); |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
404 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", pair->value); |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
405 yd->logged_in = TRUE; |
| 2681 | 406 |
| 3147 | 407 /* this requests the list. i have a feeling that this is very evil |
| 408 * | |
| 409 * scs.yahoo.com sends you the list before this packet without it being | |
| 410 * requested | |
| 411 * | |
| 412 * do_import(gc, NULL); | |
| 413 * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0); | |
| 414 * yahoo_send_packet(yd, newpkt); | |
| 415 * yahoo_packet_free(newpkt); | |
| 416 */ | |
| 417 | |
| 418 } | |
| 2681 | 419 break; |
| 420 case 8: /* how many online buddies we have */ | |
| 421 break; | |
| 422 case 7: /* the current buddy */ | |
| 423 name = pair->value; | |
| 424 break; | |
| 425 case 10: /* state */ | |
| 426 state = strtol(pair->value, NULL, 10); | |
| 427 break; | |
| 428 case 19: /* custom message */ | |
| 429 msg = pair->value; | |
| 430 break; | |
| 431 case 11: /* i didn't know what this was in the old protocol either */ | |
| 432 break; | |
| 433 case 17: /* in chat? */ | |
| 434 break; | |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
435 case 13: /* in pager? */ |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
436 if (pkt->service == YAHOO_SERVICE_LOGOFF || |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
437 strtol(pair->value, NULL, 10) == 0) { |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
438 serv_got_update(gc, name, 0, 0, 0, 0, 0, 0); |
|
2807
f01e6a425136
[gaim-migrate @ 2820]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2805
diff
changeset
|
439 break; |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
440 } |
| 3019 | 441 if (g_hash_table_lookup(yd->games, name)) |
| 442 gamestate = YAHOO_STATUS_GAME; | |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
443 if (state == YAHOO_STATUS_AVAILABLE) |
| 3019 | 444 serv_got_update(gc, name, 1, 0, 0, 0, gamestate, 0); |
| 3147 | 445 else |
| 3019 | 446 serv_got_update(gc, name, 1, 0, 0, 0, (state << 2) | UC_UNAVAILABLE | gamestate, 0); |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
447 if (state == YAHOO_STATUS_CUSTOM) { |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
448 gpointer val = g_hash_table_lookup(yd->hash, name); |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
449 if (val) { |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
450 g_free(val); |
|
2873
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
451 g_hash_table_insert(yd->hash, name, |
|
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
452 msg ? g_strdup(msg) : g_malloc0(1)); |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
453 } else |
|
2873
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
454 g_hash_table_insert(yd->hash, g_strdup(name), |
|
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
455 msg ? g_strdup(msg) : g_malloc0(1)); |
|
2771
450f4f9d2f23
[gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2741
diff
changeset
|
456 } |
|
450f4f9d2f23
[gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2741
diff
changeset
|
457 break; |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
458 case 60: /* no clue */ |
|
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
459 break; |
| 2979 | 460 case 16: /* Custom error message */ |
| 3427 | 461 do_error_dialog(pair->value, NULL, GAIM_ERROR); |
| 2951 | 462 break; |
| 2681 | 463 default: |
|
2805
9b3c7d2a6e9a
[gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2795
diff
changeset
|
464 debug_printf("unknown status key %d\n", pair->key); |
| 2681 | 465 break; |
| 466 } | |
| 467 | |
| 468 l = l->next; | |
| 469 } | |
| 470 } | |
| 471 | |
| 472 static void yahoo_process_list(struct gaim_connection *gc, struct yahoo_packet *pkt) | |
| 473 { | |
| 474 GSList *l = pkt->hash; | |
| 475 gboolean export = FALSE; | |
| 476 | |
| 477 while (l) { | |
| 478 char **lines; | |
| 479 char **split; | |
| 480 char **buddies; | |
| 481 char **tmp, **bud; | |
| 482 | |
| 483 struct yahoo_pair *pair = l->data; | |
| 484 l = l->next; | |
| 485 | |
| 486 if (pair->key != 87) | |
| 487 continue; | |
| 488 | |
| 3147 | 489 do_import(gc, NULL); |
| 2681 | 490 lines = g_strsplit(pair->value, "\n", -1); |
| 491 for (tmp = lines; *tmp; tmp++) { | |
| 492 split = g_strsplit(*tmp, ":", 2); | |
|
2697
7759f914a009
[gaim-migrate @ 2710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
493 if (!split) |
|
7759f914a009
[gaim-migrate @ 2710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
494 continue; |
|
2702
94b4271b9567
[gaim-migrate @ 2715]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2697
diff
changeset
|
495 if (!split[0] || !split[1]) { |
|
2697
7759f914a009
[gaim-migrate @ 2710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
496 g_strfreev(split); |
|
7759f914a009
[gaim-migrate @ 2710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
497 continue; |
|
7759f914a009
[gaim-migrate @ 2710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
498 } |
| 2681 | 499 buddies = g_strsplit(split[1], ",", -1); |
|
2697
7759f914a009
[gaim-migrate @ 2710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
500 for (bud = buddies; bud && *bud; bud++) |
| 2681 | 501 if (!find_buddy(gc, *bud)) { |
| 502 add_buddy(gc, split[0], *bud, *bud); | |
| 503 export = TRUE; | |
| 504 } | |
| 505 g_strfreev(buddies); | |
| 506 g_strfreev(split); | |
| 507 } | |
| 508 g_strfreev(lines); | |
| 509 } | |
| 510 | |
| 511 if (export) | |
| 512 do_export(gc); | |
| 513 } | |
| 514 | |
| 3019 | 515 static void yahoo_process_notify(struct gaim_connection *gc, struct yahoo_packet *pkt) |
| 2993 | 516 { |
| 517 char *msg = NULL; | |
| 518 char *from = NULL; | |
| 3019 | 519 char *stat = NULL; |
| 520 char *game = NULL; | |
| 2993 | 521 GSList *l = pkt->hash; |
| 3019 | 522 struct yahoo_data *yd = (struct yahoo_data*) gc->proto_data; |
| 2993 | 523 while (l) { |
| 524 struct yahoo_pair *pair = l->data; | |
| 525 if (pair->key == 4) | |
| 526 from = pair->value; | |
| 527 if (pair->key == 49) | |
| 528 msg = pair->value; | |
| 3001 | 529 if (pair->key == 13) |
| 3019 | 530 stat = pair->value; |
| 531 if (pair->key == 14) | |
| 532 game = pair->value; | |
| 2993 | 533 l = l->next; |
| 534 } | |
| 3640 | 535 |
| 536 if (!msg) | |
| 537 return; | |
| 3019 | 538 |
| 539 if (!g_strncasecmp(msg, "TYPING", strlen("TYPING"))) { | |
| 540 if (*stat == '1') | |
| 3768 | 541 serv_got_typing(gc, from, 0, TYPING); |
| 3019 | 542 else |
| 543 serv_got_typing_stopped(gc, from); | |
| 544 } else if (!g_strncasecmp(msg, "GAME", strlen("GAME"))) { | |
| 545 struct buddy *bud = find_buddy(gc, from); | |
| 546 void *free1=NULL, *free2=NULL; | |
| 3020 | 547 if (!bud) |
| 3019 | 548 debug_printf("%s is playing a game, and doesn't want you to know.\n"); |
| 549 if (*stat == '1') { | |
| 550 if (g_hash_table_lookup_extended (yd->games, from, free1, free2)) { | |
| 551 g_free(free1); | |
| 552 g_free(free2); | |
| 553 } | |
| 554 g_hash_table_insert (yd->games, g_strdup(from), g_strdup(game)); | |
| 3020 | 555 if (bud) |
| 556 serv_got_update(gc, from, 1, 0, 0, 0, bud->uc | YAHOO_STATUS_GAME, 0); | |
| 3019 | 557 } else { |
| 558 if (g_hash_table_lookup_extended (yd->games, from, free1, free2)) { | |
| 559 g_free(free1); | |
| 560 g_free(free2); | |
| 561 g_hash_table_remove (yd->games, from); | |
| 562 } | |
| 3020 | 563 if (bud) |
| 564 serv_got_update(gc, from, 1, 0, 0, 0, bud->uc & ~YAHOO_STATUS_GAME, 0); | |
| 3019 | 565 } |
| 566 } | |
| 2993 | 567 } |
| 568 | |
| 2681 | 569 static void yahoo_process_message(struct gaim_connection *gc, struct yahoo_packet *pkt) |
| 570 { | |
| 571 char *msg = NULL; | |
| 572 char *from = NULL; | |
| 573 time_t tm = time(NULL); | |
| 574 GSList *l = pkt->hash; | |
| 3021 | 575 |
| 2681 | 576 while (l) { |
| 577 struct yahoo_pair *pair = l->data; | |
| 578 if (pair->key == 4) | |
| 579 from = pair->value; | |
| 580 if (pair->key == 14) | |
| 581 msg = pair->value; | |
| 582 if (pair->key == 15) | |
| 583 tm = strtol(pair->value, NULL, 10); | |
| 584 l = l->next; | |
| 585 } | |
| 586 | |
| 3021 | 587 if (pkt->status <= 1 || pkt->status == 5) { |
|
2715
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
588 char *m; |
|
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
589 int i, j; |
| 2681 | 590 strip_linefeed(msg); |
|
2715
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
591 m = msg; |
|
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
592 for (i = 0, j = 0; m[i]; i++) { |
|
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
593 if (m[i] == 033) { |
|
2813
bda5b89ba2f9
[gaim-migrate @ 2826]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2807
diff
changeset
|
594 while (m[i] && (m[i] != 'm')) |
|
2715
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
595 i++; |
|
2813
bda5b89ba2f9
[gaim-migrate @ 2826]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2807
diff
changeset
|
596 if (!m[i]) |
|
bda5b89ba2f9
[gaim-migrate @ 2826]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2807
diff
changeset
|
597 i--; |
|
2715
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
598 continue; |
|
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
599 } |
|
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
600 msg[j++] = m[i]; |
|
e901fd3ebbad
[gaim-migrate @ 2728]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2708
diff
changeset
|
601 } |
|
2813
bda5b89ba2f9
[gaim-migrate @ 2826]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2807
diff
changeset
|
602 msg[j] = 0; |
| 3642 | 603 serv_got_im(gc, from, g_strdup(msg), 0, tm, -1); |
| 2681 | 604 } else if (pkt->status == 2) { |
| 3427 | 605 do_error_dialog(_("Your Yahoo! message did not get sent."), NULL, GAIM_ERROR); |
| 2681 | 606 } |
| 607 } | |
| 608 | |
| 609 | |
| 610 static void yahoo_process_contact(struct gaim_connection *gc, struct yahoo_packet *pkt) | |
| 611 { | |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
612 struct yahoo_data *yd = gc->proto_data; |
| 2681 | 613 char *id = NULL; |
| 614 char *who = NULL; | |
| 615 char *msg = NULL; | |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
616 char *name = NULL; |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
617 int state = YAHOO_STATUS_AVAILABLE; |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
618 int online = FALSE; |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
619 |
| 2681 | 620 GSList *l = pkt->hash; |
| 621 | |
| 622 while (l) { | |
| 623 struct yahoo_pair *pair = l->data; | |
| 624 if (pair->key == 1) | |
| 625 id = pair->value; | |
| 626 else if (pair->key == 3) | |
| 627 who = pair->value; | |
| 628 else if (pair->key == 14) | |
| 629 msg = pair->value; | |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
630 else if (pair->key == 7) |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
631 name = pair->value; |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
632 else if (pair->key == 10) |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
633 state = strtol(pair->value, NULL, 10); |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
634 else if (pair->key == 13) |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
635 online = strtol(pair->value, NULL, 10); |
| 2681 | 636 l = l->next; |
| 637 } | |
| 638 | |
|
2682
db2b0b733732
[gaim-migrate @ 2695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
639 if (id) |
|
db2b0b733732
[gaim-migrate @ 2695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
640 show_got_added(gc, id, who, NULL, msg); |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
641 if (name) { |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
642 if (state == YAHOO_STATUS_AVAILABLE) |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
643 serv_got_update(gc, name, 1, 0, 0, 0, 0, 0); |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
644 else if (state == YAHOO_STATUS_IDLE) |
| 3019 | 645 serv_got_update(gc, name, 1, 0, 0, time(NULL) - 600, (state << 2), 0); |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
646 else |
| 3019 | 647 serv_got_update(gc, name, 1, 0, 0, 0, (state << 2) | UC_UNAVAILABLE, 0); |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
648 if (state == YAHOO_STATUS_CUSTOM) { |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
649 gpointer val = g_hash_table_lookup(yd->hash, name); |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
650 if (val) { |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
651 g_free(val); |
|
2873
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
652 g_hash_table_insert(yd->hash, name, |
|
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
653 msg ? g_strdup(msg) : g_malloc0(1)); |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
654 } else |
|
2873
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
655 g_hash_table_insert(yd->hash, g_strdup(name), |
|
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
656 msg ? g_strdup(msg) : g_malloc0(1)); |
|
2683
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
657 } |
|
4836eae8dd8c
[gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2682
diff
changeset
|
658 } |
| 2681 | 659 } |
| 660 | |
| 661 static void yahoo_process_mail(struct gaim_connection *gc, struct yahoo_packet *pkt) | |
| 662 { | |
| 663 char *who = NULL; | |
| 664 char *email = NULL; | |
| 665 char *subj = NULL; | |
| 666 int count = 0; | |
| 667 GSList *l = pkt->hash; | |
| 668 | |
| 669 while (l) { | |
| 670 struct yahoo_pair *pair = l->data; | |
| 671 if (pair->key == 9) | |
| 672 count = strtol(pair->value, NULL, 10); | |
| 673 else if (pair->key == 43) | |
| 674 who = pair->value; | |
| 675 else if (pair->key == 42) | |
| 676 email = pair->value; | |
| 677 else if (pair->key == 18) | |
| 678 subj = pair->value; | |
| 679 l = l->next; | |
| 680 } | |
| 681 | |
|
2850
cbe6a1e63a72
[gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2813
diff
changeset
|
682 if (who && email && subj) { |
|
cbe6a1e63a72
[gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2813
diff
changeset
|
683 char *from = g_strdup_printf("%s (%s)", who, email); |
|
cbe6a1e63a72
[gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2813
diff
changeset
|
684 connection_has_mail(gc, -1, from, subj, "http://mail.yahoo.com/"); |
|
cbe6a1e63a72
[gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2813
diff
changeset
|
685 g_free(from); |
|
cbe6a1e63a72
[gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2813
diff
changeset
|
686 } else |
|
cbe6a1e63a72
[gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2813
diff
changeset
|
687 connection_has_mail(gc, count, NULL, NULL, "http://mail.yahoo.com/"); |
| 2681 | 688 } |
| 3147 | 689 /* This is the y64 alphabet... it's like base64, but has a . and a _ */ |
| 690 char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; | |
| 691 | |
| 692 /* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function | |
| 693 * in util.c, but it has a bug I don't feel like finding right now ;) */ | |
| 694 void to_y64(unsigned char *out, const unsigned char *in, int inlen) | |
| 695 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ | |
| 696 { | |
| 697 for (; inlen >= 3; inlen -= 3) | |
| 698 { | |
| 699 *out++ = base64digits[in[0] >> 2]; | |
| 700 *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; | |
| 701 *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; | |
| 702 *out++ = base64digits[in[2] & 0x3f]; | |
| 703 in += 3; | |
| 704 } | |
| 705 if (inlen > 0) | |
| 706 { | |
| 707 unsigned char fragment; | |
| 708 | |
| 709 *out++ = base64digits[in[0] >> 2]; | |
| 710 fragment = (in[0] << 4) & 0x30; | |
| 711 if (inlen > 1) | |
| 712 fragment |= in[1] >> 4; | |
| 713 *out++ = base64digits[fragment]; | |
| 714 *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c]; | |
| 715 *out++ = '-'; | |
| 716 } | |
| 717 *out = '\0'; | |
| 718 } | |
| 719 | |
| 720 static void yahoo_process_auth(struct gaim_connection *gc, struct yahoo_packet *pkt) | |
| 721 { | |
| 722 char *seed = NULL; | |
| 723 char *sn = NULL; | |
| 724 GSList *l = pkt->hash; | |
| 725 struct yahoo_data *yd = gc->proto_data; | |
| 726 | |
| 727 while (l) { | |
| 728 struct yahoo_pair *pair = l->data; | |
| 729 if (pair->key == 94) | |
| 730 seed = pair->value; | |
| 731 if (pair->key == 1) | |
| 732 sn = pair->value; | |
| 733 l = l->next; | |
| 734 } | |
| 735 | |
| 736 if (seed) { | |
| 737 struct yahoo_packet *pack; | |
| 738 | |
| 739 /* So, Yahoo has stopped supporting its older clients in India, and undoubtedly | |
| 740 * will soon do so in the rest of the world. | |
| 741 * | |
| 742 * The new clients use this authentication method. I warn you in advance, it's | |
| 743 * bizzare, convoluted, inordinately complicated. It's also no more secure than | |
| 744 * crypt() was. The only purpose this scheme could serve is to prevent third | |
| 745 * part clients from connecting to their servers. | |
| 746 * | |
| 747 * Sorry, Yahoo. | |
| 748 */ | |
| 749 | |
| 750 md5_byte_t result[16]; | |
| 751 md5_state_t ctx; | |
| 752 char *crypt_result; | |
| 753 char *password_hash = g_malloc(25); | |
| 754 char *crypt_hash = g_malloc(25); | |
| 755 char *hash_string_p = g_malloc(50 + strlen(sn)); | |
| 756 char *hash_string_c = g_malloc(50 + strlen(sn)); | |
| 757 | |
| 758 char checksum; | |
| 759 | |
| 3157 | 760 int sv; |
| 3147 | 761 |
| 762 char *result6 = g_malloc(25); | |
| 763 char *result96 = g_malloc(25); | |
| 764 | |
| 765 sv = seed[15]; | |
| 3157 | 766 sv = sv % 8; |
| 3147 | 767 |
| 768 md5_init(&ctx); | |
| 769 md5_append(&ctx, gc->password, strlen(gc->password)); | |
| 770 md5_finish(&ctx, result); | |
| 771 to_y64(password_hash, result, 16); | |
| 772 | |
| 773 md5_init(&ctx); | |
| 774 crypt_result = yahoo_crypt(gc->password, "$1$_2S43d5f$"); | |
| 775 md5_append(&ctx, crypt_result, strlen(crypt_result)); | |
| 776 md5_finish(&ctx, result); | |
| 777 to_y64(crypt_hash, result, 16); | |
| 3157 | 778 |
| 779 switch (sv) { | |
| 3147 | 780 case 1: |
| 781 case 6: | |
| 3157 | 782 checksum = seed[seed[9] % 16]; |
| 3147 | 783 g_snprintf(hash_string_p, strlen(sn) + 50, |
| 3157 | 784 "%c%s%s%s", checksum, gc->username, seed, password_hash); |
| 785 g_snprintf(hash_string_c, strlen(sn) + 50, | |
| 3147 | 786 "%c%s%s%s", checksum, gc->username, seed, crypt_hash); |
| 787 break; | |
| 788 case 2: | |
| 789 case 7: | |
| 3157 | 790 checksum = seed[seed[15] % 16]; |
| 3147 | 791 g_snprintf(hash_string_p, strlen(sn) + 50, |
| 3157 | 792 "%c%s%s%s", checksum, seed, password_hash, gc->username); |
| 793 g_snprintf(hash_string_c, strlen(sn) + 50, | |
| 794 "%c%s%s%s", checksum, seed, crypt_hash, gc->username); | |
| 795 break; | |
| 3147 | 796 case 3: |
| 3157 | 797 checksum = seed[seed[1] % 16]; |
| 3147 | 798 g_snprintf(hash_string_p, strlen(sn) + 50, |
| 3157 | 799 "%c%s%s%s", checksum, gc->username, password_hash, seed); |
| 800 g_snprintf(hash_string_c, strlen(sn) + 50, | |
| 801 "%c%s%s%s", checksum, gc->username, crypt_hash, seed); | |
| 802 break; | |
| 803 case 4: | |
| 804 checksum = seed[seed[3] % 16]; | |
| 805 g_snprintf(hash_string_p, strlen(sn) + 50, | |
| 806 "%c%s%s%s", checksum, password_hash, seed, gc->username); | |
| 3147 | 807 g_snprintf(hash_string_c, strlen(sn) + 50, |
| 3157 | 808 "%c%s%s%s", checksum, crypt_hash, seed, gc->username); |
| 809 break; | |
| 3147 | 810 case 0: |
| 811 case 5: | |
| 3157 | 812 checksum = seed[seed[7] % 16]; |
| 3147 | 813 g_snprintf(hash_string_p, strlen(sn) + 50, |
| 3157 | 814 "%c%s%s%s", checksum, password_hash, gc->username, seed); |
| 815 g_snprintf(hash_string_c, strlen(sn) + 50, | |
| 3147 | 816 "%c%s%s%s", checksum, crypt_hash, gc->username, seed); |
| 3157 | 817 break; |
| 3147 | 818 } |
| 3157 | 819 |
| 3147 | 820 md5_init(&ctx); |
| 3157 | 821 md5_append(&ctx, hash_string_p, strlen(hash_string_p)); |
| 3147 | 822 md5_finish(&ctx, result); |
| 823 to_y64(result6, result, 16); | |
| 824 | |
| 825 md5_init(&ctx); | |
| 826 md5_append(&ctx, hash_string_c, strlen(hash_string_c)); | |
| 827 md5_finish(&ctx, result); | |
| 828 to_y64(result96, result, 16); | |
| 829 | |
| 830 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); | |
| 831 yahoo_packet_hash(pack, 0, gc->username); | |
| 832 yahoo_packet_hash(pack, 6, result6); | |
| 833 yahoo_packet_hash(pack, 96, result96); | |
| 834 yahoo_packet_hash(pack, 1, gc->username); | |
| 835 | |
| 836 yahoo_send_packet(yd, pack); | |
| 837 | |
| 3523 | 838 g_free(result6); |
| 839 g_free(result96); | |
| 3147 | 840 g_free(password_hash); |
| 841 g_free(crypt_hash); | |
| 842 g_free(hash_string_p); | |
| 843 g_free(hash_string_c); | |
| 844 | |
| 845 yahoo_packet_free(pack); | |
| 846 } | |
| 847 } | |
| 2681 | 848 |
| 849 static void yahoo_packet_process(struct gaim_connection *gc, struct yahoo_packet *pkt) | |
| 850 { | |
| 851 switch (pkt->service) | |
| 852 { | |
| 853 case YAHOO_SERVICE_LOGON: | |
|
2771
450f4f9d2f23
[gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2741
diff
changeset
|
854 case YAHOO_SERVICE_LOGOFF: |
| 2681 | 855 case YAHOO_SERVICE_ISAWAY: |
|
2737
f61c1f3a6afa
[gaim-migrate @ 2750]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2724
diff
changeset
|
856 case YAHOO_SERVICE_ISBACK: |
| 3019 | 857 case YAHOO_SERVICE_GAMELOGON: |
| 858 case YAHOO_SERVICE_GAMELOGOFF: | |
| 2681 | 859 yahoo_process_status(gc, pkt); |
| 860 break; | |
| 3019 | 861 case YAHOO_SERVICE_NOTIFY: |
| 862 yahoo_process_notify(gc, pkt); | |
| 2993 | 863 break; |
| 2681 | 864 case YAHOO_SERVICE_MESSAGE: |
|
2786
318f846120e2
[gaim-migrate @ 2799]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2772
diff
changeset
|
865 case YAHOO_SERVICE_GAMEMSG: |
| 2681 | 866 yahoo_process_message(gc, pkt); |
| 867 break; | |
| 868 case YAHOO_SERVICE_NEWMAIL: | |
| 869 yahoo_process_mail(gc, pkt); | |
| 870 break; | |
| 871 case YAHOO_SERVICE_NEWCONTACT: | |
| 872 yahoo_process_contact(gc, pkt); | |
| 873 break; | |
| 874 case YAHOO_SERVICE_LIST: | |
| 875 yahoo_process_list(gc, pkt); | |
| 876 break; | |
| 3147 | 877 case YAHOO_SERVICE_AUTH: |
| 878 yahoo_process_auth(gc, pkt); | |
| 879 break; | |
| 2681 | 880 default: |
|
2741
38cb5fa48bec
[gaim-migrate @ 2754]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2737
diff
changeset
|
881 debug_printf("unhandled service 0x%02x\n", pkt->service); |
| 2681 | 882 break; |
| 883 } | |
| 884 } | |
| 885 | |
| 886 static void yahoo_pending(gpointer data, gint source, GaimInputCondition cond) | |
| 887 { | |
| 888 struct gaim_connection *gc = data; | |
| 889 struct yahoo_data *yd = gc->proto_data; | |
| 890 char buf[1024]; | |
| 891 int len; | |
| 892 | |
| 893 len = read(yd->fd, buf, sizeof(buf)); | |
| 894 | |
| 895 if (len <= 0) { | |
| 3074 | 896 hide_login_progress_error(gc, "Unable to read"); |
| 2681 | 897 signoff(gc); |
| 898 return; | |
| 899 } | |
| 900 | |
| 901 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); | |
| 902 memcpy(yd->rxqueue + yd->rxlen, buf, len); | |
| 903 yd->rxlen += len; | |
| 904 | |
| 905 while (1) { | |
| 906 struct yahoo_packet *pkt; | |
| 907 int pos = 0; | |
| 908 int pktlen; | |
| 909 | |
| 910 if (yd->rxlen < YAHOO_PACKET_HDRLEN) | |
| 911 return; | |
| 912 | |
| 913 pos += 4; /* YMSG */ | |
| 914 pos += 2; | |
| 915 pos += 2; | |
| 916 | |
| 917 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; | |
| 918 debug_printf("%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); | |
| 919 | |
| 920 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) | |
| 921 return; | |
| 922 | |
| 923 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); | |
| 924 | |
| 925 pkt = yahoo_packet_new(0, 0, 0); | |
| 926 | |
| 927 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; | |
| 3021 | 928 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; |
|
2741
38cb5fa48bec
[gaim-migrate @ 2754]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2737
diff
changeset
|
929 debug_printf("Yahoo Service: 0x%02x Status: %d\n", pkt->service, pkt->status); |
| 2681 | 930 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; |
| 931 | |
| 932 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); | |
| 933 | |
| 934 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; | |
| 935 if (yd->rxlen) { | |
| 936 char *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen); | |
| 937 g_free(yd->rxqueue); | |
| 938 yd->rxqueue = tmp; | |
| 939 } else { | |
| 940 g_free(yd->rxqueue); | |
| 941 yd->rxqueue = NULL; | |
| 942 } | |
| 943 | |
| 944 yahoo_packet_process(gc, pkt); | |
| 945 | |
| 946 yahoo_packet_free(pkt); | |
| 947 } | |
| 948 } | |
| 949 | |
| 950 static void yahoo_got_connected(gpointer data, gint source, GaimInputCondition cond) | |
| 951 { | |
| 952 struct gaim_connection *gc = data; | |
| 953 struct yahoo_data *yd; | |
| 954 struct yahoo_packet *pkt; | |
| 955 | |
| 956 if (!g_slist_find(connections, gc)) { | |
| 957 close(source); | |
| 958 return; | |
| 959 } | |
| 960 | |
| 961 if (source < 0) { | |
| 962 hide_login_progress(gc, "Unable to connect"); | |
| 963 signoff(gc); | |
| 964 return; | |
| 965 } | |
| 966 | |
| 967 yd = gc->proto_data; | |
| 968 yd->fd = source; | |
| 969 | |
| 3147 | 970 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, 0); |
| 2681 | 971 |
| 972 yahoo_packet_hash(pkt, 1, gc->username); | |
| 973 yahoo_send_packet(yd, pkt); | |
| 974 | |
| 975 yahoo_packet_free(pkt); | |
| 976 | |
| 977 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); | |
| 978 } | |
| 979 | |
| 980 static void yahoo_login(struct aim_user *user) { | |
| 981 struct gaim_connection *gc = new_gaim_conn(user); | |
| 982 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); | |
| 983 | |
| 984 set_login_progress(gc, 1, "Connecting"); | |
| 985 | |
| 986 yd->fd = -1; | |
| 987 yd->hash = g_hash_table_new(g_str_hash, g_str_equal); | |
| 3019 | 988 yd->games = g_hash_table_new(g_str_hash, g_str_equal); |
| 2681 | 989 |
| 3193 | 990 |
| 991 if (!g_strncasecmp(user->proto_opt[USEROPT_PAGERHOST], "cs.yahoo.com", strlen("cs.yahoo.com"))) { | |
| 992 /* Figured out the new auth method -- cs.yahoo.com likes to disconnect on buddy remove and add now */ | |
| 2951 | 993 debug_printf("Setting new Yahoo! server.\n"); |
| 3193 | 994 g_snprintf(user->proto_opt[USEROPT_PAGERHOST], strlen("scs.yahoo.com") + 1, "scs.yahoo.com"); |
| 2951 | 995 save_prefs(); |
| 996 } | |
| 3147 | 997 |
| 998 | |
| 2951 | 999 if (proxy_connect(user->proto_opt[USEROPT_PAGERHOST][0] ? |
| 2681 | 1000 user->proto_opt[USEROPT_PAGERHOST] : YAHOO_PAGER_HOST, |
| 1001 user->proto_opt[USEROPT_PAGERPORT][0] ? | |
| 1002 atoi(user->proto_opt[USEROPT_PAGERPORT]) : YAHOO_PAGER_PORT, | |
|
2688
98b1ac8ddea3
[gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2687
diff
changeset
|
1003 yahoo_got_connected, gc) < 0) { |
| 2681 | 1004 hide_login_progress(gc, "Connection problem"); |
| 1005 signoff(gc); | |
| 1006 return; | |
| 1007 } | |
| 1008 | |
| 1009 } | |
| 1010 | |
| 1011 static gboolean yahoo_destroy_hash(gpointer key, gpointer val, gpointer data) | |
| 1012 { | |
| 1013 g_free(key); | |
| 1014 g_free(val); | |
| 1015 return TRUE; | |
| 1016 } | |
| 1017 | |
| 1018 static void yahoo_close(struct gaim_connection *gc) { | |
| 1019 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 1020 g_hash_table_foreach_remove(yd->hash, yahoo_destroy_hash, NULL); | |
| 1021 g_hash_table_destroy(yd->hash); | |
| 3019 | 1022 g_hash_table_foreach_remove(yd->games, yahoo_destroy_hash, NULL); |
| 1023 g_hash_table_destroy(yd->games); | |
| 2681 | 1024 if (yd->fd >= 0) |
| 1025 close(yd->fd); | |
|
3720
34c95669952f
[gaim-migrate @ 3853]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3642
diff
changeset
|
1026 |
| 2681 | 1027 if (yd->rxqueue) |
| 1028 g_free(yd->rxqueue); | |
|
2687
2d544f48146d
[gaim-migrate @ 2700]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2686
diff
changeset
|
1029 yd->rxlen = 0; |
| 2681 | 1030 if (gc->inpa) |
| 1031 gaim_input_remove(gc->inpa); | |
| 1032 g_free(yd); | |
| 1033 } | |
| 1034 | |
| 1035 static char **yahoo_list_icon(int uc) | |
| 1036 { | |
| 3019 | 1037 if ((uc >> 2) == YAHOO_STATUS_IDLE) |
| 2681 | 1038 return status_idle_xpm; |
| 3019 | 1039 else if (uc & UC_UNAVAILABLE) |
| 1040 return status_away_xpm; | |
| 1041 else if (uc & YAHOO_STATUS_GAME) | |
| 1042 return status_game_xpm; | |
| 1043 return status_here_xpm; | |
| 2681 | 1044 } |
| 1045 | |
| 1046 static char *yahoo_get_status_string(enum yahoo_status a) | |
| 1047 { | |
| 1048 switch (a) { | |
| 1049 case YAHOO_STATUS_BRB: | |
| 1050 return "Be Right Back"; | |
| 1051 case YAHOO_STATUS_BUSY: | |
| 1052 return "Busy"; | |
| 1053 case YAHOO_STATUS_NOTATHOME: | |
| 1054 return "Not At Home"; | |
| 1055 case YAHOO_STATUS_NOTATDESK: | |
| 1056 return "Not At Desk"; | |
| 1057 case YAHOO_STATUS_NOTINOFFICE: | |
| 1058 return "Not In Office"; | |
| 1059 case YAHOO_STATUS_ONPHONE: | |
| 1060 return "On Phone"; | |
| 1061 case YAHOO_STATUS_ONVACATION: | |
| 1062 return "On Vacation"; | |
| 1063 case YAHOO_STATUS_OUTTOLUNCH: | |
| 1064 return "Out To Lunch"; | |
| 1065 case YAHOO_STATUS_STEPPEDOUT: | |
| 1066 return "Stepped Out"; | |
|
2873
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
1067 case YAHOO_STATUS_INVISIBLE: |
|
26be84883f91
[gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
1068 return "Invisible"; |
|
2879
5fc5123b7098
[gaim-migrate @ 2892]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2878
diff
changeset
|
1069 default: |
|
5fc5123b7098
[gaim-migrate @ 2892]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2878
diff
changeset
|
1070 return "Online"; |
| 2681 | 1071 } |
| 1072 } | |
| 1073 | |
| 3019 | 1074 static void yahoo_game(struct gaim_connection *gc, char *name) { |
| 1075 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 1076 char *game = g_hash_table_lookup(yd->games, name); | |
| 1077 char *t; | |
| 1078 char url[256]; | |
| 1079 | |
| 1080 if (!game) | |
| 1081 return; | |
| 1082 t = game = g_strdup(strstr(game, "ante?room=")); | |
| 1083 while (*t != '\t') | |
| 1084 t++; | |
| 1085 *t = 0; | |
| 1086 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game); | |
| 1087 open_url(NULL, url); | |
| 1088 g_free(game); | |
| 1089 } | |
| 2681 | 1090 static GList *yahoo_buddy_menu(struct gaim_connection *gc, char *who) |
| 1091 { | |
| 1092 GList *m = NULL; | |
| 1093 struct proto_buddy_menu *pbm; | |
| 1094 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 1095 struct buddy *b = find_buddy(gc, who); /* this should never be null. if it is, | |
| 1096 segfault and get the bug report. */ | |
| 1097 static char buf[1024]; | |
| 3019 | 1098 static char buf2[1024]; |
| 1099 | |
| 1100 if (b->uc & UC_UNAVAILABLE && b->uc >> 2 != YAHOO_STATUS_IDLE) { | |
| 1101 pbm = g_new0(struct proto_buddy_menu, 1); | |
| 1102 if ((b->uc >> 2) != YAHOO_STATUS_CUSTOM) | |
| 1103 g_snprintf(buf, sizeof buf, | |
| 1104 "Status: %s", yahoo_get_status_string(b->uc >> 2)); | |
| 1105 else | |
| 1106 g_snprintf(buf, sizeof buf, "Custom Status: %s", | |
| 1107 (char *)g_hash_table_lookup(yd->hash, b->name)); | |
| 1108 pbm->label = buf; | |
| 1109 pbm->callback = NULL; | |
| 1110 pbm->gc = gc; | |
| 1111 m = g_list_append(m, pbm); | |
| 1112 } | |
| 1113 | |
| 1114 if (b->uc | YAHOO_STATUS_GAME) { | |
| 1115 char *game = g_hash_table_lookup(yd->games, b->name); | |
| 1116 char *room; | |
| 1117 if (!game) | |
| 1118 return m; | |
| 1119 if (game) { | |
| 1120 char *t; | |
| 1121 pbm = g_new0(struct proto_buddy_menu, 1); | |
| 1122 if (!(room = strstr(game, "&follow="))) /* skip ahead to the url */ | |
| 1123 return NULL; | |
| 1124 while (*room && *room != '\t') /* skip to the tab */ | |
| 1125 room++; | |
| 1126 t = room++; /* room as now at the name */ | |
| 1127 while (*t != '\n') | |
| 1128 t++; /* replace the \n with a space */ | |
| 1129 *t = ' '; | |
| 1130 g_snprintf(buf2, sizeof buf2, "%s", room); | |
| 1131 pbm->label = buf2; | |
| 1132 pbm->callback = yahoo_game; | |
| 1133 pbm->gc = gc; | |
| 1134 m = g_list_append(m, pbm); | |
| 1135 } | |
| 1136 } | |
| 2681 | 1137 |
| 1138 return m; | |
| 1139 } | |
| 1140 | |
| 1141 static void yahoo_act_id(gpointer data, char *entry) | |
| 1142 { | |
| 1143 struct gaim_connection *gc = data; | |
| 1144 struct yahoo_data *yd = gc->proto_data; | |
| 1145 | |
| 1146 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0); | |
| 1147 yahoo_packet_hash(pkt, 3, entry); | |
| 1148 yahoo_send_packet(yd, pkt); | |
| 1149 yahoo_packet_free(pkt); | |
| 1150 | |
| 1151 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", entry); | |
| 1152 } | |
| 1153 | |
| 1154 static void yahoo_do_action(struct gaim_connection *gc, char *act) | |
| 1155 { | |
| 1156 if (!strcmp(act, "Activate ID")) { | |
| 1157 do_prompt_dialog("Activate which ID:", gc->displayname, gc, yahoo_act_id, NULL); | |
| 1158 } | |
| 1159 } | |
| 1160 | |
| 1161 static GList *yahoo_actions() { | |
| 1162 GList *m = NULL; | |
| 1163 | |
| 1164 m = g_list_append(m, "Activate ID"); | |
| 1165 | |
| 1166 return m; | |
| 1167 } | |
| 1168 | |
| 3033 | 1169 static int yahoo_send_im(struct gaim_connection *gc, char *who, char *what, int len, int flags) |
| 2681 | 1170 { |
| 1171 struct yahoo_data *yd = gc->proto_data; | |
| 1172 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); | |
| 3642 | 1173 char *msg = g_strdup(what); |
| 2681 | 1174 |
| 1175 yahoo_packet_hash(pkt, 1, gc->displayname); | |
| 1176 yahoo_packet_hash(pkt, 5, who); | |
| 3493 | 1177 yahoo_packet_hash(pkt, 14, msg); |
| 2681 | 1178 |
| 1179 yahoo_send_packet(yd, pkt); | |
| 1180 | |
| 1181 yahoo_packet_free(pkt); | |
| 3493 | 1182 |
| 2681 | 1183 return 1; |
| 1184 } | |
| 1185 | |
| 3001 | 1186 int yahoo_send_typing(struct gaim_connection *gc, char *who, int typ) |
| 2993 | 1187 { |
| 1188 struct yahoo_data *yd = gc->proto_data; | |
| 3019 | 1189 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); |
| 2993 | 1190 yahoo_packet_hash(pkt, 49, "TYPING"); |
| 1191 yahoo_packet_hash(pkt, 1, gc->displayname); | |
| 1192 yahoo_packet_hash(pkt, 14, " "); | |
| 3596 | 1193 yahoo_packet_hash(pkt, 13, typ == TYPING ? "1" : "0"); |
| 2993 | 1194 yahoo_packet_hash(pkt, 5, who); |
| 1195 yahoo_packet_hash(pkt, 1002, "1"); | |
| 1196 | |
| 1197 yahoo_send_packet(yd, pkt); | |
| 1198 | |
| 1199 yahoo_packet_free(pkt); | |
| 1200 | |
| 3001 | 1201 return 0; |
| 2993 | 1202 } |
| 1203 | |
| 2681 | 1204 static void yahoo_set_away(struct gaim_connection *gc, char *state, char *msg) |
| 1205 { | |
| 1206 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 1207 struct yahoo_packet *pkt; | |
|
2772
f9227268db25
[gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2771
diff
changeset
|
1208 int service; |
| 2681 | 1209 char s[4]; |
| 1210 | |
| 1211 gc->away = NULL; | |
| 1212 | |
| 1213 if (msg) { | |
| 1214 yd->current_status = YAHOO_STATUS_CUSTOM; | |
| 1215 gc->away = ""; | |
| 1216 } else if (state) { | |
| 1217 gc->away = ""; | |
| 1218 if (!strcmp(state, "Available")) { | |
| 1219 yd->current_status = YAHOO_STATUS_AVAILABLE; | |
| 1220 gc->away = NULL; | |
| 1221 } else if (!strcmp(state, "Be Right Back")) { | |
| 1222 yd->current_status = YAHOO_STATUS_BRB; | |
| 1223 } else if (!strcmp(state, "Busy")) { | |
| 1224 yd->current_status = YAHOO_STATUS_BUSY; | |
| 1225 } else if (!strcmp(state, "Not At Home")) { | |
| 1226 yd->current_status = YAHOO_STATUS_NOTATHOME; | |
| 1227 } else if (!strcmp(state, "Not At Desk")) { | |
| 1228 yd->current_status = YAHOO_STATUS_NOTATDESK; | |
| 1229 } else if (!strcmp(state, "Not In Office")) { | |
| 1230 yd->current_status = YAHOO_STATUS_NOTINOFFICE; | |
| 1231 } else if (!strcmp(state, "On Phone")) { | |
| 1232 yd->current_status = YAHOO_STATUS_ONPHONE; | |
| 1233 } else if (!strcmp(state, "On Vacation")) { | |
| 1234 yd->current_status = YAHOO_STATUS_ONVACATION; | |
| 1235 } else if (!strcmp(state, "Out To Lunch")) { | |
| 1236 yd->current_status = YAHOO_STATUS_OUTTOLUNCH; | |
| 1237 } else if (!strcmp(state, "Stepped Out")) { | |
| 1238 yd->current_status = YAHOO_STATUS_STEPPEDOUT; | |
| 1239 } else if (!strcmp(state, "Invisible")) { | |
| 1240 yd->current_status = YAHOO_STATUS_INVISIBLE; | |
| 1241 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { | |
| 1242 if (gc->is_idle) { | |
| 1243 yd->current_status = YAHOO_STATUS_IDLE; | |
| 1244 } else { | |
| 1245 yd->current_status = YAHOO_STATUS_AVAILABLE; | |
| 1246 } | |
| 1247 gc->away = NULL; | |
| 1248 } | |
| 1249 } else if (gc->is_idle) { | |
| 1250 yd->current_status = YAHOO_STATUS_IDLE; | |
| 1251 } else { | |
| 1252 yd->current_status = YAHOO_STATUS_AVAILABLE; | |
| 1253 } | |
| 1254 | |
|
2772
f9227268db25
[gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2771
diff
changeset
|
1255 if (yd->current_status == YAHOO_STATUS_AVAILABLE) |
|
f9227268db25
[gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2771
diff
changeset
|
1256 service = YAHOO_SERVICE_ISBACK; |
|
f9227268db25
[gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2771
diff
changeset
|
1257 else |
|
f9227268db25
[gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2771
diff
changeset
|
1258 service = YAHOO_SERVICE_ISAWAY; |
|
f9227268db25
[gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2771
diff
changeset
|
1259 pkt = yahoo_packet_new(service, yd->current_status, 0); |
| 2681 | 1260 g_snprintf(s, sizeof(s), "%d", yd->current_status); |
| 1261 yahoo_packet_hash(pkt, 10, s); | |
| 1262 if (yd->current_status == YAHOO_STATUS_CUSTOM) | |
| 1263 yahoo_packet_hash(pkt, 19, msg); | |
| 1264 | |
| 1265 yahoo_send_packet(yd, pkt); | |
| 1266 yahoo_packet_free(pkt); | |
| 1267 } | |
| 1268 | |
| 1269 static void yahoo_set_idle(struct gaim_connection *gc, int idle) | |
| 1270 { | |
| 1271 struct yahoo_data *yd = gc->proto_data; | |
| 1272 struct yahoo_packet *pkt = NULL; | |
| 1273 | |
| 1274 if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) { | |
| 1275 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_IDLE, 0); | |
| 1276 yd->current_status = YAHOO_STATUS_IDLE; | |
| 1277 } else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { | |
| 1278 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0); | |
| 1279 yd->current_status = YAHOO_STATUS_AVAILABLE; | |
| 1280 } | |
| 1281 | |
| 1282 if (pkt) { | |
| 1283 char buf[4]; | |
| 1284 g_snprintf(buf, sizeof(buf), "%d", yd->current_status); | |
| 1285 yahoo_packet_hash(pkt, 10, buf); | |
| 1286 yahoo_send_packet(yd, pkt); | |
| 1287 yahoo_packet_free(pkt); | |
| 1288 } | |
| 1289 } | |
| 1290 | |
| 1291 static GList *yahoo_away_states(struct gaim_connection *gc) | |
| 1292 { | |
| 1293 GList *m = NULL; | |
| 1294 | |
| 1295 m = g_list_append(m, "Available"); | |
| 1296 m = g_list_append(m, "Be Right Back"); | |
| 1297 m = g_list_append(m, "Busy"); | |
| 1298 m = g_list_append(m, "Not At Home"); | |
| 1299 m = g_list_append(m, "Not At Desk"); | |
| 1300 m = g_list_append(m, "Not In Office"); | |
| 1301 m = g_list_append(m, "On Phone"); | |
| 1302 m = g_list_append(m, "On Vacation"); | |
| 1303 m = g_list_append(m, "Out To Lunch"); | |
| 1304 m = g_list_append(m, "Stepped Out"); | |
| 1305 m = g_list_append(m, "Invisible"); | |
| 1306 m = g_list_append(m, GAIM_AWAY_CUSTOM); | |
| 1307 | |
| 1308 return m; | |
| 1309 } | |
| 1310 | |
| 1311 static void yahoo_keepalive(struct gaim_connection *gc) | |
| 1312 { | |
| 1313 struct yahoo_data *yd = gc->proto_data; | |
| 1314 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0); | |
| 1315 yahoo_send_packet(yd, pkt); | |
| 1316 yahoo_packet_free(pkt); | |
| 1317 } | |
| 1318 | |
| 3466 | 1319 static void yahoo_add_buddy(struct gaim_connection *gc, const char *who) |
| 2681 | 1320 { |
| 1321 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 1322 struct yahoo_packet *pkt; | |
| 1323 struct group *g; | |
| 1324 char *group = NULL; | |
| 1325 | |
| 1326 if (!yd->logged_in) | |
| 1327 return; | |
| 1328 | |
| 1329 g = find_group_by_buddy(gc, who); | |
| 1330 if (g) | |
| 1331 group = g->name; | |
| 1332 else | |
| 1333 group = "Buddies"; | |
| 1334 | |
| 1335 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); | |
| 1336 yahoo_packet_hash(pkt, 1, gc->displayname); | |
| 1337 yahoo_packet_hash(pkt, 7, who); | |
| 1338 yahoo_packet_hash(pkt, 65, group); | |
| 1339 yahoo_send_packet(yd, pkt); | |
| 1340 yahoo_packet_free(pkt); | |
| 1341 } | |
| 1342 | |
| 1343 static void yahoo_remove_buddy(struct gaim_connection *gc, char *who, char *group) | |
| 1344 { | |
| 1345 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 1346 | |
| 1347 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); | |
| 1348 yahoo_packet_hash(pkt, 1, gc->displayname); | |
| 1349 yahoo_packet_hash(pkt, 7, who); | |
| 1350 yahoo_packet_hash(pkt, 65, group); | |
| 1351 yahoo_send_packet(yd, pkt); | |
| 1352 yahoo_packet_free(pkt); | |
| 1353 } | |
| 1354 | |
| 3035 | 1355 |
| 1356 GSList *yahoo_smiley_list() | |
| 1357 { | |
| 1358 GSList *smilies = NULL; | |
| 1359 | |
| 1360 smilies = add_smiley(smilies, "=:)", yahoo_alien, 1); | |
| 1361 smilies = add_smiley(smilies, "=:-)", yahoo_alien, 0); | |
| 1362 smilies = add_smiley(smilies, "o:)", yahoo_angel, 0); | |
| 1363 smilies = add_smiley(smilies, "o:-)", yahoo_angel, 0); | |
| 1364 smilies = add_smiley(smilies, "0:)", yahoo_angel, 0); | |
| 1365 smilies = add_smiley(smilies, "0:-)", yahoo_angel, 0); | |
| 1366 smilies = add_smiley(smilies, "X-(", yahoo_angry, 1); | |
| 1367 smilies = add_smiley(smilies, "X(", yahoo_angry, 0); | |
| 1368 smilies = add_smiley(smilies, "x-(", yahoo_angry, 0); | |
| 1369 smilies = add_smiley(smilies, "x(", yahoo_angry, 0); | |
| 1370 smilies = add_smiley(smilies, ":D", yahoo_bigsmile, 1); | |
| 1371 smilies = add_smiley(smilies, ":-D", yahoo_bigsmile, 0); | |
| 1372 smilies = add_smiley(smilies, ":\">", yahoo_blush, 1); | |
| 1373 smilies = add_smiley(smilies, "=;", yahoo_bye, 1); | |
| 1374 smilies = add_smiley(smilies, ":o)", yahoo_clown, 1); | |
| 1375 smilies = add_smiley(smilies, ":0)", yahoo_clown, 0); | |
| 1376 smilies = add_smiley(smilies, ":O)", yahoo_clown, 0); | |
| 1377 smilies = add_smiley(smilies, "<@:)", yahoo_clown, 0); | |
| 1378 smilies = add_smiley(smilies, "3:-0", yahoo_cow, 1); | |
| 1379 smilies = add_smiley(smilies, "3:-o", yahoo_cow, 0); | |
| 1380 smilies = add_smiley(smilies, "3:-O", yahoo_cow, 0); | |
| 1381 smilies = add_smiley(smilies, "3:O", yahoo_cow, 0); | |
| 1382 smilies = add_smiley(smilies, "<):)", yahoo_cowboy, 1); | |
| 1383 smilies = add_smiley(smilies, ":((", yahoo_cry, 1); | |
| 1384 smilies = add_smiley(smilies, ":-((", yahoo_cry, 0); | |
| 1385 smilies = add_smiley(smilies, ">:)", yahoo_devil, 1); | |
| 1386 smilies = add_smiley(smilies, "@};-", yahoo_flower, 1); | |
| 1387 smilies = add_smiley(smilies, "8-X", yahoo_ghost, 1); | |
| 1388 smilies = add_smiley(smilies, ":B", yahoo_glasses, 1); | |
| 1389 smilies = add_smiley(smilies, ":-B", yahoo_glasses, 0); | |
| 1390 smilies = add_smiley(smilies, ":))", yahoo_laughloud, 1); | |
| 1391 smilies = add_smiley(smilies, ":-))", yahoo_laughloud, 0); | |
| 1392 smilies = add_smiley(smilies, ":x", yahoo_love, 1); | |
| 1393 smilies = add_smiley(smilies, ":-x", yahoo_love, 0); | |
| 1394 smilies = add_smiley(smilies, ":X", yahoo_love, 0); | |
| 1395 smilies = add_smiley(smilies, ":-X", yahoo_love, 0); | |
| 1396 smilies = add_smiley(smilies, ":>", yahoo_mean, 1); | |
| 1397 smilies = add_smiley(smilies, ":->", yahoo_mean, 0); | |
| 1398 smilies = add_smiley(smilies, ":|", yahoo_neutral, 1); | |
| 1399 smilies = add_smiley(smilies, ":-|", yahoo_neutral, 0); | |
| 1400 smilies = add_smiley(smilies, ":O", yahoo_ooooh, 1); | |
| 1401 smilies = add_smiley(smilies, ":-O", yahoo_ooooh, 0); | |
| 1402 smilies = add_smiley(smilies, ":-\\", yahoo_question, 1); | |
| 1403 smilies = add_smiley(smilies, ":-/", yahoo_question, 0); | |
| 1404 smilies = add_smiley(smilies, ":(", yahoo_sad, 1); | |
| 1405 smilies = add_smiley(smilies, ":-(", yahoo_sad, 0); | |
| 1406 smilies = add_smiley(smilies, "I-)", yahoo_sleep, 1); | |
| 1407 smilies = add_smiley(smilies, "|-)", yahoo_sleep, 0); | |
| 1408 smilies = add_smiley(smilies, "I-|", yahoo_sleep, 0); | |
| 1409 smilies = add_smiley(smilies, ":)", yahoo_smiley, 1); | |
| 1410 smilies = add_smiley(smilies, ":-)", yahoo_smiley, 0); | |
| 1411 smilies = add_smiley(smilies, "(:", yahoo_smiley, 0); | |
| 1412 smilies = add_smiley(smilies, "(-:", yahoo_smiley, 0); | |
| 1413 smilies = add_smiley(smilies, "B-)", yahoo_sunglas, 1); | |
| 1414 smilies = add_smiley(smilies, ":-p", yahoo_tongue, 1); | |
| 1415 smilies = add_smiley(smilies, ":p", yahoo_tongue, 0); | |
| 1416 smilies = add_smiley(smilies, ":P", yahoo_tongue, 0); | |
| 1417 smilies = add_smiley(smilies, ":-P", yahoo_tongue, 0); | |
| 1418 smilies = add_smiley(smilies, ";)", yahoo_wink, 1); | |
| 1419 smilies = add_smiley(smilies, ";-)", yahoo_wink, 0); | |
| 1420 | |
| 1421 | |
| 1422 return smilies; | |
| 1423 } | |
| 1424 | |
| 2681 | 1425 static struct prpl *my_protocol = NULL; |
| 1426 | |
| 3630 | 1427 G_MODULE_EXPORT void yahoo_init(struct prpl *ret) { |
| 3572 | 1428 struct proto_user_opt *puo; |
| 2681 | 1429 ret->protocol = PROTO_YAHOO; |
| 1430 ret->options = OPT_PROTO_MAIL_CHECK; | |
| 3572 | 1431 ret->name = g_strdup("Yahoo"); |
| 2681 | 1432 ret->login = yahoo_login; |
| 1433 ret->close = yahoo_close; | |
| 1434 ret->buddy_menu = yahoo_buddy_menu; | |
| 1435 ret->list_icon = yahoo_list_icon; | |
| 1436 ret->actions = yahoo_actions; | |
| 1437 ret->do_action = yahoo_do_action; | |
| 1438 ret->send_im = yahoo_send_im; | |
| 1439 ret->away_states = yahoo_away_states; | |
| 1440 ret->set_away = yahoo_set_away; | |
| 1441 ret->set_idle = yahoo_set_idle; | |
| 1442 ret->keepalive = yahoo_keepalive; | |
| 1443 ret->add_buddy = yahoo_add_buddy; | |
| 1444 ret->remove_buddy = yahoo_remove_buddy; | |
| 2993 | 1445 ret->send_typing = yahoo_send_typing; |
| 3035 | 1446 ret->smiley_list = yahoo_smiley_list; |
| 2681 | 1447 |
| 3572 | 1448 puo = g_new0(struct proto_user_opt, 1); |
| 1449 puo->label = g_strdup("Pager Host:"); | |
| 1450 puo->def = g_strdup(YAHOO_PAGER_HOST); | |
| 1451 puo->pos = USEROPT_PAGERHOST; | |
| 1452 ret->user_opts = g_list_append(ret->user_opts, puo); | |
| 1453 | |
| 1454 puo = g_new0(struct proto_user_opt, 1); | |
| 1455 puo->label = g_strdup("Pager Port:"); | |
| 1456 puo->def = g_strdup("5050"); | |
| 1457 puo->pos = USEROPT_PAGERPORT; | |
| 1458 ret->user_opts = g_list_append(ret->user_opts, puo); | |
| 1459 | |
| 2681 | 1460 my_protocol = ret; |
| 1461 } | |
| 1462 | |
| 1463 #ifndef STATIC | |
| 1464 | |
| 3630 | 1465 G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) |
| 2681 | 1466 { |
| 3572 | 1467 yahoo_init(prpl); |
| 1468 prpl->plug->desc.api_version = PLUGIN_API_VERSION; | |
| 2681 | 1469 } |
| 1470 | |
| 1471 #endif |
