annotate src/protocols/yahoo/yahoo.c @ 3063:22c84cbcd5a6

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