annotate src/protocols/oscar/oscar.c @ 3458:66b1ad9782a9

[gaim-migrate @ 3506] From KingAnt: aim.h: -Change the #defines for AIM client info so they're shorter. -Add 2 #defines for ICQ--the first one (the default) is what Gaim has been using, it was taken out of auth.c. The other is what an ICQ 2002a client uses. -Add an CLIENTINFO_ICQ_KNOWNGOOD auth.c: -Have the ICQ login use the given client info, rather than using hard coded values. oscar.c: -Rename "gaim_caps" to "caps_aim" and added a "caps_icq," so AIM and ICQ can have different capabilities. -Make changes to gaim_parse_login so the ICQ sends ICQ client info, and AIM sends AIM client info. -Make changes to conninitdone_bos so only ICQ sets the privacy flag and visibility mask. AIM sets this via SSI. -Change a few calls to aim_bos_setprofile so ICQ does not send a profile TLV, and so ICQ uses the ICQ caps and AIM uses the AIM caps. -Change a call to g_show_info_text so a pointer to the window is not left haning around? -Correctly set the occupied and do not disturb ICQ states. This is how winicq does it. -Correctly show winicq users as NA. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 28 Aug 2002 06:48:14 +0000
parents b48065e52337
children 7a3f16a375a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 /*
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 * gaim
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * (at your option) any later version.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * GNU General Public License for more details.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
25 #include <config.h>
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 #endif
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #include <netdb.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 #include <unistd.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include <errno.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include <netinet/in.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 #include <arpa/inet.h>
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
34 #include <ctype.h>
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 #include <string.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 #include <stdlib.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 #include <stdio.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 #include <time.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 #include <sys/socket.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 #include <sys/stat.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 #include "multi.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 #include "prpl.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 #include "gaim.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 #include "aim.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 #include "proxy.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46
2315
7ec21662ffc2 [gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2309
diff changeset
47 #include "pixmaps/ab.xpm"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 #include "pixmaps/admin_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 #include "pixmaps/aol_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 #include "pixmaps/away_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 #include "pixmaps/dt_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 #include "pixmaps/free_icon.xpm"
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
53 #include "pixmaps/wireless_icon.xpm"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
55 #include "pixmaps/gnomeicu-online.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
56 #include "pixmaps/gnomeicu-offline.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
57 #include "pixmaps/gnomeicu-away.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
58 #include "pixmaps/gnomeicu-dnd.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
59 #include "pixmaps/gnomeicu-na.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
60 #include "pixmaps/gnomeicu-occ.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
61 #include "pixmaps/gnomeicu-ffc.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
62
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 /* constants to identify proto_opts */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 #define USEROPT_AUTH 0
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 #define USEROPT_AUTHPORT 1
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
67 #define UC_AOL 0x02
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
68 #define UC_ADMIN 0x04
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
69 #define UC_UNCONFIRMED 0x08
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
70 #define UC_NORMAL 0x10
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
71 #define UC_AB 0x20
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
72 #define UC_WIRELESS 0x40
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
73
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
76 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
77 /* What does AIM_CAPS_ICQ actually mean? -SE */
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
78 /* static int caps_icq = AIM_CAPS_ICQ; */
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
79
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
80 /* Set AIM caps, because Gaim can still do them over ICQ and
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
81 * Winicq doesn't mind. */
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
82 static int caps_icq = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
83
2308
a90be9567452 [gaim-migrate @ 2318]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2305
diff changeset
84 static fu8_t gaim_features[] = {0x01, 0x01, 0x01, 0x02};
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 struct oscar_data {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
87 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
88 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 guint cnpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 guint paspa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
93 GSList *create_rooms;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 gboolean conf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 gboolean reqemail;
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
97 gboolean setemail;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
98 char *email;
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
99 gboolean setnick;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
100 char *newsn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 gboolean chpass;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 char *oldp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 char *newp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 GSList *oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 GSList *direct_ims;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 GSList *hasicons;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
109 gboolean killme;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
110 gboolean icq;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
111 GSList *evilhack;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
112
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
113 struct {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
114 guint maxbuddies; /* max users you can watch */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
115 guint maxwatchers; /* max users who can watch you */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
116 guint maxpermits; /* max users on permit list */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
117 guint maxdenies; /* max users on deny list */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
118 guint maxsiglen; /* max size (bytes) of profile */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
119 guint maxawaymsglen; /* max size (bytes) of posted away message */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
120 } rights;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
123 struct create_room {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
124 char *name;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
125 int exchange;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
126 };
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
127
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 struct chat_connection {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 char *name;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 char *show; /* AOL did something funny to us */
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
131 fu16_t exchange;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
132 fu16_t instance;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 int fd; /* this is redundant since we have the conn below */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
134 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 int inpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 int id;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 struct gaim_connection *gc; /* i hate this. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 struct conversation *cnv; /* bah. */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
139 int maxlen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
140 int maxvis;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 struct direct_im {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 char name[80];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 int watcher;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
147 aim_conn_t *conn;
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
148 gboolean connected;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 struct ask_direct {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 char *sn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
154 char ip[64];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
155 fu8_t cookie[8];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 struct icon_req {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 char *user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 time_t timestamp;
2196
016c5307f26b [gaim-migrate @ 2206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2194
diff changeset
161 unsigned long length;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2172
diff changeset
162 unsigned long checksum;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 gboolean request;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
166 struct channel4_data {
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
167 struct gaim_connection *gc;
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
168 gchar *uin;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
169 gchar *nick;
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
170 };
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
171
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
172 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 GSList *d = od->direct_ims;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174 char *n = g_strdup(normalize(who));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 struct direct_im *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 while (d) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 m = (struct direct_im *)d->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 if (!strcmp(n, normalize(m->name)))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 d = d->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
189 static char *extract_name(const char *name) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 char *tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 int i, j;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 char *x = strchr(name, '-');
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 if (!x) return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 x = strchr(++x, '-');
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 if (!x) return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 tmp = g_strdup(++x);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 for (i = 0, j = 0; x[i]; i++) {
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
199 char hex[3];
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
200 if (x[i] != '%') {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 tmp[j++] = x[i];
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
202 continue;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 }
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
204 strncpy(hex, x + ++i, 2); hex[2] = 0;
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
205 i++;
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
206 tmp[j++] = strtol(hex, NULL, 16);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 tmp[j] = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 return tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 while (g) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 c = (struct chat_connection *)g->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 if (c->id == id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 g = g->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 return c;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
229 aim_conn_t *conn) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 while (g) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 c = (struct chat_connection *)g->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 if (c->conn == conn)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 g = g->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 return c;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
244 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
245 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
246 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
247 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
248 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
249 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
250 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
251 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
252 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
253 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
254 static int gaim_parse_user_info (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
255 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
256 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
257 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
258 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
259 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
260 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
261 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
262 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
263 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
264 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
265 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
266 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
267 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
268 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
269 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
270 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
271 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
272 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
273 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
274 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
275 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
276 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
277 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
278 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
279 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
280 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
281 static int gaim_simpleinfo (aim_session_t *, aim_frame_t *, ...);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
282 static int gaim_popup (aim_session_t *, aim_frame_t *, ...);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
283 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
284 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
285
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
286 static int gaim_directim_initiate(aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
287 static int gaim_directim_incoming(aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
288 static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
289 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 static char *msgerrreason[] = {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 "Invalid error",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 "Invalid SNAC",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 "Rate to host",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 "Rate to client",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 "Not logged in",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 "Service unavailable",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 "Service not defined",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 "Obsolete SNAC",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 "Not supported by host",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 "Not supported by client",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 "Refused by client",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 "Reply too big",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 "Responses lost",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 "Request denied",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 "Busted SNAC payload",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 "Insufficient rights",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308 "In local permit/deny",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 "Too evil (sender)",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 "Too evil (receiver)",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 "User temporarily unavailable",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 "No match",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 "List overflow",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 "Request ambiguous",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 "Queue full",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 "Not while on AOL"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 static int msgerrreasonlen = 25;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
320 static void gaim_directim_disconnect(aim_session_t *sess, aim_conn_t *conn) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
321 struct gaim_connection *gc = sess->aux_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
322 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
323 struct conversation *cnv;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
324 struct direct_im *dim;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
325 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
326 char buf[256];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
327
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
328 sn = g_strdup(aim_directim_getsn(conn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
329
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
330 debug_printf("%s disconnected Direct IM.\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
331
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
332 dim = find_direct_im(od, sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
333 od->direct_ims = g_slist_remove(od->direct_ims, dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
334 gaim_input_remove(dim->watcher);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
335
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
336 if (dim->connected)
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
337 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
338 else
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
339 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
340
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
341 if ((cnv = find_conversation(sn)))
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
342 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
343 update_progress(cnv, 100);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
344
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
345 g_free(dim); /* I guess? I don't see it anywhere else... -- mid */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
346 g_free(sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
347
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
348 return;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
349 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
350
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 static void oscar_callback(gpointer data, gint source,
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
352 GaimInputCondition condition) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
353 aim_conn_t *conn = (aim_conn_t *)data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
354 aim_session_t *sess = aim_conn_getsess(conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 struct gaim_connection *gc = sess ? sess->aux_data : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 struct oscar_data *odata;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 if (!gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 /* gc is null. we return, else we seg SIGSEG on next line. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 debug_printf("oscar callback for closed connection (1).\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 /* oh boy. this is probably bad. i guess the only thing we
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 * can really do is return? */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 debug_printf("oscar callback for closed connection (2).\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
373 if (condition & GAIM_INPUT_READ) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375 debug_printf("got information on rendezvous\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 if (aim_handlerendconnect(odata->sess, conn) < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 debug_printf(_("connection error (rend)\n"));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
378 aim_conn_kill(odata->sess, &conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 if (aim_get_command(odata->sess, conn) >= 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 aim_rxdispatch(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 if (odata->killme)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 if ((conn->type == AIM_CONN_TYPE_BOS) ||
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 debug_printf(_("major connection error\n"));
3074
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3068
diff changeset
389 hide_login_progress_error(gc, _("Disconnected."));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 debug_printf("disconnected from chat room %s\n", c->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 c->conn = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 if (c->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
397 gaim_input_remove(c->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398 c->inpa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399 c->fd = -1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
402 do_error_dialog(buf, NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 if (odata->cnpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
405 gaim_input_remove(odata->cnpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 odata->cnpa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 debug_printf("removing chatnav input watcher\n");
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
408 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
409 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
410 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
411 odata->create_rooms =
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
412 g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
413 g_free(cr);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
414 do_error_dialog(_("Chat is currently unavailable"), NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418 if (odata->paspa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
419 gaim_input_remove(odata->paspa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 odata->paspa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421 debug_printf("removing authconn input watcher\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
424 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
425 gaim_directim_disconnect(odata->sess, conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
426 else {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
427 debug_printf("No handler for rendezvous disconnect (%d).\n",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
428 source);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
429 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 debug_printf("holy crap! generic connection error! %d\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 conn->type);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
441 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442 char *s = g_strdup_vprintf(format, va);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443 char buf[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444 char *t;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448 t = g_strconcat(buf, s, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 debug_printf(t);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 if (t[strlen(t)-1] != '\n')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451 debug_printf("\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 g_free(t);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453 g_free(s);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
455
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
456 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
460 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
461 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
471
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 hide_login_progress(gc, _("Couldn't connect to host"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
478 aim_conn_completeconnect(sess, conn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
479 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
480 oscar_callback, conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481 debug_printf(_("Password sent, waiting for response\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484 static void oscar_login(struct aim_user *user) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
485 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
486 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
487 char buf[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
488 struct gaim_connection *gc = new_gaim_conn(user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490
2589
4e149a0b9665 [gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2507
diff changeset
491 if (isdigit(*user->username)) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
492 odata->icq = TRUE;
2589
4e149a0b9665 [gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2507
diff changeset
493 /* this is odd but it's necessary for a proper do_import and do_export */
4e149a0b9665 [gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2507
diff changeset
494 gc->protocol = PROTO_ICQ;
3064
f0aaea918717 [gaim-migrate @ 3078]
Sean Egan <seanegan@gmail.com>
parents: 3063
diff changeset
495 gc->password[8] = 0;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
496 } else {
2590
2dd86a1af92b [gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2589
diff changeset
497 gc->protocol = PROTO_TOC;
2918
4df759d607f3 [gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2916
diff changeset
498 gc->flags |= OPT_CONN_HTML;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
499 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
501 sess = g_new0(aim_session_t, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 aim_setdebuggingcb(sess, oscar_debug);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 /* we need an immediate queue because we don't use a while-loop to
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 * see if things need to be sent. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 odata->sess = sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 sess->aux_data = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 if (conn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 debug_printf(_("internal connection error\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 hide_login_progress(gc, _("Unable to login to AIM"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 set_login_progress(gc, 2, buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
522
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
523 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526 conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
527 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529 user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 oscar_login_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 if (conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 hide_login_progress(gc, _("Couldn't connect to host"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
536 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 aim_request_login(sess, conn, gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 static void oscar_close(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 while (odata->oscar_chats) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 struct chat_connection *n = odata->oscar_chats->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545 if (n->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
546 gaim_input_remove(n->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547 g_free(n->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548 g_free(n->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549 odata->oscar_chats = g_slist_remove(odata->oscar_chats, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
552 while (odata->direct_ims) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
553 struct direct_im *n = odata->direct_ims->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554 if (n->watcher > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
555 gaim_input_remove(n->watcher);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 odata->direct_ims = g_slist_remove(odata->direct_ims, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559 while (odata->hasicons) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 struct icon_req *n = odata->hasicons->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 g_free(n->user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562 odata->hasicons = g_slist_remove(odata->hasicons, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
563 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 }
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
565 while (odata->evilhack) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
566 g_free(odata->evilhack->data);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
567 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
568 }
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
569 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
570 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
571 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
572 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
573 g_free(cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
574 }
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
575 if (odata->email)
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
576 g_free(odata->email);
2754
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
577 if (odata->newp)
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
578 g_free(odata->newp);
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
579 if (odata->oldp)
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
580 g_free(odata->oldp);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 if (gc->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
582 gaim_input_remove(gc->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 if (odata->cnpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
584 gaim_input_remove(odata->cnpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 if (odata->paspa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
586 gaim_input_remove(odata->paspa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587 aim_session_kill(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 g_free(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 odata->sess = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590 g_free(gc->proto_data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 gc->proto_data = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592 debug_printf(_("Signed off.\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
595 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
596 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
598 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
599 aim_conn_t *bosconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
603 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608 bosconn = odata->conn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 hide_login_progress(gc, _("Could Not Connect"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616 aim_conn_completeconnect(sess, bosconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
617 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 oscar_callback, bosconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 set_login_progress(gc, 4, _("Connection established, cookie sent"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
622 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
623 va_list ap;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
624 struct aim_authresp_info *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 int i; char *host; int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 struct aim_user *user;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
627 aim_conn_t *bosconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630 struct oscar_data *od = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 user = gc->user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632 port = user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
635 va_start(ap, fr);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
636 info = va_arg(ap, struct aim_authresp_info *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
639 debug_printf("inside auth_resp (Screen name: %s)\n", info->sn);
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
640
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
641 if (info->errorcode || !info->bosip || !info->cookie) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
642 switch (info->errorcode) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 case 0x05:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 /* Incorrect nick/password */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 hide_login_progress(gc, _("Incorrect nickname or password."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 plugin_event(event_error, (void *)980, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 case 0x11:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 /* Suspended account */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 hide_login_progress(gc, _("Your account is currently suspended."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 case 0x18:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653 /* connecting too frequently */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655 plugin_event(event_error, (void *)983, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 case 0x1c:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 /* client too old */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 plugin_event(event_error, (void *)989, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662 default:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663 hide_login_progress(gc, _("Authentication Failed"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
666 debug_printf("Login Error Code 0x%04x\n", info->errorcode);
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
667 debug_printf("Error URL: %s\n", info->errorurl);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
673 debug_printf("Reg status: %d\n", info->regstatus);
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
674 if (info->email) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
675 debug_printf("Email: %s\n", info->email);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677 debug_printf("Email is NULL\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
679 debug_printf("BOSIP: %s\n", info->bosip);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
680 debug_printf("Closing auth connection...\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
681 aim_conn_kill(sess, &fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
683 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
684 if (bosconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685 hide_login_progress(gc, _("Internal Error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
686 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
687 return 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
688 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
689
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
690 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
691 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
694 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
695 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
696 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
699 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
700 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
701 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
703 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
704 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
705 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
706 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
707 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
709 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
710 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
711 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
712 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
713 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
714 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0);
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
715 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0);
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
716 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
717 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
718 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
719 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_SIMPLEINFO, gaim_simpleinfo, 0);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
720 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
721 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
722 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
724 ((struct oscar_data *)gc->proto_data)->conn = bosconn;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
725 for (i = 0; i < (int)strlen(info->bosip); i++) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
726 if (info->bosip[i] == ':') {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
727 port = atoi(&(info->bosip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
728 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
729 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
730 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
731 host = g_strndup(info->bosip, i);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
732 bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733 bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
734 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
735 if (bosconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
736 hide_login_progress(gc, _("Could Not Connect"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
737 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
738 return 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
740 aim_sendcookie(sess, bosconn, info->cookie);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
741 gaim_input_remove(gc->inpa);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
742
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
743 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
744 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
745
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746 struct pieceofcrap {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748 unsigned long offset;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 unsigned long len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750 char *modname;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 int fd;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
752 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753 unsigned int inpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
754 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
756 static void damn_you(gpointer data, gint source, GaimInputCondition c)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
757 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758 struct pieceofcrap *pos = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
759 struct oscar_data *od = pos->gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 char in = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761 int x = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 unsigned char m[17];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764 while (read(pos->fd, &in, 1) == 1) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
765 if (in == '\n')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 x++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
767 else if (in != '\r')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 x = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 if (x == 2)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
770 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
771 in = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
772 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
773 if (in != '\n') {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
774 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
775 _("You may be disconnected shortly. You may want to use TOC until "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
776 "this is fixed. Check " WEBSITE " for updates."), GAIM_WARNING);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
777 gaim_input_remove(pos->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
778 close(pos->fd);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
779 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
780 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
781 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
782 read(pos->fd, m, 16);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
783 m[16] = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
784 debug_printf("Sending hash: ");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
785 for (x = 0; x < 16; x++)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786 debug_printf("%02x ", (unsigned char)m[x]);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
787 debug_printf("\n");
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
788 gaim_input_remove(pos->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
789 close(pos->fd);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
790 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
791 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
792 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
793
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
794 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795 struct pieceofcrap *pos = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
796 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
797
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
798 if (source < 0) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
799 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
800 _("You may be disconnected shortly. You may want to use TOC until "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
801 "this is fixed. Check " WEBSITE " for updates."), GAIM_WARNING);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803 g_free(pos->modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
804 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
805 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
806 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
807
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
808 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810 pos->offset, pos->len, pos->modname ? pos->modname : "");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811 write(pos->fd, buf, strlen(buf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
812 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
813 g_free(pos->modname);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
814 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
815 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
816 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
817
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
818 /* size of icbmui.ocm, the largest module in AIM 3.5 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
819 #define AIM_MAX_FILE_SIZE 98304
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
820
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
821 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
822 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
823 struct pieceofcrap *pos;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
824 fu32_t offset, len;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
825 char *modname;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
826 int fd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
827
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
828 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
829 offset = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
830 len = (fu32_t)va_arg(ap, unsigned long);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
831 modname = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
832 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
833
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
834 debug_printf("offset: %d, len: %d, file: %s\n", offset, len, modname ? modname : "aim.exe");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
835 if (len == 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
836 debug_printf("len is 0, hashing NULL\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
837 aim_sendmemblock(sess, fr->conn, offset, len, NULL,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
838 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
839 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
840 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
841 /* uncomment this when you're convinced it's right. remember, it's been wrong before.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
842 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
843 char *buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
844 int i = 8;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
845 if (modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
846 i += strlen(modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
847 buf = g_malloc(i);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
848 i = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
849 if (modname) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
850 memcpy(buf, modname, strlen(modname));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
851 i += strlen(modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
852 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
853 buf[i++] = offset & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
854 buf[i++] = (offset >> 8) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
855 buf[i++] = (offset >> 16) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
856 buf[i++] = (offset >> 24) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
857 buf[i++] = len & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
858 buf[i++] = (len >> 8) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
859 buf[i++] = (len >> 16) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
860 buf[i++] = (len >> 24) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
861 debug_printf("len + offset is invalid, hashing request\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
862 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
863 g_free(buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
864 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
865 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
866 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
867
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
868 pos = g_new0(struct pieceofcrap, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
869 pos->gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
870 pos->conn = fr->conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
871
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
872 pos->offset = offset;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
873 pos->len = len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
874 pos->modname = modname ? g_strdup(modname) : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
875
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
876 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
877 if (fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
879 g_free(pos->modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
880 g_free(pos);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
881 do_error_dialog(_("Gaim was Unable to get valid login hash."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
882 _("You may be disconnected shortly. You may want to use TOC until "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
883 "this is fixed. Check " WEBSITE " for updates."), GAIM_WARNING);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
884 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
885 pos->fd = fd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
886
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
887 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
888 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
889
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
890 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
891 char *key;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
892 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
893 struct gaim_connection *gc = sess->aux_data;
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
894 struct oscar_data *odata = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
895
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
896 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
897 key = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
898 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
899
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
900 if (odata->icq) {
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
901 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
902 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
903 } else {
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
904 #if 0
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
905 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
906 #endif
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
907 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
908 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
909 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
910
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
911 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
912 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
913
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
914 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
915 struct gaim_connection *gc = sess->aux_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
916 struct chat_connection *chatcon;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
917 static int id = 1;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
918
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
919 aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
920 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
921 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
922 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
923 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
924
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
925 aim_clientready(sess, fr->conn);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
926
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
927 chatcon = find_oscar_chat_by_conn(gc, fr->conn);
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
928 chatcon->id = id;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
929 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show);
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
930
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
931 return 1;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
932 }
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
933
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
934 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) {
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
935
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
936 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
937 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
938
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
939 aim_clientready(sess, fr->conn);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
940
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
941 aim_chatnav_reqrights(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
942
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
943 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
944 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
945
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
946 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
947 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
948 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
949 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
950 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
951
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
952 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
953 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
954 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
955 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
956
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
957 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
958 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
959 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
960
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
961 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
962 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
963 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
964 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
965 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
966
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
967 aim_conn_completeconnect(sess, tstconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
968 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
969 oscar_callback, tstconn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
970 debug_printf("chatnav: connected\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
971 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
972
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
973 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
974 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
975 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
976 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
977 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
978 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
979
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
980 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
981 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
982 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
983 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
984
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
985 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
986 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
987 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
988
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
989 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
990 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
991 debug_printf("unable to connect to authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
992 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
993 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
994
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
995 aim_conn_completeconnect(sess, tstconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
996 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
997 oscar_callback, tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
998 debug_printf("chatnav: connected\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
999 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1000
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1001 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1002 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1003 struct chat_connection *ccon = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1004 struct gaim_connection *gc = ccon->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1005 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1006 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1007 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1008
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1009 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1010 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1011 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1012 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1013 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1014 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1015 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1016
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1017 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1018 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1019 tstconn = ccon->conn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1020
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1021 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1022 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1023 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1024 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1025 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1026 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1027 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1028
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1029 aim_conn_completeconnect(sess, ccon->conn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1030 ccon->inpa = gaim_input_add(tstconn->fd,
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1031 GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1032 oscar_callback, tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1033 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1034 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1035
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1036 /* Hrmph. I don't know how to make this look better. --mid */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1037 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1038 va_list ap;
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1039 struct aim_redirect_data *redir;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1040 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1041 struct aim_user *user = gc->user;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1042 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1043 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1044 char *host;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1045 int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1046
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1047 port = user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1048 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1049
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1050 va_start(ap, fr);
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1051 redir = va_arg(ap, struct aim_redirect_data *);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1052 va_end(ap);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1053
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1054 for (i = 0; i < (int)strlen(redir->ip); i++) {
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1055 if (redir->ip[i] == ':') {
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1056 port = atoi(&(redir->ip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1057 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1058 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1059 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1060 host = g_strndup(redir->ip, i);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1061
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1062 switch(redir->group) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1063 case 0x7: /* Authorizer */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1064 debug_printf("Reconnecting with authorizor...\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1065 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1066 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1067 debug_printf("unable to reconnect with authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1068 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1069 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1070 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1071 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1072 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1073 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1074 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1075
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1076 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1077 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1078 if (tstconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1079 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1080 debug_printf("unable to reconnect with authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1081 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1082 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1083 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1084 aim_sendcookie(sess, tstconn, redir->cookie);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1085 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1086 case 0xd: /* ChatNav */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1087 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1088 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1089 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1090 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1091 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1092 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1093 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1094
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1095 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1096 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1097 if (tstconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1098 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1099 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1100 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1101 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1102 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1103 aim_sendcookie(sess, tstconn, redir->cookie);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1104 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1105 case 0xe: /* Chat */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1106 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1107 struct chat_connection *ccon;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1108
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1109 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1110 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1111 debug_printf("unable to connect to chat server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1112 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1113 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1114 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1115
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1116 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1117
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1118 ccon = g_new0(struct chat_connection, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1119 ccon->conn = tstconn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1120 ccon->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1121 ccon->fd = -1;
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1122 ccon->name = g_strdup(redir->chat.room);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1123 ccon->exchange = redir->chat.exchange;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1124 ccon->instance = redir->chat.instance;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1125 ccon->show = extract_name(redir->chat.room);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1126
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1127 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1128 ccon->conn->fd = proxy_connect(host, port, oscar_chat_connect, ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1129 if (ccon->conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1130 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1131 debug_printf("unable to connect to chat server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1132 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1133 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1134 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1135 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1136 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1137 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1138 aim_sendcookie(sess, tstconn, redir->cookie);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1139 debug_printf("Connected to chat room %s exchange %d\n", ccon->name, ccon->exchange);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1140 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1141 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1142 default: /* huh? */
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1143 debug_printf("got redirect for unknown service 0x%04x\n", redir->group);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1144 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1145 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1146
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1147 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1148 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1149 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1150
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1151 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1152 struct gaim_connection *gc = sess->aux_data;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1153 struct oscar_data *od = gc->proto_data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1154 aim_userinfo_t *info;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1155 time_t time_idle = 0, signon = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1156 int type = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1157 int caps = 0;
2305
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1158 char *tmp;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1159
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1160 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1161 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1162 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1163 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1164
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1165 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1166 caps = info->capabilities;
3267
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1167 if (info->flags & AIM_FLAG_ACTIVEBUDDY)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1168 type |= UC_AB;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1169
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1170 if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) {
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1171 if (info->flags & AIM_FLAG_UNCONFIRMED)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1172 type |= UC_UNCONFIRMED;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1173 if (info->flags & AIM_FLAG_ADMINISTRATOR)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1174 type |= UC_ADMIN;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1175 if (info->flags & AIM_FLAG_AOL)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1176 type |= UC_AOL;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1177 if (info->flags & AIM_FLAG_FREE)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1178 type |= UC_NORMAL;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1179 if (info->flags & AIM_FLAG_AWAY)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1180 type |= UC_UNAVAILABLE;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1181 if (info->flags & AIM_FLAG_WIRELESS)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1182 type |= UC_WIRELESS;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1183 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1184 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1185 type = (info->icqinfo.status << 7);
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3009
diff changeset
1186 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) &&
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3009
diff changeset
1187 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1188 type |= UC_UNAVAILABLE;
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3009
diff changeset
1189 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1190 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1191
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1192 if (caps & AIM_CAPS_ICQ)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1193 caps ^= AIM_CAPS_ICQ;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1194
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1195 if (info->present & AIM_USERINFO_PRESENT_IDLE) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1196 time(&time_idle);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1197 time_idle -= info->idletime*60;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1198 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1199
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1200 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1201 signon = time(NULL) - info->sessionlen;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1202
2305
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1203 tmp = g_strdup(normalize(gc->username));
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1204 if (!strcmp(tmp, normalize(info->sn)))
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1205 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1206 g_free(tmp);
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1207
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1208 serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon,
2713
34ddcb44a4d2 [gaim-migrate @ 2726]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2706
diff changeset
1209 time_idle, type, caps);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1210
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1211 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1212 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1213
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1214 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) {
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1215 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1216 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1217 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1218
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1219 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1220 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1221 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1222
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1223 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1224
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1225 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1226 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1227
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1228 static void cancel_direct_im(gpointer w, struct ask_direct *d) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1229 debug_printf("Freeing DirectIM prompts.\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1230
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1231 g_free(d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1232 g_free(d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1233 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1234
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1235 static void oscar_directim_callback(gpointer data, gint source, GaimInputCondition condition) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1236 struct direct_im *dim = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1237 struct gaim_connection *gc = dim->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1238 struct oscar_data *od = gc->proto_data;
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
1239 struct conversation *cnv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1240 char buf[256];
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1241 struct sockaddr name;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1242 socklen_t name_len = 1;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1243
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1244 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1245 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1246 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1247 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1248
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1249 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1250 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1251 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1252 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1253
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1254 if (dim->conn->fd != source)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1255 dim->conn->fd = source;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1256 aim_conn_completeconnect(od->sess, dim->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1257 if (!(cnv = find_conversation(dim->name)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1258 cnv = new_conversation(dim->name);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1259
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1260 /* This is the best way to see if we're connected or not */
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1261 if (getpeername(source, &name, &name_len) == 0) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1262 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1263 dim->connected = TRUE;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1264 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1265 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1266 od->direct_ims = g_slist_append(od->direct_ims, dim);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1267
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1268 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1269 oscar_callback, dim->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1270 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1271
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1272 static int accept_direct_im(gpointer w, struct ask_direct *d) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1273 struct gaim_connection *gc = d->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1274 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1275 struct direct_im *dim;
2945
6a26e125b623 [gaim-migrate @ 2958]
Rob Flynn <gaim@robflynn.com>
parents: 2943
diff changeset
1276 char *host; int port = 4443;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1277 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1278
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1279 debug_printf("Accepted DirectIM.\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1280
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1281 dim = find_direct_im(od, d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1282 if (dim) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1283 cancel_direct_im(w, d); /* 40 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1284 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1285 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1286 dim = g_new0(struct direct_im, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1287 dim->gc = d->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1288 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1289
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1290 dim->conn = aim_directim_connect(od->sess, d->sn, NULL, d->cookie);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1291 if (!dim->conn) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1292 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1293 cancel_direct_im(w, d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1294 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1295 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1296
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1297 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1298 gaim_directim_incoming, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1299 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1300 gaim_directim_typing, 0);
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3031
diff changeset
1301 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER,
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1302 gaim_update_ui, 0);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1303 for (i = 0; i < (int)strlen(d->ip); i++) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1304 if (d->ip[i] == ':') {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1305 port = atoi(&(d->ip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1306 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1307 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1308 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1309 host = g_strndup(d->ip, i);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1310 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1311 dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1312 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1313 if (dim->conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1314 aim_conn_kill(od->sess, &dim->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1315 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1316 cancel_direct_im(w, d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1317 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1318 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1319
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1320 cancel_direct_im(w, d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1321
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1322 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1323 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1324
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1325 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1326 char *tmp = g_malloc(BUF_LONG);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1327 struct gaim_connection *gc = sess->aux_data;
2273
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1328 int flags = 0;
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1329
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1330 if (args->icbmflags & AIM_IMFLAGS_AWAY)
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1331 flags |= IM_FLAG_AWAY;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1332
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1333 if (args->icbmflags & AIM_IMFLAGS_HASICON) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1334 struct oscar_data *od = gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1335 struct icon_req *ir = NULL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1336 GSList *h = od->hasicons;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1337 char *who = normalize(userinfo->sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1338 debug_printf("%s has an icon\n", userinfo->sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1339 while (h) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1340 ir = h->data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1341 if (!strcmp(ir->user, who))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1342 break;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1343 h = h->next;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1344 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1345 if (!h) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1346 ir = g_new0(struct icon_req, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1347 ir->user = g_strdup(who);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1348 od->hasicons = g_slist_append(od->hasicons, ir);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1349 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1350 if ((args->iconlen != ir->length) ||
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1351 (args->iconsum != ir->checksum) ||
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1352 (args->iconstamp != ir->timestamp))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1353 ir->request = TRUE;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1354 ir->length = args->iconlen;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1355 ir->checksum = args->iconsum;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1356 ir->timestamp = args->iconstamp;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1357 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1358
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1359 if (gc->user->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1360 FILE *file;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1361 struct stat st;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1362
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
1363 if (!stat(gc->user->iconfile, &st)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1364 char *buf = g_malloc(st.st_size);
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
1365 file = fopen(gc->user->iconfile, "r");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1366 if (file) {
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1367 int len = fread(buf, 1, st.st_size, file);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1368 debug_printf("Sending buddy icon to %s (%d bytes, %d reported)\n",
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1369 userinfo->sn, len, st.st_size);
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
1370 aim_send_icon(sess, userinfo->sn, buf, st.st_size,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1371 st.st_mtime, aim_iconsum(buf, st.st_size));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1372 fclose(file);
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1373 } else
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1374 debug_printf("Can't open buddy icon file!\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1375 g_free(buf);
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1376 } else
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1377 debug_printf("Can't stat buddy icon file!\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1378 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1379
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1380 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1381 * Quickly convert it to eight bit format, replacing
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1382 * non-ASCII UNICODE characters with their equivelent
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1383 * HTML entity.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1384 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1385 if (args->icbmflags & AIM_IMFLAGS_UNICODE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1386 int i;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1387
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1388 for (i = 0, tmp[0] = '\0'; i < args->msglen; i += 2) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1389 unsigned short uni;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1390
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1391 uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i+1] & 0xff);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1392
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1393 if ((uni < 128) || ((uni >= 160) && (uni <= 255))) { /* ISO 8859-1 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1394
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1395 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "%c", uni);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1396
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1397 } else { /* something else, do UNICODE entity */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1398 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "&#%04x;", uni);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1399 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1400 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1401 } else
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1402 g_snprintf(tmp, BUF_LONG, "%s", args->msg);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1403
2817
8ceb67d1645e [gaim-migrate @ 2830]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2799
diff changeset
1404 strip_linefeed(tmp);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
1405 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1406 g_free(tmp);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1407
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1408 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1409 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1410
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1411 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1412 struct gaim_connection *gc = sess->aux_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1413
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1414 debug_printf("rendezvous status %d (%s)\n", args->status, userinfo->sn);
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1415
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1416 if (args->status != AIM_RENDEZVOUS_PROPOSE)
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1417 return 1;
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1418
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1419 if (args->reqclass & AIM_CAPS_CHAT) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1420 char *name = extract_name(args->info.chat.roominfo.name);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1421 int *exch = g_new0(int, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1422 GList *m = NULL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1423 m = g_list_append(m, g_strdup(name ? name : args->info.chat.roominfo.name));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1424 *exch = args->info.chat.roominfo.exchange;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1425 m = g_list_append(m, exch);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1426 serv_got_chat_invite(gc,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1427 name ? name : args->info.chat.roominfo.name,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1428 userinfo->sn,
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1429 (char *)args->msg,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1430 m);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1431 if (name)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1432 g_free(name);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1433 } else if (args->reqclass & AIM_CAPS_SENDFILE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1434 } else if (args->reqclass & AIM_CAPS_GETFILE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1435 } else if (args->reqclass & AIM_CAPS_VOICE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1436 } else if (args->reqclass & AIM_CAPS_BUDDYICON) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1437 set_icon_data(gc, normalize(userinfo->sn), args->info.icon.icon,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1438 args->info.icon.length);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1439 } else if (args->reqclass & AIM_CAPS_IMIMAGE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1440 struct ask_direct *d = g_new0(struct ask_direct, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1441 char buf[256];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1442
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1443 debug_printf("%s received direct im request from %s (%s)\n",
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1444 gc->username, userinfo->sn, args->verifiedip);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1445
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1446 d->gc = gc;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1447 d->sn = g_strdup(userinfo->sn);
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1448 strncpy(d->ip, args->verifiedip, sizeof(d->ip));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1449 memcpy(d->cookie, args->cookie, 8);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1450 g_snprintf(buf, sizeof buf, "%s has just asked to directly connect to %s.",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1451 userinfo->sn, gc->username);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1452 do_ask_dialog(buf, d, accept_direct_im, cancel_direct_im);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1453 } else {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1454 debug_printf("Unknown reqclass %d\n", args->reqclass);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1455 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1456
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1457 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1458 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1459
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1460 /*
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1461 * Next 2 functions are for when other people ask you for authorization
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1462 */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1463 static void gaim_icq_authgrant(gpointer w, struct channel4_data *data) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1464 char message;
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1465 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1466 message = 0;
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1467 aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHGRANTED, &message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1468 show_got_added(data->gc, NULL, data->uin, NULL, NULL);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1469 g_free(data->uin);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1470 data->uin = NULL;
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1471 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1472
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1473 static void gaim_icq_authdeny(gpointer w, struct channel4_data *data) {
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1474 if (data->uin) {
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1475 gchar *message;
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1476 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1477 message = g_strdup_printf("No reason given.");
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1478 aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHDENIED, message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1479 g_free(data->uin);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1480 g_free(message);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1481 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1482 g_free(data);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1483 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1484
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1485 /*
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1486 * For when other people ask you for authorization
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1487 */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1488 static void gaim_icq_authask(struct gaim_connection *gc, fu32_t uin, char *msg) {
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1489 struct channel4_data *data = g_new(struct channel4_data, 1);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1490 /* The first 6 chars of the message are some type of alien gibberish, so skip them */
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
1491 char *dialog_msg = g_strdup_printf("The user %lu wants to add you to their buddy list for the following reason:\n\n%s", uin, (msg && strlen(msg)>6) ? msg+6 : "No reason given.");
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
1492 debug_printf("Received an authorization request from UIN %lu\n", uin);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1493 data->gc = gc;
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1494 data->uin = g_strdup_printf("%lu", uin);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1495 do_ask_dialog(dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1496 g_free(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1497 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1498
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1499 /*
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1500 * Next 2 functions are for when someone sends you contacts
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1501 */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1502 static void gaim_icq_contactadd(gpointer w, struct channel4_data *data) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1503 show_add_buddy(data->gc, data->uin, NULL, data->nick);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1504 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1505
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1506 static void gaim_icq_contactdontadd(gpointer w, struct channel4_data *data) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1507 free(data->uin);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1508 free(data->nick);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1509 g_free(data);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1510 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1511
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1512 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1513 struct gaim_connection *gc = sess->aux_data;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1514
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1515 switch (args->type)
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1516 {
3316
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1517 case 0x0001: { /* An almost-normal instant message. Mac ICQ sends this. It's peculiar. */
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1518 gchar *uin, *message;
3316
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1519 uin = g_strdup_printf("%lu", args->uin);
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1520 message = g_strdup(args->msg);
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1521 strip_linefeed(message);
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1522 serv_got_im(gc, uin, message, 0, time(NULL), -1);
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1523 g_free(uin);
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1524 g_free(message);
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1525 } break;
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
1526
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1527 case 0x0004: { /* Someone sent you a URL */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1528 gchar **text, *uin, *message;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1529 text = g_strsplit(args->msg, "þ", 2);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1530 if (text) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1531 uin = g_strdup_printf("%lu", args->uin);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1532 message = g_strdup_printf("<A HREF=\"%s\">%s</A>", text[1], text[0]);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1533 strip_linefeed(message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1534 serv_got_im(gc, uin, message, 0, time(NULL), -1);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1535 g_strfreev(text);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1536 g_free(uin);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1537 g_free(message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1538 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1539 } break;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1540
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1541 case 0x0006: { /* Someone requested authorization */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1542 gaim_icq_authask(gc, args->uin, args->msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1543 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1544
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1545 case 0x0007: { /* Someone has denied you authorization */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1546 char *dialog_msg;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
1547 dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, args->msg ? args->msg : _("No reason given."));
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1548 do_error_dialog(_("ICQ authorization denied."), dialog_msg, GAIM_ERROR);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1549 g_free(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1550 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1551
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1552 case 0x0008: { /* Someone has granted you authorization */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1553 char *dialog_msg;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
1554 dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1555 do_error_dialog("ICQ authorization accepted.", dialog_msg, GAIM_INFO);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1556 g_free(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1557 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1558
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1559 case 0x0012: {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1560 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1561 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1562
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1563 case 0x0013: { /* Someone has sent you some ICQ contacts */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1564 int i, num;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1565 gchar **text;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1566 text = g_strsplit(args->msg, "þ", 0);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1567 if (text) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1568 num = 0;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1569 for (i=0; i<strlen(text[0]); i++)
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1570 num = num*10 + text[0][i]-48;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1571 for (i=0; i<num; i++) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1572 struct channel4_data *data = g_new(struct channel4_data, 1);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1573 gchar *message = g_strdup_printf("ICQ user %lu has sent you a contact: %s (%s)\nDo you want to add this contact to your contact list?", args->uin, text[i*2+2], text[i*2+1]);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1574 data->gc = gc;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1575 data->uin = g_strdup(text[i*2+2]);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1576 data->nick = g_strdup(text[i*2+1]);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1577 do_ask_dialog(message, data, gaim_icq_contactadd, gaim_icq_contactdontadd);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1578 g_free(message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1579 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1580 g_strfreev(text);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1581 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1582 } break;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1583
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1584 case 0x001a: { /* Someone has requested that you send them from ICQ contacts */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1585 /* This is boring and silly. */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1586 } break;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1587
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1588 default: {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1589 debug_printf("Received a channel 4 message of unknown type (type 0x%04d).\n", args->type);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1590 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1591 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1592
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1593 return 1;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1594 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1595
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1596 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1597 int channel, ret = 0;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1598 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1599 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1600
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1601 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1602 channel = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1603 userinfo = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1604
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1605 switch (channel) {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1606 case 1: { /* standard message */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1607 struct aim_incomingim_ch1_args *args;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1608 args = va_arg(ap, struct aim_incomingim_ch1_args *);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1609 ret = incomingim_chan1(sess, fr->conn, userinfo, args);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1610 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1611
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1612 case 2: { /* rendevous */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1613 struct aim_incomingim_ch2_args *args;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1614 args = va_arg(ap, struct aim_incomingim_ch2_args *);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1615 ret = incomingim_chan2(sess, fr->conn, userinfo, args);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1616 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1617
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1618 case 4: { /* ICQ */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1619 struct aim_incomingim_ch4_args *args;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1620 args = va_arg(ap, struct aim_incomingim_ch4_args *);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1621 ret = incomingim_chan4(sess, fr->conn, userinfo, args);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1622 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1623
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1624 default: {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1625 debug_printf("ICBM received on unsupported channel (channel 0x%04d).", channel);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
1626 } break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1627 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1628
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1629 va_end(ap);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1630
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1631 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1632 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1633
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1634 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1635 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1636 fu16_t chan, nummissed, reason;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1637 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1638 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1639
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1640 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1641 chan = (fu16_t)va_arg(ap, unsigned int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1642 userinfo = va_arg(ap, aim_userinfo_t *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1643 nummissed = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1644 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1645 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1646
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1647 switch(reason) {
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1648 case 0:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1649 /* Invalid (0) */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1650 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1651 sizeof(buf),
2946
9ef2fae94c80 [gaim-migrate @ 2959]
Rob Flynn <gaim@robflynn.com>
parents: 2945
diff changeset
1652 nummissed == 1 ?
2947
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1653 _("You missed %d message from %s because it was invalid.") :
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1654 _("You missed %d messages from %s because they were invalid."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1655 nummissed,
2947
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1656 userinfo->sn);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1657 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1658 case 1:
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1659 /* Message too large */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1660 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1661 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1662 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1663 _("You missed %d message from %s because it was too large.") :
2946
9ef2fae94c80 [gaim-migrate @ 2959]
Rob Flynn <gaim@robflynn.com>
parents: 2945
diff changeset
1664 _("You missed %d messages from %s because they were too large."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1665 nummissed,
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1666 userinfo->sn);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1667 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1668 case 2:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1669 /* Rate exceeded */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1670 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1671 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1672 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1673 _("You missed %d message from %s because the rate limit has been exceeded.") :
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1674 _("You missed %d messages from %s because the rate limit has been exceeded."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1675 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1676 userinfo->sn);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1677 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1678 case 3:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1679 /* Evil Sender */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1680 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1681 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1682 nummissed == 1 ?
2947
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1683 _("You missed %d message from %s because it was too evil.") :
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1684 _("You missed %d messages from %s because they are too evil."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1685 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1686 userinfo->sn);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1687 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1688 case 4:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1689 /* Evil Receiver */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1690 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1691 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1692 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1693 _("You missed %d message from %s because you are too evil.") :
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1694 _("You missed %d messages from %s because you are too evil."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1695 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1696 userinfo->sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1697 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1698 default:
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1699 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1700 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1701 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1702 _("You missed %d message from %s for unknown reasons.") :
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1703 _("You missed %d messages from %s for unknown reasons."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1704 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1705 userinfo->sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1706 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1707 }
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1708 do_error_dialog(buf, NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1709
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1710 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1711 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1712
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1713 static char *gaim_icq_status(int state) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1714 /* Make a cute little string that shows the status of the dude or dudet */
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1715 if (state & AIM_ICQ_STATE_CHAT)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1716 return g_strdup_printf("Free For Chat");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1717 else if (state & AIM_ICQ_STATE_DND)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1718 return g_strdup_printf("Do Not Disturb");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1719 else if (state & AIM_ICQ_STATE_OUT)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1720 return g_strdup_printf("Not Available");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1721 else if (state & AIM_ICQ_STATE_BUSY)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1722 return g_strdup_printf("Occupied");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1723 else if (state & AIM_ICQ_STATE_AWAY)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1724 return g_strdup_printf("Away");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1725 else if (state & AIM_ICQ_STATE_WEBAWARE)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1726 return g_strdup_printf("Web Aware");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1727 else if (state & AIM_ICQ_STATE_INVISIBLE)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1728 return g_strdup_printf("Invisible");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1729 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1730 return g_strdup_printf("Online");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1731 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1732
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1733 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1734 struct gaim_connection *gc = sess->aux_data;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1735 va_list ap;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1736 fu16_t chan, reason;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1737 char *who;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1738
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1739 va_start(ap, fr);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1740 chan = (fu16_t)va_arg(ap, unsigned int);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1741 who = va_arg(ap, char *);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1742 reason = (fu16_t)va_arg(ap, unsigned int);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1743
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1744 switch(reason) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1745 case 0x0003: { /* Reply from an ICQ status message request */
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1746 int state = (int)va_arg(ap, fu32_t);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1747 char *msg = va_arg(ap, char *);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1748 char *status_msg = gaim_icq_status(state);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1749 char *dialog_msg, **splitmsg;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1750 struct oscar_data *od = gc->proto_data;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1751 GSList *l = od->evilhack;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1752 gboolean evilhack = FALSE;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1753
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1754 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1755 splitmsg = g_strsplit(msg, "\r\n", 0);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1756
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1757 /* If who is in od->evilhack, then we're just getting the away message, otherwise this
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1758 * will just get appended to the info box (which is already showing). */
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1759 while (l) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1760 char *x = l->data;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1761 if (!strcmp(x, normalize(who))) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1762 evilhack = TRUE;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1763 g_free(x);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1764 od->evilhack = g_slist_remove(od->evilhack, x);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1765 break;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1766 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1767 l = l->next;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1768 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1769
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1770 if (evilhack)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1771 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><BR>%s<BR>"), who, status_msg, g_strjoinv("<BR>", splitmsg));
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1772 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1773 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<BR><HR><BR>%s<BR>"), status_msg, g_strjoinv("<BR>", splitmsg));
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1774 g_show_info_text(gc, who, 2, dialog_msg, NULL);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1775
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1776 g_free(status_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1777 g_free(dialog_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1778 g_strfreev(splitmsg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1779 } break;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1780
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1781 default: {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1782 debug_printf("Received an unknown client auto-response from %s. Type 0x%04x\n", who, reason);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1783 } break;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1784 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1785 va_end(ap);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1786
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1787 return 1;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1788 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
1789
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1790 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1791 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1792 fu16_t reason;
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1793 char *m;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1794
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1795 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1796 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1797 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1798
2864
e22c09351e67 [gaim-migrate @ 2877]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
1799 debug_printf("snac threw error (reason 0x%04x: %s)\n", reason,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1800 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1801
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1802 m = g_strdup_printf(_("SNAC threw error: %s\n"),
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1803 reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1804 do_error_dialog(m, NULL, GAIM_ERROR);
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1805 g_free(m);
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1806
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1807 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1808 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1809
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1810 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1811 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1812 char *destn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1813 fu16_t reason;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1814 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1815
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1816 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1817 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1818 destn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1819 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1820
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1821 sprintf(buf, _("Your message to %s did not get sent: %s"), destn);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1822 do_error_dialog(buf, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("No reason was given."), GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1823
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1824 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1825 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1826
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1827 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1828 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1829 char *destn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1830 fu16_t reason;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1831 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1832
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1833 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1834 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1835 destn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1836 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1837
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1838 sprintf(buf, _("User information for %s unavailable: %s"), destn);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1839 do_error_dialog(buf, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("No reason was given."), GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1840
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1841 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1842 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1843
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1844 static char *images(int flags) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1845 static char buf[1024];
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1846 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
2679
94aa499ecd39 [gaim-migrate @ 2692]
Adam Fritzler <mid@auk.cx>
parents: 2675
diff changeset
1847 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1848 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1849 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "",
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1850 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1851 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "",
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1852 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "",
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1853 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : "");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1854 return buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1855 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1856
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1857
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1858 /* XXX This is horribly copied from ../../buddy.c. */
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1859 static char *caps_string(guint caps)
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1860 {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1861 static char buf[512], *tmp;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1862 int count = 0, i = 0;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1863 guint bit = 1;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1864 while (bit <= 0x10000) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1865 if (bit & caps) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1866 switch (bit) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1867 case 0x1:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1868 tmp = _("Buddy Icon");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1869 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1870 case 0x2:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1871 tmp = _("Voice");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1872 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1873 case 0x4:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1874 tmp = _("IM Image");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1875 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1876 case 0x8:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1877 tmp = _("Chat");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1878 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1879 case 0x10:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1880 tmp = _("Get File");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1881 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1882 case 0x20:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1883 tmp = _("Send File");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1884 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1885 case 0x40:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1886 case 0x200:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1887 tmp = _("Games");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1888 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1889 case 0x80:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1890 tmp = _("Stocks");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1891 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1892 case 0x100:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1893 tmp = _("Send Buddy List");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1894 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1895 case 0x400:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1896 tmp = _("EveryBuddy Bug");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1897 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1898 case 0x800:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1899 tmp = _("AP User");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1900 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1901 case 0x1000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1902 tmp = _("ICQ RTF");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1903 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1904 case 0x2000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1905 tmp = _("Nihilist");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1906 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1907 case 0x4000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1908 tmp = _("ICQ Server Relay");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1909 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1910 case 0x8000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1911 tmp = _("ICQ Unknown");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1912 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1913 case 0x10000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1914 tmp = _("Trillian Encryption");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1915 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1916 default:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1917 tmp = NULL;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1918 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1919 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1920 if (tmp)
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1921 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1922 tmp);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1923 count++;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1924 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1925 bit <<= 1;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1926 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1927 return buf;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1928 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1929
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1930 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) {
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1931 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1932 char *prof_enc = NULL, *prof = NULL;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1933 fu16_t infotype;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1934 char header[BUF_LONG];
2137
18722ae5b882 [gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2131
diff changeset
1935 char legend[BUF_LONG];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1936 struct gaim_connection *gc = sess->aux_data;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1937 struct oscar_data *od = gc->proto_data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1938 GSList *l = od->evilhack;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1939 gboolean evilhack = FALSE;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1940 va_list ap;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1941 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1942
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1943 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1944 info = va_arg(ap, aim_userinfo_t *);
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1945 infotype = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1946 prof_enc = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1947 prof = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1948 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1949
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1950 if (!od->icq) {
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1951 g_snprintf(legend, sizeof legend,
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1952 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1953 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1954 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1955 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1956 "<IMG SRC=\"admin_icon.gif\"> : Administrator <br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1957 "<IMG SRC=\"ab_icon.gif\"> : ActiveBuddy Interactive Agent<br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1958 "<IMG SRC=\"wireless_icon.gif\"> : Wireless Device User<br>"));
3106
d3cb7d47fcb4 [gaim-migrate @ 3120]
Sean Egan <seanegan@gmail.com>
parents: 3101
diff changeset
1959 } else {
d3cb7d47fcb4 [gaim-migrate @ 3120]
Sean Egan <seanegan@gmail.com>
parents: 3101
diff changeset
1960 legend[0] = 0;
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1961 }
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
1962
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1963 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1964 onlinesince = g_strdup_printf("Online Since : <B>%s</B><BR>\n",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1965 asctime(localtime(&info->onlinesince)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1966 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1967
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1968 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1969 membersince = g_strdup_printf("Member Since : <B>%s</B><BR>\n",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1970 asctime(localtime(&info->membersince)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1971 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1972
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1973 if (info->present & AIM_USERINFO_PRESENT_IDLE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1974 idle = g_strdup_printf("Idle : <B>%d minutes</B>",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1975 info->idletime);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1976 } else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1977 idle = g_strdup("Idle: <B>Active</B>");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1978
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1979 g_snprintf(header, sizeof header,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1980 _("Username : <B>%s</B> %s <BR>\n"
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1981 "Warning Level : <B>%d %%</B><BR>\n"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1982 "%s"
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1983 "%s"
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1984 "%s<BR>\n"
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1985 "<HR><BR>\n"),
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1986 info->sn, images(info->flags),
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1987 info->warnlevel/10,
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1988 onlinesince ? onlinesince : "",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1989 membersince ? membersince : "",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1990 idle ? idle : "");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1991
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1992 g_free(onlinesince);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1993 g_free(membersince);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1994 g_free(idle);
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1995
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1996 while (l) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1997 char *x = l->data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1998 if (!strcmp(x, normalize(info->sn))) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1999 evilhack = TRUE;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2000 g_free(x);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2001 od->evilhack = g_slist_remove(od->evilhack, x);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2002 break;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2003 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2004 l = l->next;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2005 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2006
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2007 if (infotype == AIM_GETINFO_AWAYMESSAGE) {
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2008 if (evilhack) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2009 g_show_info_text(gc, info->sn, 2,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2010 header,
2797
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
2011 (prof && *prof) ? away_subs(prof, gc->username) :
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2012 _("<i>User has no away message</i>"),
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2013 legend, NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2014 } else {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2015 g_show_info_text(gc, info->sn, 0,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2016 header,
2797
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
2017 (prof && *prof) ? away_subs(prof, gc->username) : NULL,
2799
72357bddb0f3 [gaim-migrate @ 2812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2797
diff changeset
2018 (prof && *prof) ? "<BR><HR><BR>" : NULL,
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2019 NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2020 }
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2021 } else if (infotype == AIM_GETINFO_CAPABILITIES) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2022 g_show_info_text(gc, info->sn, 2,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2023 header,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2024 "<i>", _("Client Capabilities: "),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2025 caps_string(info->capabilities),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2026 "</i>",
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2027 legend,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2028 NULL);
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2029 } else {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2030 g_show_info_text(gc, info->sn, 1,
2797
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
2031 (prof && *prof) ? away_subs(prof, gc->username) :
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
2032 _("<i>No Information Provided</i>"),
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2033 legend,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2034 NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2035 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2036
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2037 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2038 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2039
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2040 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2041 char *msg;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2042 fu16_t id;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2043 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2044 char buildbuf[150];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2045
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2046 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2047 id = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2048 msg = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2049 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2050
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2051 aim_getbuildstring(buildbuf, sizeof(buildbuf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2052
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2053 debug_printf("MOTD: %s (%d)\n", msg ? msg : "Unknown", id);
2092
59b0377d18aa [gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2054 if (id < 4)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2055 do_error_dialog(_("Your AIM connection may be lost."), NULL, GAIM_WARNING);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2056
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2057 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2058 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2059
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2060 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2061 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2062 fu16_t type;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2063 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2064 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2065
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2066 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2067 type = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2068
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2069 switch(type) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2070 case 0x0002: {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2071 fu8_t maxrooms;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2072 struct aim_chat_exchangeinfo *exchanges;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2073 int exchangecount, i;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2074
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2075 maxrooms = (fu8_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2076 exchangecount = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2077 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2078 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2079
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2080 debug_printf("chat info: Chat Rights:\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2081 debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2082 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2083 for (i = 0; i < exchangecount; i++)
2931
10a2d4d5bcf2 [gaim-migrate @ 2944]
Adam Fritzler <mid@auk.cx>
parents: 2920
diff changeset
2084 debug_printf("chat info: \t\t%d %s\n", exchanges[i].number, exchanges[i].name ? exchanges[i].name : "");
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2085 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2086 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2087 debug_printf("creating room %s\n", cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2088 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2089 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2090 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2091 g_free(cr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2092 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2093 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2094 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2095 case 0x0008: {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2096 char *fqcn, *name, *ck;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2097 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2098 fu8_t createperms;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2099 fu32_t createtime;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2100
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2101 fqcn = va_arg(ap, char *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2102 instance = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2103 exchange = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2104 flags = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2105 createtime = va_arg(ap, fu32_t);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2106 maxmsglen = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2107 maxoccupancy = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2108 createperms = (fu8_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2109 unknown = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2110 name = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2111 ck = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2112 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2113
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2114 debug_printf("created room: %s %d %d %d %lu %d %d %d %d %s %s\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2115 fqcn,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2116 exchange, instance, flags,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2117 createtime,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2118 maxmsglen, maxoccupancy, createperms, unknown,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2119 name, ck);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2120 aim_chat_join(odata->sess, odata->conn, exchange, ck, instance);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2121 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2122 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2123 default:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2124 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2125 debug_printf("chatnav info: unknown type (%04x)\n", type);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2126 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2127 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2128 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2129 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2130
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2131 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2132 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2133 int count, i;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2134 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2135 struct gaim_connection *g = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2136
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2137 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2138
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2139 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2140 count = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2141 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2142 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2143
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2144 c = find_oscar_chat_by_conn(g, fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2145 if (!c)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2146 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2147
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2148 for (i = 0; i < count; i++)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2149 add_chat_buddy(c->cnv, info[i].sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2150
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2151 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2152 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2153
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2154 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2155 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2156 int count, i;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2157 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2158 struct gaim_connection *g = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2159
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2160 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2161
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2162 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2163 count = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2164 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2165 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2166
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2167 c = find_oscar_chat_by_conn(g, fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2168 if (!c)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2169 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2170
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2171 for (i = 0; i < count; i++)
2820
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2817
diff changeset
2172 remove_chat_buddy(c->cnv, info[i].sn, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2173
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2174 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2175 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2176
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2177 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) {
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2178 va_list ap;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2179 aim_userinfo_t *userinfo;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2180 struct aim_chat_roominfo *roominfo;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2181 char *roomname;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2182 int usercount;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2183 char *roomdesc;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2184 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2185 fu32_t creationtime;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2186 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2187 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2188
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2189 va_start(ap, fr);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2190 roominfo = va_arg(ap, struct aim_chat_roominfo *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2191 roomname = va_arg(ap, char *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2192 usercount= va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2193 userinfo = va_arg(ap, aim_userinfo_t *);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2194 roomdesc = va_arg(ap, char *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2195 unknown_c9 = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2196 creationtime = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2197 maxmsglen = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2198 unknown_d2 = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2199 unknown_d5 = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2200 maxvisiblemsglen = (fu16_t)va_arg(ap, int);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2201 va_end(ap);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2202
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2203 debug_printf("inside chat_info_update (maxmsglen = %d, maxvislen = %d)\n",
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2204 maxmsglen, maxvisiblemsglen);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2205
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2206 ccon->maxlen = maxmsglen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2207 ccon->maxvis = maxvisiblemsglen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2208
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2209 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2210 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2211
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2212 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2213 va_list ap;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2214 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2215 char *msg;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2216 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2217 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2218 char *tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2219
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2220 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2221 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2222 msg = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2223
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2224 tmp = g_malloc(BUF_LONG);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2225 g_snprintf(tmp, BUF_LONG, "%s", msg);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2226 serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2227 g_free(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2228
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2229 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2230 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2231
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2232 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2233 * Recieved in response to an IM sent with the AIM_IMFLAGS_ACK option.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2234 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2235 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2236 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2237 fu16_t type;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2238 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2239
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2240 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2241 type = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2242 sn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2243 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2244
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2245 debug_printf("Sent message to %s.\n", sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2246
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2247 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2248 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2249
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2250 static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2251 static const char *codes[5] = {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2252 "invalid",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2253 "change",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2254 "warning",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2255 "limit",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2256 "limit cleared",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2257 };
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2258 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2259 fu16_t code, rateclass;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2260 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2261
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2262 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2263 code = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2264 rateclass= (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2265 windowsize = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2266 clear = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2267 alert = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2268 limit = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2269 disconnect = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2270 currentavg = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2271 maxavg = (fu32_t)va_arg(ap, unsigned long);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2272 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2273
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2274 debug_printf("rate %s (paramid 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, "
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2275 "clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2276 (code < 5) ? codes[code] : codes[0],
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2277 rateclass,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2278 currentavg, maxavg,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2279 alert, clear,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2280 limit, disconnect,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2281 windowsize);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2282
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2283 /* XXX fix these values */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2284 if (code == AIM_RATE_CODE_CHANGE) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2285 if (currentavg >= clear)
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2286 aim_conn_setlatency(fr->conn, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2287 } else if (code == AIM_RATE_CODE_WARNING) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2288 aim_conn_setlatency(fr->conn, windowsize/4);
2909
48ec70928d7f [gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2906
diff changeset
2289 } else if (code == AIM_RATE_CODE_LIMIT) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2290 do_error_dialog(_("Rate limiting error."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2291 _("The last message was not sent because you are over the rate limit. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2292 "Please wait 10 seconds and try again."), GAIM_ERROR);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2293 aim_conn_setlatency(fr->conn, windowsize/2);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2294 } else if (code == AIM_RATE_CODE_CLEARLIMIT) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2295 aim_conn_setlatency(fr->conn, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2296 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2297
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2298 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2299 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2300
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2301 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2302 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2303 fu16_t newevil;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2304 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2305 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2306
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2307 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2308 newevil = (fu16_t)va_arg(ap, unsigned int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2309 userinfo = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2310 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2311
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2312 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, newevil / 10);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2313
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2314 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2315 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2316
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2317 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) {
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2318 va_list ap;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2319 aim_userinfo_t *info;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2320 struct gaim_connection *gc = sess->aux_data;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2321
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2322 va_start(ap, fr);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2323 info = va_arg(ap, aim_userinfo_t *);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2324 va_end(ap);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2325
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2326 gc->evil = info->warnlevel/10;
2698
e80f4b4f840f [gaim-migrate @ 2711]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2689
diff changeset
2327 /* gc->correction_time = (info->onlinesince - gc->login_time); */
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2328
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2329 return 1;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2330 }
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2331
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
2332 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) {
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2333 struct gaim_connection *gc = sess->aux_data;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2334 struct oscar_data *od = gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2335
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2336 aim_reqpersonalinfo(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2337 aim_bos_reqlocaterights(sess, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2338 aim_bos_reqbuddyrights(sess, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2339
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
2340 aim_reqicbmparams(sess);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2341
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2342 aim_bos_reqrights(sess, fr->conn);
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2343 if (od->icq) {
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2344 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2345 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE |
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2346 AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2347 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2348
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2349 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2350 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2351
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
2352 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) {
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2353 struct gaim_connection *gc = sess->aux_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2354 struct oscar_data *od = gc->proto_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2355
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
2356 aim_clientready(sess, fr->conn);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
2357 debug_printf("connected to admin\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2358
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2359 if (od->chpass) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2360 debug_printf("changing password\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2361 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2362 g_free(od->oldp);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2363 od->oldp = NULL;
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2364 g_free(od->newp);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2365 od->newp = NULL;
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2366 od->chpass = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2367 }
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2368 if (od->setnick) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2369 debug_printf("formatting screenname\n");
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2370 aim_admin_setnick(sess, fr->conn, od->newsn);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2371 g_free(od->newsn);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2372 od->newsn = NULL;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2373 od->setnick = FALSE;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2374 }
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2375 if (od->conf) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2376 debug_printf("confirming account\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2377 aim_admin_reqconfirm(sess, fr->conn);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2378 od->conf = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2379 }
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2380 if (od->reqemail) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2381 debug_printf("requesting email\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2382 aim_admin_getinfo(sess, fr->conn, 0x0011);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2383 od->reqemail = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2384 }
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2385 if (od->setemail) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2386 debug_printf("setting email\n");
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2387 aim_admin_setemail(sess, fr->conn, od->email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2388 g_free(od->email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2389 od->setemail = FALSE;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2390 }
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2391
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2392 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2393 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2394
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2395 static int gaim_icbm_param_info(aim_session_t *sess, aim_frame_t *fr, ...) {
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2396 struct aim_icbmparameters *params;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2397 va_list ap;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2398
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2399 va_start(ap, fr);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2400 params = va_arg(ap, struct aim_icbmparameters *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2401 va_end(ap);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2402
2427
5bc3b39fc0a5 [gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2421
diff changeset
2403 /* evidently this crashes on solaris. i have no clue why
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2404 debug_printf("ICBM Parameters: maxchannel = %d, default flags = 0x%08lx, max msg len = %d, "
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2405 "max sender evil = %f, max receiver evil = %f, min msg interval = %ld\n",
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2406 params->maxchan, params->flags, params->maxmsglen,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2407 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2408 params->minmsginterval);
2427
5bc3b39fc0a5 [gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2421
diff changeset
2409 */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2410
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2411 /* Maybe senderwarn and recverwarn should be user preferences... */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2412 params->maxmsglen = 8000;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2413 params->minmsginterval = 0;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2414
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
2415 aim_seticbmparam(sess, params);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2416
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2417 return 1;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2418 }
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2419
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2420 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2421 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2422 va_list ap;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2423 fu16_t maxsiglen;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2424 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2425 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2426
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2427 va_start(ap, fr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2428 maxsiglen = va_arg(ap, int);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2429 va_end(ap);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2430
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2431 debug_printf("locate rights: max sig len = %d\n", maxsiglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2432
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2433 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2434
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2435 if (odata->icq)
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2436 aim_bos_setprofile(sess, fr->conn, NULL, NULL, caps_icq);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2437 else
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2438 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, caps_aim);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2439
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2440 return 1;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2441 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2442
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2443 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) {
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2444 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2445 fu16_t maxbuddies, maxwatchers;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2446 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2447 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2448
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2449 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2450 maxbuddies = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2451 maxwatchers = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2452 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2453
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2454 debug_printf("buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2455
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2456 odata->rights.maxbuddies = (guint)maxbuddies;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2457 odata->rights.maxwatchers = (guint)maxwatchers;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2458
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2459 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2460 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2461
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2462 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2463 fu16_t maxpermits, maxdenies;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2464 va_list ap;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2465 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2466 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2467
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2468 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2469 maxpermits = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2470 maxdenies = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2471 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2472
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2473 debug_printf("BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2474
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2475 odata->rights.maxpermits = (guint)maxpermits;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2476 odata->rights.maxdenies = (guint)maxdenies;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2477
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2478 account_online(gc);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2479 serv_finish_login(gc);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2480
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2481 if (bud_list_cache_exists(gc))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2482 do_import(gc, NULL);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2483
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2484 debug_printf("buddy list loaded\n");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2485
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
2486 aim_clientready(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2487
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2488 aim_icq_reqofflinemsgs(sess);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2489
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2490 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2491
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
2492 if (!odata->icq) {
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
2493 debug_printf("ssi: requesting ssi list\n");
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
2494 aim_ssi_reqrights(sess, fr->conn);
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
2495 aim_ssi_reqdata(sess, fr->conn, sess->ssi.timestamp, sess->ssi.revision);
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
2496 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2497
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2498 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2499 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2500
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2501 static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) {
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2502 va_list ap;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2503 struct aim_icq_offlinemsg *msg;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2504 struct gaim_connection *gc = sess->aux_data;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2505
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2506 va_start(ap, fr);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2507 msg = va_arg(ap, struct aim_icq_offlinemsg *);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2508 va_end(ap);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2509
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2510 debug_printf("Received offline message of type 0x%04x\n", msg->type);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2511
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2512 switch (msg->type) {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2513 case 0x0001: { /* Basic offline message */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2514 char sender[32];
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2515 char *dialog_msg = g_strdup(msg->msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2516 time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2517 g_snprintf(sender, sizeof(sender), "%lu", msg->sender);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2518 strip_linefeed(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2519 serv_got_im(gc, sender, dialog_msg, 0, t, -1);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2520 g_free(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2521 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2522
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2523 case 0x0006: { /* Authorization request */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2524 gaim_icq_authask(gc, msg->sender, msg->msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2525 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2526
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2527 case 0x0007: { /* Someone has denied you authorization */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2528 char *dialog_msg;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
2529 dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), msg->sender, msg->msg ? msg->msg : _("No reason given."));
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2530 do_error_dialog(_("ICQ Authorization denied"), dialog_msg, GAIM_ERROR);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2531 g_free(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2532 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2533
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2534 case 0x0008: { /* Someone has granted you authorization */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2535 char *dialog_msg;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
2536 dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), msg->sender);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2537 do_error_dialog(_("ICQ Authorization Granted"), dialog_msg, GAIM_INFO);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2538 g_free(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2539 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2540
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2541 case 0x0012: {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2542 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2543 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2544
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2545 default: {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2546 debug_printf("unknown offline message type 0x%04x\n", msg->type);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2547 }
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2548 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2549
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2550 return 1;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2551 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2552
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2553 static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...)
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2554 {
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2555 aim_icq_ackofflinemsgs(sess);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2556 return 1;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2557 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2558
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2559 static int gaim_simpleinfo(aim_session_t *sess, aim_frame_t *fr, ...)
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2560 {
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2561 struct gaim_connection *gc = sess->aux_data;
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2562 struct buddy *budlight;
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2563 va_list ap;
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2564 struct aim_icq_simpleinfo *info;
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2565 char buf[16 * 1024];
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2566 char who[16];
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2567
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2568 va_start(ap, fr);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2569 info = va_arg(ap, struct aim_icq_simpleinfo *);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2570 va_end(ap);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2571
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2572 g_snprintf(who, sizeof who, "%lu", info->uin);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2573 g_snprintf(buf, sizeof buf,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2574 "<B>UIN:</B> %lu<BR>"
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2575 "<B>Nick:</B> %s<BR>"
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2576 "<B>Name:</B> %s %s<BR>"
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2577 "<B>Email:</B> %s<BR>\n",
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2578 info->uin,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2579 info->nick,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2580 info->first, info->last,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2581 info->email);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2582
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2583 /* If the contact is away, then we also want to get their status message
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2584 * and show it in the same window as info. g_show_info_text gets the status
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2585 * message if the third arg is 0 (this seems really gross to me). The
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2586 * parse-icq-status-message function knows if it is putting it's message in
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2587 * an info window because the name will _not_ be in od->evilhack. For getting
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2588 * only the away message the contact's UIN is put in od->evilhack. */
3279
86fdd015f40e [gaim-migrate @ 3297]
Sean Egan <seanegan@gmail.com>
parents: 3270
diff changeset
2589 if ((budlight = find_buddy(gc, who))) {
3270
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2590 if ((budlight->uc >> 7) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) {
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2591 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2592 g_show_info_text(gc, who, 0, buf, NULL);
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2593 else {
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2594 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7);
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2595 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, "<BR>\n<HR><BR><I>Remote client does not support sending status messages.</I><BR>\n", NULL);
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2596 free(state_msg);
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2597 }
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2598 } else {
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2599 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7);
3270
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2600 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, NULL);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2601 free(state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2602 }
3270
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2603 } else
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
2604 g_show_info_text(gc, who, 2, buf, NULL);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2605
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2606 return 1;
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2607 }
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2608
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2609 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...)
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2610 {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2611 char *msg, *url;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2612 fu16_t wid, hei, delay;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2613 va_list ap;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2614
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2615 va_start(ap, fr);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2616 msg = va_arg(ap, char *);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2617 url = va_arg(ap, char *);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2618 wid = (fu16_t)va_arg(ap, int);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2619 hei = (fu16_t)va_arg(ap, int);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2620 delay = (fu16_t)va_arg(ap, int);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2621 va_end(ap);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2622
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2623 serv_got_popup(msg, url, wid, hei);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2624
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2625 return 1;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2626 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2627
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2628 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2629 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2630 char *address, *SNs;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2631 int i, num;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2632 char *buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2633 int at = 0, len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2634
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2635 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2636 address = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2637 num = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2638 SNs = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2639 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2640
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2641 len = num * (MAXSNLEN + 1) + 1024;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2642 buf = g_malloc(len);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2643 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2644 for (i = 0; i < num; i++)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2645 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2646 g_show_info_text(NULL, NULL, 2, buf, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2647 g_free(buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2648
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2649 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2650 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2651
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2652 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2653 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2654 char *address;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2655 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2656
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2657 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2658 address = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2659 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2660
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2661 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2662 do_error_dialog(buf, NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2663
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2664 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2665 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2666
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2667 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2668 fu16_t status;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2669 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2670 char msg[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2671 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2672
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2673 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2674 status = (fu16_t)va_arg(ap, unsigned int); /* status code of confirmation request */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2675 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2676
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2677 debug_printf("account confirmation returned status 0x%04x (%s)\n", status,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2678 status ? "email sent" : "unknown");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2679 if (status) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2680 g_snprintf(msg, sizeof(msg), "You should receive an email asking to confirm %s.",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2681 gc->username);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2682 do_error_dialog("Account confirmation requested.", msg, GAIM_INFO);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2683 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2684
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2685 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2686 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2687
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2688 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2689 int change, str;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2690 fu16_t perms, type, length;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2691 char *val;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2692 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2693 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2694 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2695
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2696 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2697 change = va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2698 perms = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2699 type = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2700 length = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2701 val = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2702 str = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2703 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2704
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2705 debug_printf("info%s: perms = %d, type = %x, length = %d, val = %s\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2706 change ? " change" : "", perms, type, length, str ? val : "(not string)");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2707
3186
51e4fb38a140 [gaim-migrate @ 3203]
Sean Egan <seanegan@gmail.com>
parents: 3159
diff changeset
2708 /* XXX Do something for other types too. */
51e4fb38a140 [gaim-migrate @ 3203]
Sean Egan <seanegan@gmail.com>
parents: 3159
diff changeset
2709 if ((type == 0x0011) && str && length) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2710 g_snprintf(buf, sizeof(buf), "The email address for %s is %s", gc->username, val);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2711 do_error_dialog(buf, NULL, GAIM_INFO);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2712 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2713
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2714 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2715 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2716
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2717 static void oscar_keepalive(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2718 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2719 aim_flap_nop(odata->sess, odata->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2720 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2721
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2722 static char *oscar_name() {
3089
b061bfc314bc [gaim-migrate @ 3103]
Rob Flynn <gaim@robflynn.com>
parents: 3079
diff changeset
2723 return "AIM / ICQ";
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2724 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2725
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 3000
diff changeset
2726 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) {
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2727 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2728 struct direct_im *dim = find_direct_im(odata, name);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2729 if (!dim)
2998
6fe330f1b951 [gaim-migrate @ 3011]
Sean Egan <seanegan@gmail.com>
parents: 2995
diff changeset
2730 return 0;
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 3000
diff changeset
2731 aim_send_typing(odata->sess, dim->conn, typing);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2732 return 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2733 }
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
2734 static void oscar_ask_direct_im(struct gaim_connection *gc, char *name);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2735
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3031
diff changeset
2736 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2737 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2738 struct direct_im *dim = find_direct_im(odata, name);
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2739 int ret = 0;
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2740
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2741 if (dim) {
3009
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
2742 if (dim->connected) { /* If we're not connected yet, send through server */
3034
4f43ccaf4360 [gaim-migrate @ 3047]
Sean Egan <seanegan@gmail.com>
parents: 3033
diff changeset
2743 ret = aim_send_im_direct(odata->sess, dim->conn, message, len == -1 ? strlen(message) : len);
3009
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
2744 if (ret == 0)
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
2745 return 1;
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
2746 else return ret;
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
2747 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2748 debug_printf("Direct IM pending, but not connected; sending through server\n");
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2749 } else if (len != -1) {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2750 /* Trying to send an IM image outside of a direct connection. */
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2751 oscar_ask_direct_im(gc, name);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2752 return -ENOTCONN;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2753 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2754 if (imflags & IM_FLAG_AWAY) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2755 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2756 } else {
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2757 struct aim_sendimext_args args;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2758 GSList *h = odata->hasicons;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2759 struct icon_req *ir = NULL;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2760 char *who = normalize(name);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2761 struct stat st;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2762
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2763 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2764 if (odata->icq)
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2765 args.flags |= AIM_IMFLAGS_OFFLINE;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2766
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2767 args.features = gaim_features;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2768 args.featureslen = sizeof(gaim_features);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2769
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2770 while (h) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2771 ir = h->data;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2772 if (ir->request && !strcmp(who, ir->user))
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2773 break;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2774 h = h->next;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2775 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2776 if (h) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2777 ir->request = FALSE;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2778 args.flags |= AIM_IMFLAGS_BUDDYREQ;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2779 debug_printf("sending buddy icon request with message\n");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2780 }
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2781
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2782 if (gc->user->iconfile[0] && !stat(gc->user->iconfile, &st)) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2783 FILE *file = fopen(gc->user->iconfile, "r");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2784 if (file) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2785 char *buf = g_malloc(st.st_size);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2786 fread(buf, 1, st.st_size, file);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2787
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2788 args.iconlen = st.st_size;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2789 args.iconsum = aim_iconsum(buf, st.st_size);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2790 args.iconstamp = st.st_mtime;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2791
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2792 args.flags |= AIM_IMFLAGS_HASICON;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2793 debug_printf("Claiming to have an icon.\n");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2794
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2795 fclose(file);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2796 g_free(buf);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2797 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2798 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2799
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2800 args.destsn = name;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2801 args.msg = message;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2802 args.msglen = strlen(message);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2803
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2804 ret = aim_send_im_ext(odata->sess, &args);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2805
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2806 }
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2807 if (ret >= 0)
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2808 return 1;
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2809 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2810 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2811
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2812 static void oscar_get_info(struct gaim_connection *g, char *name) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2813 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2814 if (odata->icq)
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2815 aim_icq_getsimpleinfo(odata->sess, name);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2816 else
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2817 /* people want the away message on the top, so we get the away message
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2818 * first and then get the regular info, since it's too difficult to
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2819 * insert in the middle. i hate people. */
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2820 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2821 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2822
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2823 static void oscar_get_away(struct gaim_connection *g, char *who) {
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2824 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2825 if (odata->icq) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2826 struct buddy *budlight = find_buddy(g, who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2827 if (budlight)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2828 if ((budlight->uc & 0xff80) >> 7)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2829 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2830 aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2831 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2832 debug_printf("Error: Remote client does not support retrieval of status messages.\n");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2833 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2834 debug_printf("Error: The user %s has no status message, therefore not requesting.\n", who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2835 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2836 debug_printf("Error: Could not find %s in local contact list, therefore unable to request status message.\n", who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2837 } else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2838 aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_GENERALINFO);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2839 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2840
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2841 static void oscar_get_caps(struct gaim_connection *g, char *name) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2842 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2843 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_CAPABILITIES);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2844 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2845
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2846 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2847 char *maiden, char *city, char *state, char *country, int web) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2848 /* FIXME : some of these things are wrong, but i'm lazy */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2849 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2850 aim_setdirectoryinfo(odata->sess, odata->conn, first, middle, last,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2851 maiden, NULL, NULL, city, state, NULL, 0, web);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2852 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2853
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2854
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2855 static void oscar_set_idle(struct gaim_connection *g, int time) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2856 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2857 aim_bos_setidle(odata->sess, odata->conn, time);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2858 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2859
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2860 static void oscar_set_info(struct gaim_connection *g, char *info) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2861 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2862 gchar *inforeal;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2863
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2864 if (odata->rights.maxsiglen == 0)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2865 do_error_dialog(_("Unable to set AIM profile."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2866 _("You have probably requested to set your profile before the login procedure completed. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2867 "Your profile remains unset; try setting it again when you are fully connected."), GAIM_ERROR);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2868
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2869 if (strlen(info) > odata->rights.maxsiglen) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2870 gchar *errstr;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2871
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2872 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2873 "Gaim has truncated and set it."), odata->rights.maxsiglen);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2874 do_error_dialog("Profile too long.", errstr, GAIM_WARNING);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2875
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2876 g_free(errstr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2877 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2878
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2879 inforeal = g_strndup(info, odata->rights.maxsiglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2880
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2881 if (odata->icq)
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2882 aim_bos_setprofile(odata->sess, odata->conn, NULL, NULL, caps_icq);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2883 else
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2884 aim_bos_setprofile(odata->sess, odata->conn, inforeal, NULL, caps_aim);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2885
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2886 g_free(inforeal);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2887
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2888 return;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2889 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2890
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2891 static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *message)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2892 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2893
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2894 if (od->rights.maxawaymsglen == 0)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2895 do_error_dialog(_("Unable to set AIM away message."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2896 _("You have probably requested to set your away message before the login procedure completed. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2897 "You remain in a \"present\" state; try setting it again when you are fully connected."), GAIM_ERROR);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2898
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2899 if (gc->away)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2900 g_free(gc->away);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2901 gc->away = NULL;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2902
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2903 if (!message) {
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2904 aim_bos_setprofile(od->sess, od->conn, NULL, "", caps_aim);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2905 return;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2906 }
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2907
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2908 if (strlen(message) > od->rights.maxawaymsglen) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2909 gchar *errstr;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2910
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2911 errstr = g_strdup_printf(_("The away message length of %d bytes has been exceeded. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2912 "Gaim has truncated it and set you away."), od->rights.maxawaymsglen);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2913 do_error_dialog("Away message too long.", errstr, GAIM_WARNING);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2914 g_free(errstr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2915 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2916
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2917 gc->away = g_strndup(message, od->rights.maxawaymsglen);
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
2918 aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, caps_aim);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2919
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2920 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2921 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2922
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2923 static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2924 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2925
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2926 if (gc->away)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2927 gc->away = NULL;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2928
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2929 if (!strcmp(state, "Online"))
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
2930 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2931 else if (!strcmp(state, "Away")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2932 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2933 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2934 } else if (!strcmp(state, "Do Not Disturb")) {
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2935 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2936 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2937 } else if (!strcmp(state, "Not Available")) {
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2938 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2939 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2940 } else if (!strcmp(state, "Occupied")) {
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2941 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2942 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2943 } else if (!strcmp(state, "Free For Chat")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2944 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2945 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2946 } else if (!strcmp(state, "Invisible")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2947 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2948 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2949 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) {
2998
6fe330f1b951 [gaim-migrate @ 3011]
Sean Egan <seanegan@gmail.com>
parents: 2995
diff changeset
2950 if (message) {
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2951 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2952 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2953 } else {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
2954 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2955 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2956 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2957
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2958 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2959 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2960
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2961 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2962 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2963 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2964
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2965 if (od->icq)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2966 oscar_set_away_icq(gc, od, state, message);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2967 else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2968 oscar_set_away_aim(gc, od, message);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2969
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2970 return;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2971 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2972
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2973 static void oscar_warn(struct gaim_connection *g, char *name, int anon) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2974 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2113
9f83b7ef1fdc [gaim-migrate @ 2123]
Adam Fritzler <mid@auk.cx>
parents: 2092
diff changeset
2975 aim_send_warning(odata->sess, odata->conn, name, anon ? AIM_WARN_ANON : 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2976 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2977
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2978 static void oscar_dir_search(struct gaim_connection *g, char *first, char *middle, char *last,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2979 char *maiden, char *city, char *state, char *country, char *email) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2980 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2981 if (strlen(email))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2982 aim_usersearch_address(odata->sess, odata->conn, email);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2983 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2984
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2985 static void oscar_add_buddy(struct gaim_connection *g, char *name) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2986 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
2987 if (odata->icq) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
2988 aim_add_buddy(odata->sess, odata->conn, name);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
2989 } else {
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
2990 if ((odata->sess->ssi.received_data) && !(aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000))) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
2991 debug_printf("ssi: adding buddy %s to group %s\n", name, find_group_by_buddy(g, name)->name);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
2992 aim_ssi_addbuddies(odata->sess, odata->conn, find_group_by_buddy(g, name)->name, &name, 1);
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
2993 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2994 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2995 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2996
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2997 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2998 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
2999 if (odata->icq) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3000 char buf[MSG_LEN];
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3001 int n=0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3002 while (buddies) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3003 if (n > MSG_LEN - 18) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3004 aim_bos_setbuddylist(odata->sess, odata->conn, buf);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3005 n = 0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3006 }
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3007 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3008 buddies = buddies->next;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3009 }
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3010 aim_bos_setbuddylist(odata->sess, odata->conn, buf);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3011 } else {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3012 if (odata->sess->ssi.received_data) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3013 int tmp;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3014 GSList *curgrp, *curbud;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3015 for (curgrp=g->groups; curgrp; curgrp=g_slist_next(curgrp)) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3016 tmp = 0;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3017 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3018 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000))
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3019 tmp++;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3020 if (tmp) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3021 char **sns = (char **)malloc(tmp*sizeof(char*));
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3022 tmp = 0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3023 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3024 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) {
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3025 debug_printf("ssi: adding buddy %s to group %s\n", ((struct buddy*)curbud->data)->name, ((struct group*)curgrp->data)->name);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3026 sns[tmp] = (char *)((struct buddy*)curbud->data)->name;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3027 tmp++;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3028 }
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3029 aim_ssi_addbuddies(odata->sess, odata->conn, ((struct group*)curgrp->data)->name, sns, tmp);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3030 free(sns);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3031 }
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3032 }
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3033 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3034 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3035 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3036
3140
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3037 static void oscar_move_buddy(struct gaim_connection *g, char *name, char *old_group, char *new_group) {
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3038 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3039 if (!odata->icq)
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3040 if (odata->sess->ssi.received_data) {
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3041 aim_ssi_movebuddy(odata->sess, odata->conn, old_group, new_group, name);
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3042 debug_printf("ssi: moved buddy %s from group %s to group %s\n", name, old_group, new_group);
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3043 }
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3044 }
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3045
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3046 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3047 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3048 if (odata->icq) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3049 aim_remove_buddy(odata->sess, odata->conn, name);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3050 } else {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3051 if (odata->sess->ssi.received_data) {
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3052 struct aim_ssi_item *ssigroup;
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3053 while (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000) && (ssigroup = aim_ssi_itemlist_findparent(odata->sess->ssi.items, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1))
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3054 debug_printf("ssi: deleted buddy %s from group %s\n", name, group);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3055 }
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3056 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3057 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3058
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3059 static void oscar_remove_buddies(struct gaim_connection *g, GList *buddies, char *group) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3060 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3061 if (odata->icq) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3062 GList *cur;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3063 for (cur=buddies; cur; cur=cur->next)
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3064 aim_remove_buddy(odata->sess, odata->conn, cur->data);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3065 } else {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3066 if (odata->sess->ssi.received_data) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3067 GList *cur;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3068 int tmp = 0;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3069 for (cur=buddies; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3070 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3071 tmp++;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3072 if (tmp) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3073 char **sns;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3074 sns = (char **)malloc(tmp*sizeof(char*));
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3075 tmp = 0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3076 for (cur=buddies; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3077 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000)) {
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3078 debug_printf("ssi: deleting buddy %s from group %s\n", cur->data, group);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3079 sns[tmp] = cur->data;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3080 tmp++;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3081 }
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3082 aim_ssi_delbuddies(odata->sess, odata->conn, group, sns, tmp);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3083 free(sns);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3084 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3085 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3086 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3087 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3088
3348
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3089 static void oscar_rename_group(struct gaim_connection *g, char *old_group, char *new_group, GList *members) {
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3090 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3091 if (!odata->icq)
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3092 if (odata->sess->ssi.received_data) {
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3093 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, new_group, 0x0001)) {
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3094 oscar_remove_buddies(g, members, old_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3095 oscar_add_buddies(g, members);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3096 debug_printf("ssi: moved all buddies from group %s to %s\n", old_group, new_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3097 } else {
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3098 aim_ssi_rename_group(odata->sess, odata->conn, old_group, new_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3099 debug_printf("ssi: renamed group %s to %s\n", old_group, new_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3100 }
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3101 }
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3102 }
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3103
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3104 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3105 /* XXX - Fix parsing of the ssi rights packet and pass us the data
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3106 fu16_t maxbuddies, maxgroups, maxpermits, maxdenies;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3107 va_list ap;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3108
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3109 va_start(ap, fr);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3110 maxbuddies = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3111 maxgroupss = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3112 maxpermits = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3113 maxdenies = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3114 va_end(ap);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3115
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3116 debug_printf("ssi rights: Max buddies = %d / Max groups = %d / Max permits = %d / Max denies = %d\n", maxbuddies, maxgroups, maxpermits, maxdenies);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3117 */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3118
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3119 return 1;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3120 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3121
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3122 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3123 struct gaim_connection *gc = sess->aux_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3124 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3125 struct aim_ssi_item *curitem;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3126 int tmp;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3127 char **sns;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3128
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3129 debug_printf("ssi: syncing local list and server list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3130
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3131 if (odata->icq)
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3132 return 1;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3133
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3134 /* Activate SSI */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3135 debug_printf("ssi: activating server-stored buddy list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3136 aim_ssi_enable(sess, fr->conn);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3137
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3138 /* Clean the buddy list */
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3139 aim_ssi_cleanlist(sess, fr->conn);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3140
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3141 /* Add from server list to local list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3142 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3143 for (curitem=sess->ssi.items; curitem; curitem=curitem->next) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3144 switch (curitem->type) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3145 case 0x0000: /* Buddy */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3146 if ((curitem->name) && (!find_buddy(gc, curitem->name))) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3147 struct aim_ssi_item *curgroup = sess->ssi.items;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3148 while (curgroup) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3149 if ((curgroup->type == 0x0001) && (curgroup->gid == curitem->gid) && (curgroup->name)) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3150 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, curgroup->name);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3151 add_buddy(gc, curgroup->name, curitem->name, 0);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3152 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3153 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3154 curgroup = curgroup->next;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3155 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3156 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3157 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3158
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3159 case 0x0002: /* Permit buddy */
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3160 if (curitem->name) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3161 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3162 for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3163 if (!list) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3164 char *name;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3165 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3166 name = g_strdup(normalize(curitem->name));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3167 gc->permit = g_slist_append(gc->permit, name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3168 build_allow_list();
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3169 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3170 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3171 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3172 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3173
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3174 case 0x0003: /* Deny buddy */
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3175 if (curitem->name) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3176 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3177 for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3178 if (!list) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3179 char *name;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3180 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3181 name = g_strdup(normalize(curitem->name));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3182 gc->deny = g_slist_append(gc->deny, name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3183 build_block_list();
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3184 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3185 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3186 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3187 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3188
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3189 case 0x0004: /* Permit/deny setting */
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3190 if (curitem->data) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3191 fu8_t permdeny;
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3192 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3193 debug_printf("ssi: changing permdeny from %d to %d\n", gc->permdeny, permdeny);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3194 gc->permdeny = permdeny;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3195 tmp++;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3196 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3197 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3198 break;
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3199
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3200 case 0x0005: /* Presence setting */
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3201 /* We don't want to change Gaim's setting because it applies to all accounts */
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3202 break;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3203 } /* End of switch on curitem->type */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3204 } /* End of for loop */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3205 if (tmp)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3206 do_export(gc);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3207
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3208 /* Add from local list to server list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3209 if (gc) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3210 GSList *cur;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3211
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3212 /* Buddies */
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3213 cur = gc->groups;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3214 while (cur) {
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3215 GSList *curbud;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3216 tmp = 0;
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3217 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3218 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3219 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3220 if (tmp) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3221 sns = (char **)malloc(tmp*sizeof(char*));
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3222 tmp = 0;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3223 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3224 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3225 debug_printf("ssi: adding buddy %s from local list to server list\n", ((struct buddy*)curbud->data)->name);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3226 sns[tmp] = ((char *)((struct buddy*)curbud->data)->name);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3227 tmp++;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3228 }
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3229 aim_ssi_addbuddies(sess, fr->conn, ((struct group*)cur->data)->name, sns, tmp);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3230 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3231 }
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3232 cur = g_slist_next(cur);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3233 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3234
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3235 /* Permit list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3236 if (gc->permit) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3237 tmp = 0;
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3238 for (cur=gc->permit; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3239 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3240 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3241 if (tmp) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3242 sns = (char **)malloc(tmp*sizeof(char*));
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3243 tmp = 0;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3244 for (cur=gc->permit; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3245 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002)) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3246 debug_printf("ssi: adding permit %s from local list to server list\n", cur->data);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3247 sns[tmp] = cur->data;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3248 tmp++;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3249 }
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3250 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_PERMIT);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3251 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3252 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3253 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3254
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3255 /* Deny list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3256 if (gc->deny) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3257 tmp = 0;
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3258 for (cur=gc->deny; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3259 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3260 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3261 if (tmp) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3262 sns = (char **)malloc(tmp*sizeof(char*));
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3263 tmp = 0;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3264 for (cur=gc->deny; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3265 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003)) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3266 debug_printf("ssi: adding deny %s from local list to server list\n", cur->data);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3267 sns[tmp] = cur->data;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3268 tmp++;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3269 }
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3270 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_DENY);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3271 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3272 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3273 }
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3274
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3275 /* Presence settings (idle time visibility) */
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3276 if ((tmp = aim_ssi_getpresence(sess->ssi.items)) != 0xFFFFFFFF)
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3277 if (report_idle && !(tmp & 0x400))
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3278 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400);
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3279
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3280 /* Check for maximum number of buddies */
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3281 for (cur=gc->groups, tmp=0; cur; cur=g_slist_next(cur)) {
3214
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
3282 struct group* gr = (struct group*)cur->data;
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
3283 tmp = tmp + g_slist_length(gr->members);
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
3284 }
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3285 if (tmp > odata->rights.maxbuddies) {
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3286 char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d."
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3287 " Until you are below the limit, some buddies will not show up as online."),
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3288 odata->rights.maxbuddies, tmp);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3289 do_error_dialog("Maximum buddy list length exceeded.", dialog_msg, GAIM_WARNING);
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3290 g_free(dialog_msg);
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3291 }
3214
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
3292
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3293 } /* end if (gc) */
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3294
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3295 return 1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3296 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3297
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3298 static GList *oscar_chat_info(struct gaim_connection *gc) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3299 GList *m = NULL;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3300 struct proto_chat_entry *pce;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3301
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3302 pce = g_new0(struct proto_chat_entry, 1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3303 pce->label = _("Join what group:");
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3304 m = g_list_append(m, pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3305
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3306 pce = g_new0(struct proto_chat_entry, 1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3307 pce->label = _("Exchange:");
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3308 pce->is_int = TRUE;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3309 pce->min = 4;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3310 pce->max = 20;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3311 m = g_list_append(m, pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3312
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3313 return m;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3314 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3315
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3316 static void oscar_join_chat(struct gaim_connection *g, GList *data) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3317 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3318 aim_conn_t *cur;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3319 char *name;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3320 int *exchange;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3321
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3322 if (!data || !data->next)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3323 return;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3324
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3325 name = data->data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3326 exchange = data->next->data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3327
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3328 debug_printf("Attempting to join chat room %s.\n", name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3329 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3330 debug_printf("chatnav exists, creating room\n");
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3331 aim_chatnav_createroom(odata->sess, cur, name, *exchange);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3332 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3333 /* this gets tricky */
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
3334 struct create_room *cr = g_new0(struct create_room, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3335 debug_printf("chatnav does not exist, opening chatnav\n");
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
3336 cr->exchange = *exchange;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
3337 cr->name = g_strdup(name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
3338 odata->create_rooms = g_slist_append(odata->create_rooms, cr);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3339 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3340 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3341 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3342
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3343 static void oscar_chat_invite(struct gaim_connection *g, int id, char *message, char *name) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3344 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3345 struct chat_connection *ccon = find_oscar_chat(g, id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3346
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3347 if (!ccon)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3348 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3349
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3350 aim_chat_invite(odata->sess, odata->conn, name, message ? message : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3351 ccon->exchange, ccon->name, 0x0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3352 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3353
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3354 static void oscar_chat_leave(struct gaim_connection *g, int id) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3355 struct oscar_data *odata = g ? (struct oscar_data *)g->proto_data : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3356 GSList *bcs = g->buddy_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3357 struct conversation *b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3358 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3359 int count = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3360
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3361 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3362 count++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3363 b = (struct conversation *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3364 if (id == b->id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3365 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3366 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3367 b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3368 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3369
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3370 if (!b)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3371 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3372
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3373 debug_printf("Attempting to leave room %s (currently in %d rooms)\n", b->name, count);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3374
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3375 c = find_oscar_chat(g, b->id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3376 if (c != NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3377 if (odata)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3378 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3379 if (c->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
3380 gaim_input_remove(c->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3381 if (g && odata->sess)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3382 aim_conn_kill(odata->sess, &c->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3383 g_free(c->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3384 g_free(c->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3385 g_free(c);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3386 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3387 /* we do this because with Oscar it doesn't tell us we left */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3388 serv_got_chat_left(g, b->id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3389 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3390
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3391 static int oscar_chat_send(struct gaim_connection *g, int id, char *message) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3392 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3393 GSList *bcs = g->buddy_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3394 struct conversation *b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3395 struct chat_connection *c = NULL;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3396 char *buf, *buf2;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3397 int i, j;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3398
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3399 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3400 b = (struct conversation *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3401 if (id == b->id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3402 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3403 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3404 b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3405 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3406 if (!b)
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3407 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3408
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3409 bcs = odata->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3410 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3411 c = (struct chat_connection *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3412 if (b == c->cnv)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3413 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3414 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3415 c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3416 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3417 if (!c)
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3418 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3419
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3420 buf = g_malloc(strlen(message) * 4 + 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3421 for (i = 0, j = 0; i < strlen(message); i++) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3422 if (message[i] == '\n') {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3423 buf[j++] = '<';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3424 buf[j++] = 'B';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3425 buf[j++] = 'R';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3426 buf[j++] = '>';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3427 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3428 buf[j++] = message[i];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3429 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3430 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3431 buf[j] = '\0';
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3432
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3433 if (strlen(buf) > c->maxlen)
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3434 return -E2BIG;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3435
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3436 buf2 = strip_html(buf);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3437 if (strlen(buf2) > c->maxvis) {
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3438 g_free(buf2);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3439 return -E2BIG;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3440 }
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3441 g_free(buf2);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3442
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3443 aim_chat_send_im(odata->sess, c->conn, 0, buf, strlen(buf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3444 g_free(buf);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3445 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3446 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3447
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3448 static char **oscar_list_icon(int uc) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3449 if (uc == 0)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3450 return (char **)icon_online_xpm;
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
3451 if (uc & 0xff80) {
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
3452 uc >>= 7;
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3453 if (uc & AIM_ICQ_STATE_INVISIBLE)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3454 return icon_offline_xpm;
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3455 if (uc & AIM_ICQ_STATE_CHAT)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3456 return icon_ffc_xpm;
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3457 if (uc & AIM_ICQ_STATE_DND)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3458 return icon_dnd_xpm;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3459 if (uc & AIM_ICQ_STATE_OUT)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3460 return icon_na_xpm;
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3461 if (uc & AIM_ICQ_STATE_BUSY)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3462 return icon_occ_xpm;
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3463 if (uc & AIM_ICQ_STATE_AWAY)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3464 return icon_away_xpm;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3465 return icon_online_xpm;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3466 }
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3467 if (uc & UC_UNAVAILABLE)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3468 return (char **)away_icon_xpm;
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
3469 if (uc & UC_WIRELESS)
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
3470 return (char **)wireless_icon_xpm;
2689
870450d36999 [gaim-migrate @ 2702]
Adam Fritzler <mid@auk.cx>
parents: 2681
diff changeset
3471 if (uc & UC_AB)
2679
94aa499ecd39 [gaim-migrate @ 2692]
Adam Fritzler <mid@auk.cx>
parents: 2675
diff changeset
3472 return (char **)ab_xpm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3473 if (uc & UC_AOL)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3474 return (char **)aol_icon_xpm;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3475 if (uc & UC_ADMIN)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3476 return (char **)admin_icon_xpm;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3477 if (uc & UC_UNCONFIRMED)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3478 return (char **)dt_icon_xpm;
2297
a0f6ead876ca [gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2288
diff changeset
3479 if (uc & UC_NORMAL)
a0f6ead876ca [gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2288
diff changeset
3480 return (char **)free_icon_xpm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3481 return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3482 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3483
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3484 static int gaim_directim_initiate(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3485 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3486 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3487 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3488 aim_conn_t *newconn, *listenerconn;
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
3489 struct conversation *cnv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3490 struct direct_im *dim;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3491 char buf[256];
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3492 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3493
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3494 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3495 newconn = va_arg(ap, aim_conn_t *);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3496 listenerconn = va_arg(ap, aim_conn_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3497 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3498
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3499 aim_conn_close(listenerconn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3500 aim_conn_kill(sess, &listenerconn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3501
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3502 sn = g_strdup(aim_directim_getsn(newconn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3503
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3504 debug_printf("DirectIM: initiate success to %s\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3505 dim = find_direct_im(od, sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3506
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3507 if (!(cnv = find_conversation(sn)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3508 cnv = new_conversation(sn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
3509 gaim_input_remove(dim->watcher);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3510 dim->conn = newconn;
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
3511 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3512 oscar_callback, dim->conn);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3513 dim->connected = TRUE;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3514 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3515 g_free(sn);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
3516 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3517
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3518 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3519 gaim_directim_incoming, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3520 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3521 gaim_directim_typing, 0);
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3031
diff changeset
3522 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER,
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3523 gaim_update_ui, 0);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3524 return 1;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3525 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3526
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3527 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3528 va_list ap;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3529 char *sn;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3530 double percent;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3531 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3532 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3533 struct conversation *c;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3534 struct direct_im *dim;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3535
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3536 va_start(ap, fr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3537 sn = va_arg(ap, char *);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3538 percent = va_arg(ap, double);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3539 va_end(ap);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3540
2994
60018f862a51 [gaim-migrate @ 3007]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
3541 if (!(dim = find_direct_im(od, sn)))
60018f862a51 [gaim-migrate @ 3007]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
3542 return 1;
3059
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
3543 if (dim->watcher) {
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
3544 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
3545 dim->watcher = 0;
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
3546 }
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3547 while (gtk_events_pending())
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3548 gtk_main_iteration();
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3549
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3550 if ((c = find_conversation(sn)))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3551 update_progress(c, percent);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3552 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3553 oscar_callback, dim->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3554
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3555 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3556 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3557
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3558 static int gaim_directim_incoming(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3559 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3560 char *msg, *sn;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3561 int len;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3562 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3563
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3564 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3565 sn = va_arg(ap, char *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3566 msg = va_arg(ap, char *);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3567 len = va_arg(ap, int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3568 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3569
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3570 debug_printf("Got DirectIM message from %s\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3571
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3572 serv_got_im(gc, sn, msg, 0, time(NULL), len);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3573
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3574 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3575 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3576
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3577 static int gaim_directim_typing(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3578 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3579 char *sn;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3580 int typing;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3581 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3582
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3583 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3584 sn = va_arg(ap, char *);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3585 typing = va_arg(ap, int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3586 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3587
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3588 if (typing) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3589 /* I had to leave this. It's just too funny. It reminds me of my sister. */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3590 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3591 serv_got_typing(gc,sn,0);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3592 } else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3593 serv_got_typing_stopped(gc,sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3594 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3595 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3596
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3597 struct ask_do_dir_im {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3598 char *who;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3599 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3600 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3601
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
3602 static void oscar_cancel_direct_im(gpointer obj, struct ask_do_dir_im *data) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3603 g_free(data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3604 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3605
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
3606 static void oscar_direct_im(gpointer obj, struct ask_do_dir_im *data) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3607 struct gaim_connection *gc = data->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3608 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3609 struct direct_im *dim;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3610
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3611 dim = find_direct_im(od, data->who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3612 if (dim) {
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3613 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3614 od->direct_ims = g_slist_remove(od->direct_ims, dim);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3615 gaim_input_remove(dim->watcher);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3616 g_free(dim);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3617 debug_printf("Gave up on old direct IM, trying again\n");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3618 } else {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3619 do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3620 return;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3621 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3622 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3623 dim = g_new0(struct direct_im, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3624 dim->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3625 g_snprintf(dim->name, sizeof dim->name, "%s", data->who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3626
2717
03bf072c6238 [gaim-migrate @ 2730]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2713
diff changeset
3627 dim->conn = aim_directim_initiate(od->sess, data->who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3628 if (dim->conn != NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3629 od->direct_ims = g_slist_append(od->direct_ims, dim);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
3630 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3631 oscar_callback, dim->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3632 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3633 gaim_directim_initiate, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3634 } else {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3635 do_error_dialog(_("Unable to open Direct IM"), NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3636 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3637 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3638 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3639
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3640 static void oscar_ask_direct_im(struct gaim_connection *gc, gchar *who) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3641 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3642 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3643 data->who = who;
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3644 data->gc = gc;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3645 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s."
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3646 " Doing this will let them see your IP address, and may be"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3647 " a security risk. Do you wish to continue?"), who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3648 do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3649 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3650
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3651 static void oscar_get_away_msg(struct gaim_connection *gc, char *who) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3652 struct oscar_data *od = gc->proto_data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3653 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who)));
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3654 if (od->icq) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3655 struct buddy *budlight = find_buddy(gc, who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3656 if (budlight)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3657 if ((budlight->uc >> 7) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT))
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3658 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3659 aim_send_im_ch2_geticqmessage(od->sess, who, (budlight->uc & 0xff80) >> 7);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3660 else {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3661 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3662 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><BR><I>Remote client does not support sending status messages.</I><BR>"), who, state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3663 g_show_info_text(gc, who, 2, dialog_msg, NULL);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3664 free(state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3665 free(dialog_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3666 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3667 else {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3668 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3669 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><BR><I>User has no status message.</I><BR>"), who, state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3670 g_show_info_text(gc, who, 2, dialog_msg, NULL);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3671 free(state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3672 free(dialog_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3673 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3674 else
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3675 do_error_dialog("Could not find contact in local list, therefore unable to request status message.\n", NULL, GAIM_ERROR);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3676 } else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3677 oscar_get_info(gc, who);
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3678 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3679
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3680 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) {
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3681 GList *m = NULL;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3682 struct proto_buddy_menu *pbm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3683 char *n = g_strdup(normalize(gc->username));
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3684 struct oscar_data *odata = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3685
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3686 pbm = g_new0(struct proto_buddy_menu, 1);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3687 pbm->label = _("Get Info");
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3688 pbm->callback = oscar_get_info;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3689 pbm->gc = gc;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3690 m = g_list_append(m, pbm);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3691
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3692 if (odata->icq) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3693 pbm = g_new0(struct proto_buddy_menu, 1);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3694 pbm->label = _("Get Status Msg");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3695 pbm->callback = oscar_get_away_msg;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3696 pbm->gc = gc;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3697 m = g_list_append(m, pbm);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3698 } else {
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3699 pbm = g_new0(struct proto_buddy_menu, 1);
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3700 pbm->label = _("Get Away Msg");
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3701 pbm->callback = oscar_get_away_msg;
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3702 pbm->gc = gc;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3703 m = g_list_append(m, pbm);
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3704
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3705 if (strcmp(n, normalize(who))) {
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3706 pbm = g_new0(struct proto_buddy_menu, 1);
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3707 pbm->label = _("Direct IM");
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3708 pbm->callback = oscar_ask_direct_im;
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3709 pbm->gc = gc;
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3710 m = g_list_append(m, pbm);
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3711 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3712 }
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3713
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3714 pbm = g_new0(struct proto_buddy_menu, 1);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3715 pbm->label = _("Get Capabilities");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3716 pbm->callback = oscar_get_caps;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3717 pbm->gc = gc;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3718 m = g_list_append(m, pbm);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3719
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3720 g_free(n);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3721
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3722 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3723 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3724
3456
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3725 static GList *oscar_edit_buddy_menu(struct gaim_connection *gc, char *who)
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3726 {
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3727 GList *m = NULL;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3728 struct proto_buddy_menu *pbm;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3729 struct oscar_data *odata = gc->proto_data;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3730
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3731 if (odata->icq) {
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3732 pbm = g_new0(struct proto_buddy_menu, 1);
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3733 pbm->label = _("Get Info");
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3734 pbm->callback = oscar_get_info;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3735 pbm->gc = gc;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3736 m = g_list_append(m, pbm);
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3737 }
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3738
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3739 return m;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3740 }
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3741
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3742 static GList *oscar_user_opts()
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3743 {
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3744 GList *m = NULL;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3745 struct proto_user_opt *puo;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3746
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3747 puo = g_new0(struct proto_user_opt, 1);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3748 puo->label = "Auth Host:";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3749 puo->def = "login.oscar.aol.com";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3750 puo->pos = USEROPT_AUTH;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3751 m = g_list_append(m, puo);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3752
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3753 puo = g_new0(struct proto_user_opt, 1);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3754 puo->label = "Auth Port:";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3755 puo->def = "5190";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3756 puo->pos = USEROPT_AUTHPORT;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3757 m = g_list_append(m, puo);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3758
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3759 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3760 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3761
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3762 static void oscar_set_permit_deny(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3763 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3764 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3765 GSList *list;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3766 char buf[MAXMSGLEN];
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3767 int at;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3768
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3769 switch(gc->permdeny) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3770 case 1:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3771 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3772 break;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3773 case 2:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3774 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3775 break;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3776 case 3:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3777 list = gc->permit;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3778 at = 0;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3779 while (list) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3780 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3781 list = list->next;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3782 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3783 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3784 break;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3785 case 4:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3786 list = gc->deny;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3787 at = 0;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3788 while (list) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3789 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3790 list = list->next;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3791 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3792 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3793 break;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3794 default:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3795 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3796 }
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3797 signoff_blocked(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3798 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3799 if (od->sess->ssi.received_data)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3800 aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3801 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3802 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3803
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3804 static void oscar_add_permit(struct gaim_connection *gc, char *who) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3805 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3806 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3807 if (gc->permdeny != 3) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3808 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3809 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3810 debug_printf("ssi: About to add a permit\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3811 if (od->sess->ssi.received_data)
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3812 aim_ssi_addpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3813 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3814 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3815
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3816 static void oscar_add_deny(struct gaim_connection *gc, char *who) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3817 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3818 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3819 if (gc->permdeny != 4) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3820 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3821 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3822 debug_printf("ssi: About to add a deny\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3823 if (od->sess->ssi.received_data)
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3824 aim_ssi_addpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3825 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3826 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3827
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3828 static void oscar_rem_permit(struct gaim_connection *gc, char *who) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3829 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3830 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3831 if (gc->permdeny != 3) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3832 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3833 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3834 debug_printf("ssi: About to delete a permit\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3835 if (od->sess->ssi.received_data)
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3836 aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3837 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3838 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3839
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3840 static void oscar_rem_deny(struct gaim_connection *gc, char *who) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3841 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3842 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3843 if (gc->permdeny != 4) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3844 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3845 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3846 debug_printf("ssi: About to delete a deny\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3847 if (od->sess->ssi.received_data)
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
3848 aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3849 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3850 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3851
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3852 static GList *oscar_away_states(struct gaim_connection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3853 {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3854 struct oscar_data *od = gc->proto_data;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3855 GList *m = NULL;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3856
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3857 if (!od->icq)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3858 return g_list_append(m, GAIM_AWAY_CUSTOM);
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3859
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3860 m = g_list_append(m, "Online");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3861 m = g_list_append(m, "Away");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3862 m = g_list_append(m, "Do Not Disturb");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3863 m = g_list_append(m, "Not Available");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3864 m = g_list_append(m, "Occupied");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3865 m = g_list_append(m, "Free For Chat");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3866 m = g_list_append(m, "Invisible");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3867
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3868 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3869 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3870
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3871 static void oscar_change_email(struct gaim_connection *gc, char *email)
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3872 {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3873 struct oscar_data *od = gc->proto_data;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3874 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3875
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3876 if (conn) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3877 aim_admin_setemail(od->sess, conn, email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3878 } else {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3879 od->setemail = TRUE;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3880 od->email = g_strdup(email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3881 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3882 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3883 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3884
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3885 static void oscar_format_screenname(struct gaim_connection *gc, char *nick) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3886 struct oscar_data *od = gc->proto_data;
3031
eafd12638829 [gaim-migrate @ 3044]
Sean Egan <seanegan@gmail.com>
parents: 3017
diff changeset
3887 if (!strcmp(normalize(nick), normalize(gc->username))) {
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3888 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3889 od->setnick = TRUE;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3890 od->newsn = g_strdup(nick);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3891 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3892 } else {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3893 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3894 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3895 } else {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3896 do_error_dialog("The new formatting is invalid.",
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3897 "Screenname formatting can change only capitalization and whitespace.", GAIM_ERROR);
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3898 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3899 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3900
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3901 static void oscar_do_action(struct gaim_connection *gc, char *act)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3902 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3903 struct oscar_data *od = gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3904 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3905
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3906 if (!strcmp(act, "Set User Info")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3907 show_set_info(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3908 } else if (!strcmp(act, "Change Password")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3909 show_change_passwd(gc);
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3910 } else if (!strcmp(act, "Format Screenname")) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3911 do_prompt_dialog("New screenname formatting:",
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3912 gc->displayname, gc, oscar_format_screenname, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3913 } else if (!strcmp(act, "Confirm Account")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3914 if (!conn) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3915 od->conf = TRUE;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3916 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3917 } else
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3918 aim_admin_reqconfirm(od->sess, conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3919 } else if (!strcmp(act, "Display Current Registered Address")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3920 if (!conn) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3921 od->reqemail = TRUE;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3922 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3923 } else
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3924 aim_admin_getinfo(od->sess, conn, 0x11);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3925 } else if (!strcmp(act, "Change Current Registered Address")) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3926 do_prompt_dialog("Change Address To: ", NULL, gc, oscar_change_email, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3927 } else if (!strcmp(act, "Search for Buddy by Email")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3928 show_find_email(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3929 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3930 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3931
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3932 static GList *oscar_actions()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3933 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3934 GList *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3935
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3936 m = g_list_append(m, "Set User Info");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3937 m = g_list_append(m, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3938 m = g_list_append(m, "Change Password");
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3939 m = g_list_append(m, "Format Screenname");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3940 m = g_list_append(m, "Confirm Account");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3941 m = g_list_append(m, "Display Current Registered Address");
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3942 m = g_list_append(m, "Change Current Registered Address");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3943 m = g_list_append(m, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3944 m = g_list_append(m, "Search for Buddy by Email");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3945
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3946 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3947 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3948
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3949 static void oscar_change_passwd(struct gaim_connection *gc, char *old, char *new)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3950 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3951 struct oscar_data *od = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3952 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3953 od->chpass = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3954 od->oldp = g_strdup(old);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3955 od->newp = g_strdup(new);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3956 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3957 } else {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3958 aim_admin_changepasswd(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH),
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3959 new, old);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3960 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3961 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3962
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3963 static void oscar_convo_closed(struct gaim_connection *gc, char *who)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3964 {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3965 struct oscar_data *od = gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3966 struct direct_im *dim = find_direct_im(od, who);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3967
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3968 if (!dim)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3969 return;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3970
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3971 od->direct_ims = g_slist_remove(od->direct_ims, dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3972 gaim_input_remove(dim->watcher);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3973 aim_conn_kill(od->sess, &dim->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3974 g_free(dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3975 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3976
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3034
diff changeset
3977
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3034
diff changeset
3978
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3979 static struct prpl *my_protocol = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3980
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3981 void oscar_init(struct prpl *ret) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3982 ret->protocol = PROTO_OSCAR;
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3983 ret->options = OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3984 ret->name = oscar_name;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3985 ret->list_icon = oscar_list_icon;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3986 ret->away_states = oscar_away_states;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3987 ret->actions = oscar_actions;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3988 ret->do_action = oscar_do_action;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3989 ret->buddy_menu = oscar_buddy_menu;
3456
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
3990 ret->edit_buddy_menu = oscar_edit_buddy_menu;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3991 ret->user_opts = oscar_user_opts;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3992 ret->login = oscar_login;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3993 ret->close = oscar_close;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3994 ret->send_im = oscar_send_im;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3995 ret->send_typing = oscar_send_typing;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3996 ret->set_info = oscar_set_info;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3997 ret->get_info = oscar_get_info;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3998 ret->set_away = oscar_set_away;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3999 ret->get_away = oscar_get_away;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4000 ret->set_dir = oscar_set_dir;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4001 ret->get_dir = NULL; /* Oscar really doesn't have this */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4002 ret->dir_search = oscar_dir_search;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4003 ret->set_idle = oscar_set_idle;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4004 ret->change_passwd = oscar_change_passwd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4005 ret->add_buddy = oscar_add_buddy;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4006 ret->add_buddies = oscar_add_buddies;
3140
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
4007 ret->group_buddy = oscar_move_buddy;
3348
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
4008 ret->rename_group = oscar_rename_group;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4009 ret->remove_buddy = oscar_remove_buddy;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4010 ret->remove_buddies = oscar_remove_buddies;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4011 ret->add_permit = oscar_add_permit;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4012 ret->add_deny = oscar_add_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4013 ret->rem_permit = oscar_rem_permit;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4014 ret->rem_deny = oscar_rem_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4015 ret->set_permit_deny = oscar_set_permit_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4016 ret->warn = oscar_warn;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4017 ret->chat_info = oscar_chat_info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4018 ret->join_chat = oscar_join_chat;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4019 ret->chat_invite = oscar_chat_invite;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4020 ret->chat_leave = oscar_chat_leave;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4021 ret->chat_whisper = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4022 ret->chat_send = oscar_chat_send;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4023 ret->keepalive = oscar_keepalive;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4024 ret->convo_closed = oscar_convo_closed;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4025
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4026 my_protocol = ret;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4027 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4028
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4029 #ifndef STATIC
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4030
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4031 char *gaim_plugin_init(GModule *handle)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4032 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4033 load_protocol(oscar_init, sizeof(struct prpl));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4034 return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4035 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4036
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4037 void gaim_plugin_remove()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4038 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4039 struct prpl *p = find_prpl(PROTO_OSCAR);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4040 if (p == my_protocol)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4041 unload_protocol(p);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4042 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4043
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4044 char *name()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4045 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4046 return "Oscar";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4047 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4048
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4049 char *description()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4050 {
2162
a464da684307 [gaim-migrate @ 2172]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2154
diff changeset
4051 return PRPL_DESC("Oscar");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4052 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4053
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4054 #endif