annotate src/protocols/oscar/oscar.c @ 2993:7239a392486c

[gaim-migrate @ 3006] 0.53 :) committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sat, 02 Mar 2002 04:52:21 +0000
parents 9d11dbb33b6f
children 60018f862a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * 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
9 * the Free Software Foundation; either version 2 of the License, or
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 * (at your option) any later version.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 * GNU General Public License for more details.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 *
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 #ifdef HAVE_CONFIG_H
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
24 #include <config.h>
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 #endif
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26
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 #include <netdb.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #include <unistd.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 #include <errno.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include <netinet/in.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include <arpa/inet.h>
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
33 #include <ctype.h>
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 #include <string.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 #include <stdlib.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 #include <stdio.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 #include <time.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 #include <sys/socket.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 #include <sys/stat.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 #include "multi.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 #include "prpl.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 #include "gaim.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 #include "aim.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 #include "proxy.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45
2315
7ec21662ffc2 [gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2309
diff changeset
46 #include "pixmaps/ab.xpm"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 #include "pixmaps/admin_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 #include "pixmaps/aol_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 #include "pixmaps/away_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 #include "pixmaps/dt_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 #include "pixmaps/free_icon.xpm"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
53 #include "pixmaps/gnomeicu-online.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
54 #include "pixmaps/gnomeicu-offline.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
55 #include "pixmaps/gnomeicu-away.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
56 #include "pixmaps/gnomeicu-dnd.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
57 #include "pixmaps/gnomeicu-na.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
58 #include "pixmaps/gnomeicu-occ.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
59 #include "pixmaps/gnomeicu-ffc.xpm"
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
60
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 /* constants to identify proto_opts */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 #define USEROPT_AUTH 0
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 #define USEROPT_AUTHPORT 1
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
65 #define UC_AOL 0x02
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
66 #define UC_ADMIN 0x04
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
67 #define UC_UNCONFIRMED 0x08
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
68 #define UC_NORMAL 0x10
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
69 #define UC_AB 0x20
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
70
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 static int gaim_caps = AIM_CAPS_CHAT |
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 AIM_CAPS_BUDDYICON |
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 AIM_CAPS_IMIMAGE;
2308
a90be9567452 [gaim-migrate @ 2318]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2305
diff changeset
76 static fu8_t gaim_features[] = {0x01, 0x01, 0x01, 0x02};
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 struct oscar_data {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
79 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
80 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 guint cnpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 guint paspa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
85 GSList *create_rooms;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 gboolean conf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 gboolean reqemail;
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
89 gboolean setemail;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
90 char *email;
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
91 gboolean setnick;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
92 char *newsn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 gboolean chpass;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 char *oldp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 char *newp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 GSList *oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 GSList *direct_ims;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 GSList *hasicons;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
101 gboolean killme;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
102 gboolean icq;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
103 GSList *evilhack;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
104
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
105 struct {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
106 guint maxbuddies; /* max users you can watch */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
107 guint maxwatchers; /* max users who can watch you */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
108 guint maxpermits; /* max users on permit list */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
109 guint maxdenies; /* max users on deny list */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
110 guint maxsiglen; /* max size (bytes) of profile */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
111 guint maxawaymsglen; /* max size (bytes) of posted away message */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
112 } rights;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
115 struct create_room {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
116 char *name;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
117 int exchange;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
118 };
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
119
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 struct chat_connection {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 char *name;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 char *show; /* AOL did something funny to us */
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
123 fu16_t exchange;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
124 fu16_t instance;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 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
126 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 int inpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 int id;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 struct gaim_connection *gc; /* i hate this. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 struct conversation *cnv; /* bah. */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
131 int maxlen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
132 int maxvis;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 struct direct_im {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 char name[80];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 int watcher;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
139 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 };
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 struct ask_direct {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 char *sn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
145 char ip[64];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
146 fu8_t cookie[8];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 struct icon_req {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 char *user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 time_t timestamp;
2196
016c5307f26b [gaim-migrate @ 2206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2194
diff changeset
152 unsigned long length;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2172
diff changeset
153 unsigned long checksum;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 gboolean request;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
157 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
158 GSList *d = od->direct_ims;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 char *n = g_strdup(normalize(who));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 struct direct_im *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 while (d) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 m = (struct direct_im *)d->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 if (!strcmp(n, normalize(m->name)))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166 m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 d = d->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
174 static char *extract_name(const char *name) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 char *tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176 int i, j;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 char *x = strchr(name, '-');
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 if (!x) return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 x = strchr(++x, '-');
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 if (!x) return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 tmp = g_strdup(++x);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 for (i = 0, j = 0; x[i]; i++) {
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
184 char hex[3];
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
185 if (x[i] != '%') {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 tmp[j++] = x[i];
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
187 continue;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 }
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
189 strncpy(hex, x + ++i, 2); hex[2] = 0;
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
190 i++;
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
191 tmp[j++] = strtol(hex, NULL, 16);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 tmp[j] = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 return tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 }
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 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
199 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 while (g) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 c = (struct chat_connection *)g->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 if (c->id == id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 g = g->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 c = NULL;
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
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 return c;
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_by_conn(struct gaim_connection *gc,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
214 aim_conn_t *conn) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 while (g) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 c = (struct chat_connection *)g->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 if (c->conn == conn)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 g = g->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 c = NULL;
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
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 return c;
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
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
229 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
230 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
231 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
232 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
233 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
234 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
235 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
236 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
237 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
238 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
239 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
240 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
241 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
242 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
243 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
244 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
245 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
246 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
247 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
248 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
249 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
250 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
251 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
252 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
253 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
254 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
255 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
256 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
257 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
258 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
259 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
260 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
261 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
262 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
263 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
264 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
265 static int gaim_simpleinfo (aim_session_t *, aim_frame_t *, ...);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
266 static int gaim_popup (aim_session_t *, aim_frame_t *, ...);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
267 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
268 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
269
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
270 static int gaim_directim_initiate(aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
271 static int gaim_directim_incoming(aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
272 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
273 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 static char *msgerrreason[] = {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 "Invalid error",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 "Invalid SNAC",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 "Rate to host",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 "Rate to client",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 "Not logged in",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 "Service unavailable",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 "Service not defined",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 "Obsolete SNAC",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 "Not supported by host",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 "Not supported by client",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 "Refused by client",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 "Reply too big",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 "Responses lost",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 "Request denied",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 "Busted SNAC payload",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 "Insufficient rights",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 "In local permit/deny",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 "Too evil (sender)",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 "Too evil (receiver)",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 "User temporarily unavailable",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 "No match",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 "List overflow",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 "Request ambiguous",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 "Queue full",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 "Not while on AOL"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 static int msgerrreasonlen = 25;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
304 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
305 struct gaim_connection *gc = sess->aux_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
306 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
307 struct conversation *cnv;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
308 struct direct_im *dim;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
309 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
310 char buf[256];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
311
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
312 sn = g_strdup(aim_directim_getsn(conn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
313
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
314 debug_printf("%s disconnected Direct IM.\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
315
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
316 dim = find_direct_im(od, sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
317 od->direct_ims = g_slist_remove(od->direct_ims, dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
318 gaim_input_remove(dim->watcher);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
319
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
320 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
321 if ((cnv = find_conversation(sn)))
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
322 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
323 update_progress(cnv, 100);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
324
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
325 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
326 g_free(sn);
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 return;
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
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 static void oscar_callback(gpointer data, gint source,
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
332 GaimInputCondition condition) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
333 aim_conn_t *conn = (aim_conn_t *)data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
334 aim_session_t *sess = aim_conn_getsess(conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 struct gaim_connection *gc = sess ? sess->aux_data : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 struct oscar_data *odata;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 if (!gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 /* gc is null. we return, else we seg SIGSEG on next line. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 debug_printf("oscar callback for closed connection (1).\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347 /* oh boy. this is probably bad. i guess the only thing we
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 * can really do is return? */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 debug_printf("oscar callback for closed connection (2).\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
353 if (condition & GAIM_INPUT_READ) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 debug_printf("got information on rendezvous\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 if (aim_handlerendconnect(odata->sess, conn) < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 debug_printf(_("connection error (rend)\n"));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
358 aim_conn_kill(odata->sess, &conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361 if (aim_get_command(odata->sess, conn) >= 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 aim_rxdispatch(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 if (odata->killme)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 if ((conn->type == AIM_CONN_TYPE_BOS) ||
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 debug_printf(_("major connection error\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 hide_login_progress(gc, _("Disconnected."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 debug_printf("disconnected from chat room %s\n", c->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375 c->conn = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 if (c->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
377 gaim_input_remove(c->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 c->inpa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 c->fd = -1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 do_error_dialog(buf, _("Chat Error!"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 if (odata->cnpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
385 gaim_input_remove(odata->cnpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 odata->cnpa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 debug_printf("removing chatnav input watcher\n");
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
388 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
389 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
390 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
391 odata->create_rooms =
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
392 g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
393 g_free(cr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 do_error_dialog(_("Chat is currently unavailable"),
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 _("Gaim - Chat"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399 if (odata->paspa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
400 gaim_input_remove(odata->paspa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 odata->paspa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 debug_printf("removing authconn input watcher\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
405 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
406 gaim_directim_disconnect(odata->sess, conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
407 else {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
408 debug_printf("No handler for rendezvous disconnect (%d).\n",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
409 source);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
410 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
411 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 debug_printf("holy crap! generic connection error! %d\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 conn->type);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
422 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
423 char *s = g_strdup_vprintf(format, va);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424 char buf[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 char *t;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429 t = g_strconcat(buf, s, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 debug_printf(t);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 if (t[strlen(t)-1] != '\n')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 debug_printf("\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 g_free(t);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 g_free(s);
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
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
437 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
2086
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 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
441 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
442 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454 hide_login_progress(gc, _("Couldn't connect to host"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
455 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456 return;
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
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 aim_conn_completeconnect(sess, conn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
460 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461 oscar_callback, conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462 debug_printf(_("Password sent, waiting for response\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 static void oscar_login(struct aim_user *user) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
466 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
467 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 char buf[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469 struct gaim_connection *gc = new_gaim_conn(user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 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
471
2589
4e149a0b9665 [gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2507
diff changeset
472 if (isdigit(*user->username)) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
473 odata->icq = TRUE;
2589
4e149a0b9665 [gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2507
diff changeset
474 /* 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
475 gc->protocol = PROTO_ICQ;
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
476 gc->password[9] = 0;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
477 } else {
2590
2dd86a1af92b [gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2589
diff changeset
478 gc->protocol = PROTO_TOC;
2918
4df759d607f3 [gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2916
diff changeset
479 gc->flags |= OPT_CONN_HTML;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
480 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
482 sess = g_new0(aim_session_t, 1);
2086
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 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
485 aim_setdebuggingcb(sess, oscar_debug);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
487 /* 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
488 * see if things need to be sent. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490 odata->sess = sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
491 sess->aux_data = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494 if (conn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495 debug_printf(_("internal connection error\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 hide_login_progress(gc, _("Unable to login to AIM"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
498 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
499 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502 set_login_progress(gc, 2, buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 oscar_login_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 if (conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 hide_login_progress(gc, _("Couldn't connect to host"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 aim_request_login(sess, conn, gc->username);
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
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 static void oscar_close(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
522 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
523
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524 while (odata->oscar_chats) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 struct chat_connection *n = odata->oscar_chats->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526 if (n->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
527 gaim_input_remove(n->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 g_free(n->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529 g_free(n->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 odata->oscar_chats = g_slist_remove(odata->oscar_chats, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 while (odata->direct_ims) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 struct direct_im *n = odata->direct_ims->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 if (n->watcher > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
536 gaim_input_remove(n->watcher);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 odata->direct_ims = g_slist_remove(odata->direct_ims, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538 g_free(n);
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 while (odata->hasicons) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 struct icon_req *n = odata->hasicons->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 g_free(n->user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 odata->hasicons = g_slist_remove(odata->hasicons, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545 }
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
546 while (odata->evilhack) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
547 g_free(odata->evilhack->data);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
548 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
549 }
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
550 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
551 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
552 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
553 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
554 g_free(cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
555 }
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
556 if (odata->email)
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
557 g_free(odata->email);
2754
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
558 if (odata->newp)
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
559 g_free(odata->newp);
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
560 if (odata->oldp)
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
561 g_free(odata->oldp);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562 if (gc->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
563 gaim_input_remove(gc->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 if (odata->cnpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
565 gaim_input_remove(odata->cnpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566 if (odata->paspa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
567 gaim_input_remove(odata->paspa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568 aim_session_kill(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569 g_free(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570 odata->sess = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
571 g_free(gc->proto_data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572 gc->proto_data = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
573 debug_printf(_("Signed off.\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
574 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
575
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
576 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
577 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
579 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
580 aim_conn_t *bosconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 bosconn = odata->conn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592 hide_login_progress(gc, _("Could Not Connect"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
595 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
596
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 aim_conn_completeconnect(sess, bosconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
598 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
599 oscar_callback, bosconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600 set_login_progress(gc, 4, _("Connection established, cookie sent"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
603 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
604 va_list ap;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
605 struct aim_authresp_info *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 int i; char *host; int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607 struct aim_user *user;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
608 aim_conn_t *bosconn;
2086
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 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 struct oscar_data *od = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 user = gc->user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613 port = user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
616 va_start(ap, fr);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
617 info = va_arg(ap, struct aim_authresp_info *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
620 debug_printf("inside auth_resp (Screen name: %s)\n", info->sn);
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
621
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
622 if (info->errorcode || !info->bosip || !info->cookie) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
623 switch (info->errorcode) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 case 0x05:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 /* Incorrect nick/password */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 hide_login_progress(gc, _("Incorrect nickname or password."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 plugin_event(event_error, (void *)980, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629 case 0x11:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630 /* Suspended account */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 hide_login_progress(gc, _("Your account is currently suspended."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633 case 0x18:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634 /* connecting too frequently */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635 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
636 plugin_event(event_error, (void *)983, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638 case 0x1c:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639 /* client too old */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 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
641 plugin_event(event_error, (void *)989, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 default:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 hide_login_progress(gc, _("Authentication Failed"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
647 debug_printf("Login Error Code 0x%04x\n", info->errorcode);
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
648 debug_printf("Error URL: %s\n", info->errorurl);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
654 debug_printf("Reg status: %d\n", info->regstatus);
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
655 if (info->email) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
656 debug_printf("Email: %s\n", info->email);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 debug_printf("Email is NULL\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
660 debug_printf("BOSIP: %s\n", info->bosip);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 debug_printf("Closing auth connection...\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
662 aim_conn_kill(sess, &fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 if (bosconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666 hide_login_progress(gc, _("Internal Error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668 return 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
671 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
672 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 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
674 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
675 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
676 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
677 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
678 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
679 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
680 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
681 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682 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
683 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
684 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
685 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
686 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
687 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
688 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
689 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
690 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
691 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
694 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0);
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
695 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0);
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
696 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
697 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
698 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
699 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
700 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
701 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
702 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
703
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
704 ((struct oscar_data *)gc->proto_data)->conn = bosconn;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
705 for (i = 0; i < (int)strlen(info->bosip); i++) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
706 if (info->bosip[i] == ':') {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
707 port = atoi(&(info->bosip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
709 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
710 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
711 host = g_strndup(info->bosip, i);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
712 bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
713 bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
714 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
715 if (bosconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
716 hide_login_progress(gc, _("Could Not Connect"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
717 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
718 return 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
719 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
720 aim_sendcookie(sess, bosconn, info->cookie);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
721 gaim_input_remove(gc->inpa);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
722
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
724 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
725
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
726 struct pieceofcrap {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
727 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
728 unsigned long offset;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
729 unsigned long len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
730 char *modname;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
731 int fd;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
732 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733 unsigned int inpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
734 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
735
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
736 static void damn_you(gpointer data, gint source, GaimInputCondition c)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
737 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
738 struct pieceofcrap *pos = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739 struct oscar_data *od = pos->gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
740 char in = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
741 int x = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
742 unsigned char m[17];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
743
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
744 while (read(pos->fd, &in, 1) == 1) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
745 if (in == '\n')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746 x++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 else if (in != '\r')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748 x = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 if (x == 2)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 in = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
752 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753 if (in != '\n') {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
754 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM."
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755 " You may be disconnected shortly.", "Login Error");
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
756 gaim_input_remove(pos->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
757 close(pos->fd);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
759 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761 read(pos->fd, m, 16);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 m[16] = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763 debug_printf("Sending hash: ");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764 for (x = 0; x < 16; x++)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
765 debug_printf("%02x ", (unsigned char)m[x]);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 debug_printf("\n");
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
767 gaim_input_remove(pos->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 close(pos->fd);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 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
770 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
771 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
772
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
773 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
774 struct pieceofcrap *pos = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
775 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
776
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
777 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
778 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM."
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
779 " You may be disconnected shortly.", "Login Error");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
780 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
781 g_free(pos->modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
782 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
783 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
784 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
785
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
787 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
788 pos->offset, pos->len, pos->modname ? pos->modname : "");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
789 write(pos->fd, buf, strlen(buf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
790 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
791 g_free(pos->modname);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
792 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
793 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
794 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
796 /* size of icbmui.ocm, the largest module in AIM 3.5 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
797 #define AIM_MAX_FILE_SIZE 98304
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
798
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
799 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
800 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
801 struct pieceofcrap *pos;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
802 fu32_t offset, len;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803 char *modname;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
804 int fd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
805
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
806 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
807 offset = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
808 len = (fu32_t)va_arg(ap, unsigned long);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809 modname = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
812 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
813 if (len == 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
814 debug_printf("len is 0, hashing NULL\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
815 aim_sendmemblock(sess, fr->conn, offset, len, NULL,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
816 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
817 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
818 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
819 /* 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
820 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
821 char *buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
822 int i = 8;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
823 if (modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
824 i += strlen(modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
825 buf = g_malloc(i);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
826 i = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
827 if (modname) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
828 memcpy(buf, modname, strlen(modname));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
829 i += strlen(modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
830 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
831 buf[i++] = offset & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
832 buf[i++] = (offset >> 8) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
833 buf[i++] = (offset >> 16) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
834 buf[i++] = (offset >> 24) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
835 buf[i++] = len & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
836 buf[i++] = (len >> 8) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
837 buf[i++] = (len >> 16) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
838 buf[i++] = (len >> 24) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
839 debug_printf("len + offset is invalid, hashing request\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
840 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
841 g_free(buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
842 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
843 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
844 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
845
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
846 pos = g_new0(struct pieceofcrap, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
847 pos->gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
848 pos->conn = fr->conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
849
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
850 pos->offset = offset;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
851 pos->len = len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
852 pos->modname = modname ? g_strdup(modname) : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
853
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
854 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
855 if (fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
856 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
857 g_free(pos->modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
858 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
859 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM."
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
860 " You may be disconnected shortly.", "Login Error");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
861 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
862 pos->fd = fd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
863
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
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
867 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
868 #if 0
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
869 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
870 #else
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
871 struct client_info_s info = AIM_CLIENTINFO_KNOWNGOOD;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
872 #endif
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
873 char *key;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
874 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
875 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
876
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
877 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878 key = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
879 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
880
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
881 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
882
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
883 return 1;
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
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
886 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
887 struct gaim_connection *gc = sess->aux_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
888 struct chat_connection *chatcon;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
889 static int id = 1;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
890
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
891 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
892 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
893 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
894 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
895 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
896
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
897 aim_clientready(sess, fr->conn);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
898
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
899 chatcon = find_oscar_chat_by_conn(gc, fr->conn);
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
900 chatcon->id = id;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
901 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show);
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
902
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
903 return 1;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
904 }
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
905
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
906 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
907
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
908 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
909 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
910
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
911 aim_clientready(sess, fr->conn);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
912
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
913 aim_chatnav_reqrights(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
914
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
915 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
916 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
917
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
918 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
919 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
920 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
921 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
922 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
923
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
924 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
925 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
926 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
927 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
928
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
929 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
930 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
931 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
932
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
933 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
934 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
935 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
936 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
937 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
938
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
939 aim_conn_completeconnect(sess, tstconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
940 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
941 oscar_callback, tstconn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
942 debug_printf("chatnav: connected\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
943 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
944
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
945 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
946 {
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_AUTH);
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 authorizer\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->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
969 oscar_callback, tstconn);
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_chat_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 chat_connection *ccon = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
976 struct gaim_connection *gc = ccon->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
977 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
978 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
979 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
980
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
981 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
982 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
983 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
984 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
985 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
986 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
987 }
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 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
990 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
991 tstconn = ccon->conn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
992
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
993 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
994 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
995 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
996 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
997 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
998 return;
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
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1001 aim_conn_completeconnect(sess, ccon->conn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1002 ccon->inpa = gaim_input_add(tstconn->fd,
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1003 GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1004 oscar_callback, tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1005 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1006 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1007
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1008 /* 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
1009 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
1010 va_list ap;
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1011 struct aim_redirect_data *redir;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1012 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1013 struct aim_user *user = gc->user;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1014 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1015 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1016 char *host;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1017 int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1018
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1019 port = user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1020 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1021
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1022 va_start(ap, fr);
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1023 redir = va_arg(ap, struct aim_redirect_data *);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1024 va_end(ap);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1025
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1026 for (i = 0; i < (int)strlen(redir->ip); i++) {
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1027 if (redir->ip[i] == ':') {
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1028 port = atoi(&(redir->ip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1029 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1030 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1031 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1032 host = g_strndup(redir->ip, i);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1033
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1034 switch(redir->group) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1035 case 0x7: /* Authorizer */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1036 debug_printf("Reconnecting with authorizor...\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1037 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1038 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1039 debug_printf("unable to reconnect with authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1040 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1041 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1042 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1043 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
1044 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1045 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1046 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1047
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1048 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1049 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1050 if (tstconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1051 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1052 debug_printf("unable to reconnect with authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1053 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1054 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1055 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1056 aim_sendcookie(sess, tstconn, redir->cookie);
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 case 0xd: /* ChatNav */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1059 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1060 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1061 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1062 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1063 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1064 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1065 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
1066
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1067 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1068 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1069 if (tstconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1070 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1071 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1072 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1073 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1074 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1075 aim_sendcookie(sess, tstconn, redir->cookie);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1076 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1077 case 0xe: /* Chat */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1078 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1079 struct chat_connection *ccon;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1080
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1081 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1082 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1083 debug_printf("unable to connect to chat server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1084 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1085 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1086 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1087
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1088 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
1089
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1090 ccon = g_new0(struct chat_connection, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1091 ccon->conn = tstconn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1092 ccon->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1093 ccon->fd = -1;
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1094 ccon->name = g_strdup(redir->chat.room);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1095 ccon->exchange = redir->chat.exchange;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1096 ccon->instance = redir->chat.instance;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1097 ccon->show = extract_name(redir->chat.room);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1098
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1099 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1100 ccon->conn->fd = proxy_connect(host, port, oscar_chat_connect, ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1101 if (ccon->conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1102 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1103 debug_printf("unable to connect to chat server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1104 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1105 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1106 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1107 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1108 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1109 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1110 aim_sendcookie(sess, tstconn, redir->cookie);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1111 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
1112 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1113 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1114 default: /* huh? */
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1115 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
1116 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1117 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1118
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1119 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1120 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1121 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1122
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1123 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
1124 struct gaim_connection *gc = sess->aux_data;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1125 struct oscar_data *od = gc->proto_data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1126 aim_userinfo_t *info;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1127 time_t time_idle = 0, signon = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1128 int type = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1129 int caps = 0;
2305
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1130 char *tmp;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1131
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1132 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1133 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1134 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1135 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1136
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1137 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1138 caps = info->capabilities;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1139
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1140 if (!od->icq && (info->present & AIM_USERINFO_PRESENT_FLAGS)) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1141 if (info->flags & AIM_FLAG_ACTIVEBUDDY)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1142 type |= UC_AB;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1143 if (info->flags & AIM_FLAG_UNCONFIRMED)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1144 type |= UC_UNCONFIRMED;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1145 if (info->flags & AIM_FLAG_ADMINISTRATOR)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1146 type |= UC_ADMIN;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1147 if (info->flags & AIM_FLAG_AOL)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1148 type |= UC_AOL;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1149 if (info->flags & AIM_FLAG_FREE)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1150 type |= UC_NORMAL;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1151 if (info->flags & AIM_FLAG_AWAY)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1152 type |= UC_UNAVAILABLE;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1153 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1154
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1155 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1156 type = (info->icqinfo.status << 6);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1157 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1158 type |= UC_UNAVAILABLE;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1159 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1160
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1161 if (caps & AIM_CAPS_ICQ)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1162 caps ^= AIM_CAPS_ICQ;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1163
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1164 if (info->present & AIM_USERINFO_PRESENT_IDLE) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1165 time(&time_idle);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1166 time_idle -= info->idletime*60;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1167 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1168
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1169 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1170 signon = time(NULL) - info->sessionlen;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1171
2305
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1172 tmp = g_strdup(normalize(gc->username));
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1173 if (!strcmp(tmp, normalize(info->sn)))
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1174 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1175 g_free(tmp);
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1176
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1177 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
1178 time_idle, type, caps);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1179
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1180 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1181 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1182
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1183 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
1184 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1185 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1186 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1187
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1188 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1189 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1190 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1191
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1192 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1193
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1194 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1195 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1196
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1197 static void cancel_direct_im(gpointer w, struct ask_direct *d) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1198 debug_printf("Freeing DirectIM prompts.\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1199
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1200 g_free(d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1201 g_free(d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1202 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1203
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1204 static void oscar_directim_callback(gpointer data, gint source, GaimInputCondition condition) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1205 struct direct_im *dim = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1206 struct gaim_connection *gc = dim->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1207 struct oscar_data *od = gc->proto_data;
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
1208 struct conversation *cnv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1209 char buf[256];
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 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1212 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1213 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1214 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1215
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1216 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1217 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1218 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1219 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1220
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1221 if (dim->conn->fd != source)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1222 dim->conn->fd = source;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1223
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1224 aim_conn_completeconnect(od->sess, dim->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1225 if (!(cnv = find_conversation(dim->name)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1226 cnv = new_conversation(dim->name);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1227 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
1228 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1229
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1230 od->direct_ims = g_slist_append(od->direct_ims, dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1231
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1232 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1233 oscar_callback, dim->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1234 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1235
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1236 static int accept_direct_im(gpointer w, struct ask_direct *d) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1237 struct gaim_connection *gc = d->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1238 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1239 struct direct_im *dim;
2945
6a26e125b623 [gaim-migrate @ 2958]
Rob Flynn <gaim@robflynn.com>
parents: 2943
diff changeset
1240 char *host; int port = 4443;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1241 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1242
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1243 debug_printf("Accepted DirectIM.\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1244
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1245 dim = find_direct_im(od, d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1246 if (dim) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1247 cancel_direct_im(w, d); /* 40 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1248 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1249 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1250 dim = g_new0(struct direct_im, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1251 dim->gc = d->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1252 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn);
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 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
1255 if (!dim->conn) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1256 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1257 cancel_direct_im(w, d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1258 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1259 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1260
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1261 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
1262 gaim_directim_incoming, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1263 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
1264 gaim_directim_typing, 0);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1265 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DOWNLOADIMAGE,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1266 gaim_update_ui, 0);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1267 for (i = 0; i < (int)strlen(d->ip); i++) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1268 if (d->ip[i] == ':') {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1269 port = atoi(&(d->ip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1270 break;
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 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1273 host = g_strndup(d->ip, i);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1274 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1275 dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1276 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1277 if (dim->conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1278 aim_conn_kill(od->sess, &dim->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1279 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1280 cancel_direct_im(w, d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1281 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1282 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1283
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1284 cancel_direct_im(w, d);
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 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1287 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1288
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1289 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
1290 char *tmp = g_malloc(BUF_LONG);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1291 struct gaim_connection *gc = sess->aux_data;
2273
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1292 int flags = 0;
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1293
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1294 if (args->icbmflags & AIM_IMFLAGS_AWAY)
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1295 flags |= IM_FLAG_AWAY;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1296
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1297 if (args->icbmflags & AIM_IMFLAGS_HASICON) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1298 struct oscar_data *od = gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1299 struct icon_req *ir = NULL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1300 GSList *h = od->hasicons;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1301 char *who = normalize(userinfo->sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1302 debug_printf("%s has an icon\n", userinfo->sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1303 while (h) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1304 ir = h->data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1305 if (!strcmp(ir->user, who))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1306 break;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1307 h = h->next;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1308 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1309 if (!h) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1310 ir = g_new0(struct icon_req, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1311 ir->user = g_strdup(who);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1312 od->hasicons = g_slist_append(od->hasicons, ir);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1313 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1314 if ((args->iconlen != ir->length) ||
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1315 (args->iconsum != ir->checksum) ||
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1316 (args->iconstamp != ir->timestamp))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1317 ir->request = TRUE;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1318 ir->length = args->iconlen;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1319 ir->checksum = args->iconsum;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1320 ir->timestamp = args->iconstamp;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1321 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1322
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1323 if (gc->user->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1324 FILE *file;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1325 struct stat st;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1326
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
1327 if (!stat(gc->user->iconfile, &st)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1328 char *buf = g_malloc(st.st_size);
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
1329 file = fopen(gc->user->iconfile, "r");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1330 if (file) {
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1331 int len = fread(buf, 1, st.st_size, file);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1332 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
1333 userinfo->sn, len, st.st_size);
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
1334 aim_send_icon(sess, userinfo->sn, buf, st.st_size,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1335 st.st_mtime, aim_iconsum(buf, st.st_size));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1336 fclose(file);
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1337 } else
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1338 debug_printf("Can't open buddy icon file!\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1339 g_free(buf);
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1340 } else
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1341 debug_printf("Can't stat buddy icon file!\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1342 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1343
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 * Quickly convert it to eight bit format, replacing
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1346 * non-ASCII UNICODE characters with their equivelent
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1347 * HTML entity.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1348 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1349 if (args->icbmflags & AIM_IMFLAGS_UNICODE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1350 int i;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1351
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1352 for (i = 0, tmp[0] = '\0'; i < args->msglen; i += 2) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1353 unsigned short uni;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1354
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1355 uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i+1] & 0xff);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1356
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1357 if ((uni < 128) || ((uni >= 160) && (uni <= 255))) { /* ISO 8859-1 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1358
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1359 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "%c", uni);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1360
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1361 } else { /* something else, do UNICODE entity */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1362 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "&#%04x;", uni);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1363 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1364 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1365 } else
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1366 g_snprintf(tmp, BUF_LONG, "%s", args->msg);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1367
2817
8ceb67d1645e [gaim-migrate @ 2830]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2799
diff changeset
1368 strip_linefeed(tmp);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
1369 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
1370 g_free(tmp);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1371
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1372 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1373 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1374
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1375 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
1376 struct gaim_connection *gc = sess->aux_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1377
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1378 debug_printf("rendezvous status %d (%s)\n", args->status, userinfo->sn);
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1379
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1380 if (args->status != AIM_RENDEZVOUS_PROPOSE)
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1381 return 1;
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1382
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1383 if (args->reqclass & AIM_CAPS_CHAT) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1384 char *name = extract_name(args->info.chat.roominfo.name);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1385 int *exch = g_new0(int, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1386 GList *m = NULL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1387 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
1388 *exch = args->info.chat.roominfo.exchange;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1389 m = g_list_append(m, exch);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1390 serv_got_chat_invite(gc,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1391 name ? name : args->info.chat.roominfo.name,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1392 userinfo->sn,
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1393 (char *)args->msg,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1394 m);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1395 if (name)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1396 g_free(name);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1397 } else if (args->reqclass & AIM_CAPS_SENDFILE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1398 } else if (args->reqclass & AIM_CAPS_GETFILE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1399 } else if (args->reqclass & AIM_CAPS_VOICE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1400 } else if (args->reqclass & AIM_CAPS_BUDDYICON) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1401 set_icon_data(gc, normalize(userinfo->sn), args->info.icon.icon,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1402 args->info.icon.length);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1403 } else if (args->reqclass & AIM_CAPS_IMIMAGE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1404 struct ask_direct *d = g_new0(struct ask_direct, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1405 char buf[256];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1406
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1407 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
1408 gc->username, userinfo->sn, args->verifiedip);
2246
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 d->gc = gc;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1411 d->sn = g_strdup(userinfo->sn);
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1412 strncpy(d->ip, args->verifiedip, sizeof(d->ip));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1413 memcpy(d->cookie, args->cookie, 8);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1414 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
1415 userinfo->sn, gc->username);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1416 do_ask_dialog(buf, d, accept_direct_im, cancel_direct_im);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1417 } else {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1418 debug_printf("Unknown reqclass %d\n", args->reqclass);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1419 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1420
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1421 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1422 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1423
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1424
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1425 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
1426 int channel, ret = 0;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1427 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1428 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1429
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1430 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1431 channel = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1432 userinfo = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1433
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1434 /* channel 1: standard message */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1435 if (channel == 1) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1436 struct aim_incomingim_ch1_args *args;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1437
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1438 args = va_arg(ap, struct aim_incomingim_ch1_args *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1439
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1440 ret = incomingim_chan1(sess, fr->conn, userinfo, args);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1441
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1442 } else if (channel == 2) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1443 struct aim_incomingim_ch2_args *args;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1444
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1445 args = va_arg(ap, struct aim_incomingim_ch2_args *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1446
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1447 ret = incomingim_chan2(sess, fr->conn, userinfo, args);
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1448 } else if (channel == 3) {
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1449 printf("Chan 3\n");
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1450 } else if (channel == 4) {
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1451 printf("Chan 4\n");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1452 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1453
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1454 va_end(ap);
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 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1457 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1458
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1459 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
1460 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1461 fu16_t chan, nummissed, reason;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1462 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1463 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1464
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1465 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1466 chan = (fu16_t)va_arg(ap, unsigned int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1467 userinfo = va_arg(ap, aim_userinfo_t *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1468 nummissed = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1469 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1470 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1471
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1472 switch(reason) {
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1473 case 0:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1474 /* Invalid (0) */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1475 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1476 sizeof(buf),
2946
9ef2fae94c80 [gaim-migrate @ 2959]
Rob Flynn <gaim@robflynn.com>
parents: 2945
diff changeset
1477 nummissed == 1 ?
2947
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1478 _("You missed %d message from %s because it was invalid.") :
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1479 _("You missed %d messages from %s because they were invalid."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1480 nummissed,
2947
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1481 userinfo->sn);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1482 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1483 case 1:
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1484 /* Message too large */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1485 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1486 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1487 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1488 _("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
1489 _("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
1490 nummissed,
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1491 userinfo->sn);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1492 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1493 case 2:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1494 /* Rate exceeded */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1495 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1496 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1497 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1498 _("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
1499 _("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
1500 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1501 userinfo->sn);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1502 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1503 case 3:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1504 /* Evil Sender */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1505 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1506 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1507 nummissed == 1 ?
2947
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
1508 _("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
1509 _("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
1510 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1511 userinfo->sn);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1512 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1513 case 4:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1514 /* Evil Receiver */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1515 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1516 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1517 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1518 _("You missed %d message from %s because you are too evil.") :
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1519 _("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
1520 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1521 userinfo->sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1522 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1523 default:
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1524 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1525 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1526 nummissed == 1 ?
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1527 _("You missed %d message from %s for unknown reasons.") :
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
1528 _("You missed %d messages from %s for unknown reasons."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1529 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1530 userinfo->sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1531 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1532 }
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1533 do_error_dialog(buf, _("Gaim - Error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1534
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1535 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1536 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1537
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1538 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
1539 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1540 fu16_t reason;
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1541 char *m;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1542
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1543 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1544 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1545 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1546
2864
e22c09351e67 [gaim-migrate @ 2877]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
1547 debug_printf("snac threw error (reason 0x%04x: %s)\n", reason,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1548 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1549
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1550 m = g_strdup_printf(_("SNAC threw error: %s\n"),
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1551 reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1552 do_error_dialog(m, _("Gaim - Oscar SNAC Error"));
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1553 g_free(m);
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
1554
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1555 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1556 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1557
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1558 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
1559 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1560 char *destn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1561 fu16_t reason;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1562 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1563
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1564 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1565 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1566 destn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1567 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1568
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1569 sprintf(buf, _("Your message to %s did not get sent: %s"), destn,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1570 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1571 do_error_dialog(buf, _("Gaim - Error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1572
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1573 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1574 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1575
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1576 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
1577 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1578 char *destn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1579 fu16_t reason;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1580 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1581
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1582 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1583 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1584 destn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1585 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1586
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1587 sprintf(buf, _("User information for %s unavailable: %s"), destn,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1588 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1589 do_error_dialog(buf, _("Gaim - Error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1590
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1591 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1592 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1593
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1594 static char *images(int flags) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1595 static char buf[1024];
2679
94aa499ecd39 [gaim-migrate @ 2692]
Adam Fritzler <mid@auk.cx>
parents: 2675
diff changeset
1596 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s",
94aa499ecd39 [gaim-migrate @ 2692]
Adam Fritzler <mid@auk.cx>
parents: 2675
diff changeset
1597 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1598 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1599 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1600 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1601 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1602 return buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1603 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1604
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1605 /* XXX This is horribly copied from ../../buddy.c. */
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1606 static char *caps_string(guint caps)
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1607 {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1608 static char buf[512], *tmp;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1609 int count = 0, i = 0;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1610 guint bit = 1;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1611 while (bit <= 0x10000) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1612 if (bit & caps) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1613 switch (bit) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1614 case 0x1:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1615 tmp = _("Buddy Icon");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1616 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1617 case 0x2:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1618 tmp = _("Voice");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1619 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1620 case 0x4:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1621 tmp = _("IM Image");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1622 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1623 case 0x8:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1624 tmp = _("Chat");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1625 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1626 case 0x10:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1627 tmp = _("Get File");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1628 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1629 case 0x20:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1630 tmp = _("Send File");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1631 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1632 case 0x40:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1633 case 0x200:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1634 tmp = _("Games");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1635 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1636 case 0x80:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1637 tmp = _("Stocks");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1638 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1639 case 0x100:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1640 tmp = _("Send Buddy List");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1641 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1642 case 0x400:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1643 tmp = _("EveryBuddy Bug");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1644 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1645 case 0x800:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1646 tmp = _("AP User");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1647 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1648 case 0x1000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1649 tmp = _("ICQ RTF");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1650 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1651 case 0x2000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1652 tmp = _("Nihilist");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1653 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1654 case 0x4000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1655 tmp = _("ICQ Server Relay");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1656 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1657 case 0x8000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1658 tmp = _("ICQ Unknown");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1659 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1660 case 0x10000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1661 tmp = _("Trillian Encryption");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1662 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1663 default:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1664 tmp = NULL;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1665 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1666 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1667 if (tmp)
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1668 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1669 tmp);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1670 count++;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1671 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1672 bit <<= 1;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1673 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1674 return buf;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1675 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1676
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1677 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
1678 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1679 char *prof_enc = NULL, *prof = NULL;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1680 fu16_t infotype;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1681 char header[BUF_LONG];
2137
18722ae5b882 [gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2131
diff changeset
1682 char legend[BUF_LONG];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1683 struct gaim_connection *gc = sess->aux_data;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1684 struct oscar_data *od = gc->proto_data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1685 GSList *l = od->evilhack;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1686 gboolean evilhack = FALSE;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1687 va_list ap;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1688 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1689
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1690 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1691 info = va_arg(ap, aim_userinfo_t *);
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1692 infotype = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1693 prof_enc = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1694 prof = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1695 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1696
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1697 g_snprintf(legend, sizeof legend,
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1698 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>"
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1699 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>"
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1700 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>"
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1701 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>"
2981
aebf1d505e1f [gaim-migrate @ 2994]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1702 "<IMG SRC=\"admin_icon.gif\"> : Administrator <br>"
2988
9287c9465c50 [gaim-migrate @ 3001]
Adam Fritzler <mid@auk.cx>
parents: 2981
diff changeset
1703 "<IMG SRC=\"ab_icon.gif\"> : ActiveBuddy Interactive Agent<br>"));
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1704
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1705 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1706 onlinesince = g_strdup_printf("Online Since : <B>%s</B><BR>\n",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1707 asctime(localtime(&info->onlinesince)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1708 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1709
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1710 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1711 membersince = g_strdup_printf("Member Since : <B>%s</B><BR>\n",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1712 asctime(localtime(&info->membersince)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1713 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1714
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1715 if (info->present & AIM_USERINFO_PRESENT_IDLE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1716 idle = g_strdup_printf("Idle : <B>%d minutes</B>",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1717 info->idletime);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1718 } else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1719 idle = g_strdup("Idle: <B>Active</B>");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1720
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1721 g_snprintf(header, sizeof header,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1722 _("Username : <B>%s</B> %s <BR>\n"
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1723 "Warning Level : <B>%d %%</B><BR>\n"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1724 "%s"
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1725 "%s"
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1726 "%s<BR>\n"
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1727 "<HR><BR>\n"),
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1728 info->sn, images(info->flags),
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1729 info->warnlevel/10,
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1730 onlinesince ? onlinesince : "",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1731 membersince ? membersince : "",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1732 idle ? idle : "");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1733
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1734 g_free(onlinesince);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1735 g_free(membersince);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1736 g_free(idle);
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
1737
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1738 while (l) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1739 char *x = l->data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1740 if (!strcmp(x, normalize(info->sn))) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1741 evilhack = TRUE;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1742 g_free(x);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1743 od->evilhack = g_slist_remove(od->evilhack, x);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1744 break;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1745 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1746 l = l->next;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1747 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1748
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1749 if (infotype == AIM_GETINFO_AWAYMESSAGE) {
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1750 if (evilhack) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1751 g_show_info_text(gc, info->sn, 2,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1752 header,
2797
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
1753 (prof && *prof) ? away_subs(prof, gc->username) :
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1754 _("<i>User has no away message</i>"),
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1755 legend, NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1756 } else {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1757 g_show_info_text(gc, info->sn, 0,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1758 header,
2797
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
1759 (prof && *prof) ? away_subs(prof, gc->username) : NULL,
2799
72357bddb0f3 [gaim-migrate @ 2812]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2797
diff changeset
1760 (prof && *prof) ? "<BR><HR><BR>" : NULL,
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1761 NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1762 }
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1763 } else if (infotype == AIM_GETINFO_CAPABILITIES) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1764 g_show_info_text(gc, info->sn, 2,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1765 header,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1766 "<i>", _("Client Capabilities: "),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1767 caps_string(info->capabilities),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1768 "</i>",
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1769 legend,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
1770 NULL);
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1771 } else {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1772 g_show_info_text(gc, info->sn, 1,
2797
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
1773 (prof && *prof) ? away_subs(prof, gc->username) :
ccb5b2f05d16 [gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2791
diff changeset
1774 _("<i>No Information Provided</i>"),
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1775 legend,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1776 NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
1777 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1778
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1779 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1780 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1781
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1782 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
1783 char *msg;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1784 fu16_t id;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1785 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1786 char buildbuf[150];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1787
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1788 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1789 id = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1790 msg = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1791 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1792
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1793 aim_getbuildstring(buildbuf, sizeof(buildbuf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1794
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1795 debug_printf("MOTD: %s (%d)\n", msg ? msg : "Unknown", id);
2092
59b0377d18aa [gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
1796 if (id < 4)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1797 do_error_dialog(_("Your connection may be lost."),
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1798 _("AOL error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1799
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1800 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1801 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1802
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1803 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
1804 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1805 fu16_t type;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1806 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1807 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1808
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1809 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1810 type = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1811
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1812 switch(type) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1813 case 0x0002: {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1814 fu8_t maxrooms;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1815 struct aim_chat_exchangeinfo *exchanges;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1816 int exchangecount, i;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1817
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1818 maxrooms = (fu8_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1819 exchangecount = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1820 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1821 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1822
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1823 debug_printf("chat info: Chat Rights:\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1824 debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1825 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1826 for (i = 0; i < exchangecount; i++)
2931
10a2d4d5bcf2 [gaim-migrate @ 2944]
Adam Fritzler <mid@auk.cx>
parents: 2920
diff changeset
1827 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
1828 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
1829 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
1830 debug_printf("creating room %s\n", cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
1831 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
1832 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
1833 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
1834 g_free(cr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1835 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1836 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1837 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1838 case 0x0008: {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1839 char *fqcn, *name, *ck;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1840 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1841 fu8_t createperms;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1842 fu32_t createtime;
2086
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 fqcn = va_arg(ap, char *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1845 instance = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1846 exchange = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1847 flags = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1848 createtime = va_arg(ap, fu32_t);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1849 maxmsglen = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1850 maxoccupancy = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1851 createperms = (fu8_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1852 unknown = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1853 name = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1854 ck = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1855 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1856
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1857 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
1858 fqcn,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1859 exchange, instance, flags,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1860 createtime,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1861 maxmsglen, maxoccupancy, createperms, unknown,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1862 name, ck);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1863 aim_chat_join(odata->sess, odata->conn, exchange, ck, instance);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1864 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1865 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1866 default:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1867 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1868 debug_printf("chatnav info: unknown type (%04x)\n", type);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1869 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1870 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1871 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1872 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1873
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1874 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
1875 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1876 int count, i;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1877 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1878 struct gaim_connection *g = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1879
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1880 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1881
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1882 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1883 count = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1884 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1885 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1886
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1887 c = find_oscar_chat_by_conn(g, fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1888 if (!c)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1889 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1890
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1891 for (i = 0; i < count; i++)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1892 add_chat_buddy(c->cnv, info[i].sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1893
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1894 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1895 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1896
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1897 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
1898 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1899 int count, i;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1900 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1901 struct gaim_connection *g = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1902
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1903 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1904
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1905 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1906 count = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1907 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1908 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1909
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1910 c = find_oscar_chat_by_conn(g, fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1911 if (!c)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1912 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1913
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1914 for (i = 0; i < count; i++)
2820
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2817
diff changeset
1915 remove_chat_buddy(c->cnv, info[i].sn, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1916
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1917 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1918 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1919
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1920 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
1921 va_list ap;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1922 aim_userinfo_t *userinfo;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1923 struct aim_chat_roominfo *roominfo;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1924 char *roomname;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1925 int usercount;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1926 char *roomdesc;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1927 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1928 fu32_t creationtime;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1929 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1930 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
1931
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1932 va_start(ap, fr);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1933 roominfo = va_arg(ap, struct aim_chat_roominfo *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1934 roomname = va_arg(ap, char *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1935 usercount= va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1936 userinfo = va_arg(ap, aim_userinfo_t *);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1937 roomdesc = va_arg(ap, char *);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1938 unknown_c9 = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1939 creationtime = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1940 maxmsglen = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1941 unknown_d2 = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1942 unknown_d5 = (fu16_t)va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1943 maxvisiblemsglen = (fu16_t)va_arg(ap, int);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1944 va_end(ap);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1945
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1946 debug_printf("inside chat_info_update (maxmsglen = %d, maxvislen = %d)\n",
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1947 maxmsglen, maxvisiblemsglen);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1948
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1949 ccon->maxlen = maxmsglen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1950 ccon->maxvis = maxvisiblemsglen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1951
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1952 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1953 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1954
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1955 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
1956 va_list ap;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1957 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1958 char *msg;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1959 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1960 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
1961 char *tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1962
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1963 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1964 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1965 msg = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1966
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1967 tmp = g_malloc(BUF_LONG);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1968 g_snprintf(tmp, BUF_LONG, "%s", msg);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1969 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
1970 g_free(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1971
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1972 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1973 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1974
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1975 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1976 * 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
1977 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1978 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
1979 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1980 fu16_t type;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1981 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1982
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1983 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1984 type = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1985 sn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1986 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1987
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1988 debug_printf("Sent message to %s.\n", sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1989
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1990 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1991 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1992
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1993 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
1994 static const char *codes[5] = {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1995 "invalid",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1996 "change",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1997 "warning",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1998 "limit",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1999 "limit cleared",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2000 };
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2001 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2002 fu16_t code, rateclass;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2003 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2004
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2005 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2006 code = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2007 rateclass= (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2008 windowsize = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2009 clear = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2010 alert = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2011 limit = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2012 disconnect = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2013 currentavg = (fu32_t)va_arg(ap, unsigned long);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2014 maxavg = (fu32_t)va_arg(ap, unsigned long);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2015 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2016
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2017 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
2018 "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
2019 (code < 5) ? codes[code] : codes[0],
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2020 rateclass,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2021 currentavg, maxavg,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2022 alert, clear,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2023 limit, disconnect,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2024 windowsize);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2025
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2026 /* XXX fix these values */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2027 if (code == AIM_RATE_CODE_CHANGE) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2028 if (currentavg >= clear)
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2029 aim_conn_setlatency(fr->conn, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2030 } else if (code == AIM_RATE_CODE_WARNING) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2031 aim_conn_setlatency(fr->conn, windowsize/4);
2909
48ec70928d7f [gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2906
diff changeset
2032 } else if (code == AIM_RATE_CODE_LIMIT) {
2906
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2869
diff changeset
2033 do_error_dialog(_("The last message was not sent because you are over the rate limit. "
538c58b43eff [gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2869
diff changeset
2034 "Please wait 10 seconds and try again."), _("Gaim - Error"));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2035 aim_conn_setlatency(fr->conn, windowsize/2);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2036 } else if (code == AIM_RATE_CODE_CLEARLIMIT) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2037 aim_conn_setlatency(fr->conn, 0);
2086
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
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2040 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2041 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2042
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2043 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
2044 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2045 fu16_t newevil;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2046 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2047 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2048
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2049 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2050 newevil = (fu16_t)va_arg(ap, unsigned int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2051 userinfo = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2052 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2053
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2054 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
2055
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2056 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2057 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2058
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2059 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
2060 va_list ap;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2061 aim_userinfo_t *info;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2062 struct gaim_connection *gc = sess->aux_data;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2063
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2064 va_start(ap, fr);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2065 info = va_arg(ap, aim_userinfo_t *);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2066 va_end(ap);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2067
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2068 gc->evil = info->warnlevel/10;
2698
e80f4b4f840f [gaim-migrate @ 2711]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2689
diff changeset
2069 /* gc->correction_time = (info->onlinesince - gc->login_time); */
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2070
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2071 return 1;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2072 }
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
2073
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
2074 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2075
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2076 aim_reqpersonalinfo(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2077 aim_bos_reqlocaterights(sess, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2078 aim_bos_reqbuddyrights(sess, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2079
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
2080 aim_reqicbmparams(sess);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2081
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2082 aim_bos_reqrights(sess, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2083 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2084 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE |
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2085 AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2087 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2088 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2089
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
2090 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
2091 struct gaim_connection *gc = sess->aux_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2092 struct oscar_data *od = gc->proto_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2093
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
2094 aim_clientready(sess, fr->conn);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
2095 debug_printf("connected to admin\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2096
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2097 if (od->chpass) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2098 debug_printf("changing password\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2099 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2100 g_free(od->oldp);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2101 od->oldp = NULL;
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2102 g_free(od->newp);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2103 od->newp = NULL;
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2104 od->chpass = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2105 }
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2106 if (od->setnick) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2107 debug_printf("formatting screenname\n");
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2108 aim_admin_setnick(sess, fr->conn, od->newsn);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2109 g_free(od->newsn);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2110 od->newsn = NULL;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2111 od->setnick = FALSE;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
2112 }
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2113 if (od->conf) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2114 debug_printf("confirming account\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2115 aim_admin_reqconfirm(sess, fr->conn);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2116 od->conf = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2117 }
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2118 if (od->reqemail) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2119 debug_printf("requesting email\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2120 aim_admin_getinfo(sess, fr->conn, 0x0011);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2121 od->reqemail = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2122 }
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2123 if (od->setemail) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2124 debug_printf("setting email\n");
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2125 aim_admin_setemail(sess, fr->conn, od->email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2126 g_free(od->email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2127 od->setemail = FALSE;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2128 }
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
2129
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2130 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2131 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2132
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2133 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
2134 struct aim_icbmparameters *params;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2135 va_list ap;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2136
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2137 va_start(ap, fr);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2138 params = va_arg(ap, struct aim_icbmparameters *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2139 va_end(ap);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2140
2427
5bc3b39fc0a5 [gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2421
diff changeset
2141 /* evidently this crashes on solaris. i have no clue why
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2142 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
2143 "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
2144 params->maxchan, params->flags, params->maxmsglen,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2145 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2146 params->minmsginterval);
2427
5bc3b39fc0a5 [gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2421
diff changeset
2147 */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2148
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2149 /* Maybe senderwarn and recverwarn should be user preferences... */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2150 params->maxmsglen = 8000;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2151 params->minmsginterval = 0;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2152
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
2153 aim_seticbmparam(sess, params);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2154
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2155 return 1;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2156 }
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2157
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2158 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
2159 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2160 va_list ap;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2161 fu16_t maxsiglen;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2162 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2163 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2164
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2165 va_start(ap, fr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2166 maxsiglen = va_arg(ap, int);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2167 va_end(ap);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2168
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2169 debug_printf("locate rights: max sig len = %d\n", maxsiglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2170
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2171 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2172
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2173 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2174
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2175 return 1;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2176 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2177
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2178 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
2179 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2180 fu16_t maxbuddies, maxwatchers;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2181 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2182 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2183
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2184 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2185 maxbuddies = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2186 maxwatchers = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2187 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2188
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2189 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
2190
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2191 odata->rights.maxbuddies = (guint)maxbuddies;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2192 odata->rights.maxwatchers = (guint)maxwatchers;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2193
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2194 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2195 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2196
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2197 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
2198 fu16_t maxpermits, maxdenies;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2199 va_list ap;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2200 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2201 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2202
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2203 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2204 maxpermits = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2205 maxdenies = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2206 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2207
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2208 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
2209
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2210 odata->rights.maxpermits = (guint)maxpermits;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2211 odata->rights.maxdenies = (guint)maxdenies;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2212
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2213 account_online(gc);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2214 serv_finish_login(gc);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2215
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2216 if (bud_list_cache_exists(gc))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2217 do_import(gc, NULL);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2218
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2219 debug_printf("buddy list loaded\n");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2220
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
2221 aim_clientready(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2222
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2223 aim_icq_reqofflinemsgs(sess);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2224
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2225 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2226
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2227 aim_ssi_reqrights(sess, fr->conn);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2228
2086
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
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2232 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
2233 va_list ap;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2234 struct aim_icq_offlinemsg *msg;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2235 struct gaim_connection *gc = sess->aux_data;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2236
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2237 va_start(ap, fr);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2238 msg = va_arg(ap, struct aim_icq_offlinemsg *);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2239 va_end(ap);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2240
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2241 if (msg->type == 0x0001) {
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2242 char sender[32];
2817
8ceb67d1645e [gaim-migrate @ 2830]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2799
diff changeset
2243 char *tmp = g_strdup(msg->msg);
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2244 time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2245 g_snprintf(sender, sizeof(sender), "%lu", msg->sender);
2817
8ceb67d1645e [gaim-migrate @ 2830]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2799
diff changeset
2246 strip_linefeed(tmp);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
2247 serv_got_im(gc, sender, tmp, 0, t, -1);
2817
8ceb67d1645e [gaim-migrate @ 2830]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2799
diff changeset
2248 g_free(tmp);
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2249 } else {
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2250 debug_printf("unknown offline message type 0x%04x\n", msg->type);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2251 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2252
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2253 return 1;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2254 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2255
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2256 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
2257 {
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2258 aim_icq_ackofflinemsgs(sess);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2259 return 1;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2260 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2261
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2262 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
2263 {
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2264 struct gaim_connection *gc = sess->aux_data;
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2265 va_list ap;
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2266 struct aim_icq_simpleinfo *info;
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2267 char buf[16 * 1024];
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2268 char who[16];
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2269
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2270 va_start(ap, fr);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2271 info = va_arg(ap, struct aim_icq_simpleinfo *);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2272 va_end(ap);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2273
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2274 g_snprintf(who, sizeof who, "%lu", info->uin);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2275 g_snprintf(buf, sizeof buf,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2276 "<B>UIN:</B> %lu<BR>"
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2277 "<B>Nick:</B> %s<BR>"
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2278 "<B>Name:</B> %s %s<BR>"
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2279 "<B>Email:</B> %s\n",
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2280 info->uin,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2281 info->nick,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2282 info->first, info->last,
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2283 info->email);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2284
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2285 g_show_info_text(gc, who, FALSE, buf, NULL);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2286
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2287 return 1;
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2288 }
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2289
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2290 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
2291 {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2292 char *msg, *url;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2293 fu16_t wid, hei, delay;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2294 va_list ap;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2295
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2296 va_start(ap, fr);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2297 msg = va_arg(ap, char *);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2298 url = va_arg(ap, char *);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2299 wid = (fu16_t)va_arg(ap, int);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2300 hei = (fu16_t)va_arg(ap, int);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2301 delay = (fu16_t)va_arg(ap, int);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2302 va_end(ap);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2303
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2304 serv_got_popup(msg, url, wid, hei);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2305
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2306 return 1;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2307 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
2308
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2309 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
2310 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2311 char *address, *SNs;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2312 int i, num;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2313 char *buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2314 int at = 0, len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2315
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2316 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2317 address = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2318 num = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2319 SNs = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2320 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2321
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2322 len = num * (MAXSNLEN + 1) + 1024;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2323 buf = g_malloc(len);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2324 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
2325 for (i = 0; i < num; i++)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2326 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]);
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2327 g_show_info_text(NULL, NULL, FALSE, buf, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2328 g_free(buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2329
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2330 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2331 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2332
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2333 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
2334 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2335 char *address;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2336 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2337
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2338 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2339 address = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2340 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2341
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2342 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2343 do_error_dialog(buf, _("Error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2344
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2345 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2346 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2347
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2348 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
2349 fu16_t status;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2350 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2351 char msg[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2352 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2353
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2354 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2355 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
2356 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2357
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2358 debug_printf("account confirmation returned status 0x%04x (%s)\n", status,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2359 status ? "email sent" : "unknown");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2360 if (status) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2361 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
2362 gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2363 do_error_dialog(msg, "Confirm");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2364 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2365
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2366 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2367 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2368
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2369 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
2370 int change, str;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2371 fu16_t perms, type, length;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2372 char *val;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2373 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2374 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2375 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2376
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2377 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2378 change = va_arg(ap, int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2379 perms = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2380 type = (fu16_t)va_arg(ap, unsigned int);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2381 length = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2382 val = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2383 str = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2384 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2385
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2386 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
2387 change ? " change" : "", perms, type, length, str ? val : "(not string)");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2388
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2389 if ((type == 0x0011) && str) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2390 g_snprintf(buf, sizeof(buf), "The email address for %s is %s", gc->username, val);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2391 do_error_dialog(buf, "Email");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2392 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2393
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2394 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2395 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2396
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2397 static void oscar_keepalive(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2398 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2399 aim_flap_nop(odata->sess, odata->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2400 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2401
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2402 static char *oscar_name() {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2403 return "Oscar";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2404 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2405
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2406 static void oscar_send_typing_stopped(struct gaim_connection *gc, char *name) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2407 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2408 struct direct_im *dim = find_direct_im(odata, name);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2409 if (!dim)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2410 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2411 aim_send_typing(odata->sess, dim->conn, FALSE);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2412 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2413
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2414 static int oscar_send_typing(struct gaim_connection *gc, char *name) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2415 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2416 struct direct_im *dim = find_direct_im(odata, name);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2417 if (!dim)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2418 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2419 aim_send_typing(odata->sess, dim->conn, TRUE);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2420 return 0;
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
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
2423 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int imflags) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2424 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2425 struct direct_im *dim = find_direct_im(odata, name);
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2426 int ret = 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2427 if (dim) {
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2428 ret = aim_send_im_direct(odata->sess, dim->conn, message);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2429 } else {
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2430 if (imflags & IM_FLAG_AWAY) {
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
2431 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
2432 } else {
2197
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2433 struct aim_sendimext_args args;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2434 GSList *h = odata->hasicons;
2137
18722ae5b882 [gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2131
diff changeset
2435 struct icon_req *ir = NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2436 char *who = normalize(name);
2197
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2437 struct stat st;
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
2438
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
2439 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES;
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
2440 if (odata->icq)
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
2441 args.flags |= AIM_IMFLAGS_OFFLINE;
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
2442
2273
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
2443 args.features = gaim_features;
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
2444 args.featureslen = sizeof(gaim_features);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2445
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2446 while (h) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2447 ir = h->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2448 if (ir->request && !strcmp(who, ir->user))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2449 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2450 h = h->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2451 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2452 if (h) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2453 ir->request = FALSE;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2454 args.flags |= AIM_IMFLAGS_BUDDYREQ;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2455 debug_printf("sending buddy icon request with message\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2456 }
2197
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2457
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
2458 if (gc->user->iconfile[0] && !stat(gc->user->iconfile, &st)) {
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
2459 FILE *file = fopen(gc->user->iconfile, "r");
2197
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2460 if (file) {
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2461 char *buf = g_malloc(st.st_size);
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2462 fread(buf, 1, st.st_size, file);
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2463
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2464 args.iconlen = st.st_size;
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2465 args.iconsum = aim_iconsum(buf, st.st_size);
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2466 args.iconstamp = st.st_mtime;
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2467
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2468 args.flags |= AIM_IMFLAGS_HASICON;
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
2469 debug_printf("Claiming to have an icon.\n");
2197
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2470
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2471 fclose(file);
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2472 g_free(buf);
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2473 }
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2474 }
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2475
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2476 args.destsn = name;
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2477 args.msg = message;
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2478 args.msglen = strlen(message);
8f1ca76e46f5 [gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2196
diff changeset
2479
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
2480 ret = aim_send_im_ext(odata->sess, &args);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2481 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2482 }
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2483 if (ret >= 0)
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2484 return 1;
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
2485 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2486 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2487
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2488 static void oscar_get_info(struct gaim_connection *g, char *name) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2489 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2490 if (odata->icq)
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2491 aim_icq_getsimpleinfo(odata->sess, name);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2492 else
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2493 /* 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
2494 * 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
2495 * insert in the middle. i hate people. */
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2496 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2497 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2498
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2499 static void oscar_get_away(struct gaim_connection *g, char *name) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2500 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2501 if (!odata->icq)
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
2502 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2503 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2504
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2505 static void oscar_get_caps(struct gaim_connection *g, char *name) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2506 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2507 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_CAPABILITIES);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2508 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2509
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2510 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
2511 char *maiden, char *city, char *state, char *country, int web) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2512 /* FIXME : some of these things are wrong, but i'm lazy */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2513 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2514 aim_setdirectoryinfo(odata->sess, odata->conn, first, middle, last,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2515 maiden, NULL, NULL, city, state, NULL, 0, web);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2516 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2517
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2518
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2519 static void oscar_set_idle(struct gaim_connection *g, int time) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2520 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2521 aim_bos_setidle(odata->sess, odata->conn, time);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2522 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2523
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2524 static void oscar_set_info(struct gaim_connection *g, char *info) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2525 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2526 gchar *inforeal;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2527
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2528 if (odata->rights.maxsiglen == 0)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2529 do_error_dialog("oscar_set_info called before locate rights received", "Protocol Error");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2530
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2531 if (strlen(info) > odata->rights.maxsiglen) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2532 gchar *errstr;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2533
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2534 errstr = g_strdup_printf("Maximum info length of %d bytes exceeded, truncating", odata->rights.maxsiglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2535
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2536 do_error_dialog(errstr, "Info Too Long");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2537
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2538 g_free(errstr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2539 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2540
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2541 inforeal = g_strndup(info, odata->rights.maxsiglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2542
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2543 aim_bos_setprofile(odata->sess, odata->conn, inforeal, NULL, gaim_caps);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2544
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2545 g_free(inforeal);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2546
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2547 return;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2548 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2549
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2550 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
2551 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2552
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2553 if (od->rights.maxawaymsglen == 0)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2554 do_error_dialog("oscar_set_away_aim called before locate rights received", "Protocol Error");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2555
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2556 if (gc->away)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2557 g_free(gc->away);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2558 gc->away = NULL;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2559
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2560 if (!message) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2561 aim_bos_setprofile(od->sess, od->conn, NULL, "", gaim_caps);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2562 return;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2563 }
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2564
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2565 if (strlen(message) > od->rights.maxawaymsglen) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2566 gchar *errstr;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2567
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2568 errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2569
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2570 do_error_dialog(errstr, "Away Message Too Long");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2571
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2572 g_free(errstr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2573 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2574
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2575 gc->away = g_strndup(message, od->rights.maxawaymsglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2576 aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2577
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2578 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2579 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2580
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2581 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
2582 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2583
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2584 if (gc->away)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2585 gc->away = NULL;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2586
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2587 if (!strcmp(state, "Online"))
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
2588 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2589 else if (!strcmp(state, "Away")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2590 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2591 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2592 } else if (!strcmp(state, "Do Not Disturb")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2593 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_DND);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2594 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2595 } else if (!strcmp(state, "Not Available")) {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
2596 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2597 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2598 } else if (!strcmp(state, "Occupied")) {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
2599 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_BUSY);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2600 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2601 } else if (!strcmp(state, "Free For Chat")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2602 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2603 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2604 } else if (!strcmp(state, "Invisible")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2605 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2606 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2607 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) {
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2608 if (message) {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
2609 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2610 gc->away = "";
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2611 } else {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
2612 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
2613 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2614 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2615
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2616 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2617 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2618
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2619 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
2620 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2621 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2622
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2623 if (od->icq)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2624 oscar_set_away_icq(gc, od, state, message);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2625 else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2626 oscar_set_away_aim(gc, od, message);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2627
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2628 return;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2629 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2630
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2631 static void oscar_warn(struct gaim_connection *g, char *name, int anon) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2632 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2113
9f83b7ef1fdc [gaim-migrate @ 2123]
Adam Fritzler <mid@auk.cx>
parents: 2092
diff changeset
2633 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
2634 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2635
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2636 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
2637 char *maiden, char *city, char *state, char *country, char *email) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2638 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2639 if (strlen(email))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2640 aim_usersearch_address(odata->sess, odata->conn, email);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2641 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2642
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2643 static void oscar_add_buddy(struct gaim_connection *g, char *name) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2644 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2645 if (odata->sess->ssi.received_data) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2646 debug_printf("ssi: adding %s to group %s\n", name, find_group_by_buddy(g, name)->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2647 aim_ssi_addbuddies(odata->sess, odata->conn, find_group_by_buddy(g, name)->name, &name, 1);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2648 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2649 /* aim_add_buddy(odata->sess, odata->conn, name); */
2086
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
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2652 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2653 char **sns;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2654 GSList *grp, *mem;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2655 struct group *group;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2656 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2657 /* char buf[MSG_LEN]; */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2658 int tmp=0, n=0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2659
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2660 if (odata->sess->ssi.received_data) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2661 for (grp=g->groups; grp; grp=g_slist_next(grp)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2662 group = (struct group*)grp->data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2663 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2664 for (mem=group->members; mem; mem=mem->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2665 if (!aim_ssi_inlist(odata->sess, odata->conn, ((struct buddy*)mem->data)->name, 0x0000))
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2666 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2667 sns = (char **)malloc(tmp*sizeof(char*));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2668 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2669 for (mem=group->members; mem; mem=mem->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2670 if (!aim_ssi_inlist(odata->sess, odata->conn, ((struct buddy*)mem->data)->name, 0x0000)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2671 debug_printf("ssi: adding %s from local list to server list\n", ((struct buddy*)mem->data)->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2672 sns[tmp] = ((char *)((struct buddy*)mem->data)->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2673 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2674 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2675 if (tmp) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2676 aim_ssi_addbuddies(odata->sess, odata->conn, group->name, sns, tmp);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2677 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2678 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2679 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2680 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2681
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2682 /* while (buddies) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2683 if (n > MSG_LEN - 18) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2684 aim_bos_setbuddylist(odata->sess, odata->conn, buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2685 n = 0;
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 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2688 buddies = buddies->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2689 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2690 aim_bos_setbuddylist(odata->sess, odata->conn, buf); */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2691 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2692
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2679
diff changeset
2693 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2694 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2695 if (odata->sess->ssi.received_data)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2696 while (aim_ssi_inlist(odata->sess, odata->conn, name, 0x0000) && !aim_ssi_delbuddies(odata->sess, odata->conn, group, &name, 1))
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2697 debug_printf("ssi: deleted %s from the server list\n", name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2698 /* aim_remove_buddy(odata->sess, odata->conn, name); */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2699 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2700
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2701 static void oscar_remove_buddies(struct gaim_connection *g, GList *buddies, char *group) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2702 GList *cur;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2703 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2704 if (odata->sess->ssi.received_data) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2705 int tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2706 for (cur=buddies; cur; cur=cur->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2707 if (aim_ssi_inlist(odata->sess, odata->conn, cur->data, 0x0000))
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2708 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2709 if (tmp) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2710 char **sns;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2711 sns = (char **)malloc(tmp*sizeof(char*));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2712 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2713 for (cur=buddies; cur; cur=cur->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2714 if (aim_ssi_inlist(odata->sess, odata->conn, cur->data, 0x0000)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2715 sns[tmp] = cur->data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2716 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2717 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2718 aim_ssi_delbuddies(odata->sess, odata->conn, group, sns, tmp);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2719 debug_printf("ssi: deleted some buddies from the server list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2720 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2721 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2722 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2723 /* for (cur=buddies; cur; cur=cur->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2724 aim_remove_buddy(odata->sess, odata->conn, cur->data); */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2725 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2726
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2727 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
2728 /* 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
2729 fu16_t maxbuddies, maxgroups, maxpermits, maxdenies;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2730 va_list ap;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2731
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2732 va_start(ap, fr);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2733 maxbuddies = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2734 maxgroupss = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2735 maxpermits = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2736 maxdenies = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2737 va_end(ap);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2738
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2739 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
2740 */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2741 debug_printf("ssi: requesting ssi list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2742
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2743 aim_ssi_reqdata(sess, fr->conn, sess->ssi.timestamp, sess->ssi.revision);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2744
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2745 return 1;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2746 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2747
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2748 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
2749 struct gaim_connection *gc = sess->aux_data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2750 struct aim_ssi_item *curitem, *curgroup;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2751 struct group *g;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2752 GSList *grp;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2753 GSList *mem;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2754 int tmp;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2755 char **sns;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2756
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2757 debug_printf("ssi: syncing local list and server list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2758
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2759 /* Activate SSI */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2760 debug_printf("ssi: activating server-stored buddy list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2761 aim_ssi_enable(sess, fr->conn);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2762
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2763 /* Clean the buddy list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2764 /* aim_ssi_cleanlist(sess, fr->conn); */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2765
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2766 /* Delete the buddy list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2767 /* aim_ssi_deletelist(sess, fr->conn); */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2768
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2769 /* Add from server list to local list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2770 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2771 for (curitem=sess->ssi.items; curitem; curitem=curitem->next) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2772 switch (curitem->type) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2773 case 0x0000: /* Buddy */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2774 if ((curitem->name) && (!find_buddy(gc, curitem->name))) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2775 curgroup = sess->ssi.items;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2776 while (curgroup) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2777 if ((curgroup->type == 0x0001) && (curgroup->gid == curitem->gid) && (curgroup->name)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2778 debug_printf("ssi: adding buddy %s from server list to local list\n", curitem->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2779 add_buddy(gc, curgroup->name, curitem->name, 0);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2780 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2781 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2782 curgroup = curgroup->next;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2783 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2784 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2785 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2786
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2787 case 0x0002: /* Permit item */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2788 if (curitem->name) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2789 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2790 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
2791 if (!list) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2792 char *name;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2793 debug_printf("ssi: adding permit %s from server list to local list\n", curitem->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2794 name = g_strdup(normalize(curitem->name));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2795 gc->permit = g_slist_append(gc->permit, name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2796 build_allow_list();
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2797 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2798 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2799 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2800 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2801
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2802 case 0x0003: /* Deny item */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2803 if (curitem->name) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2804 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2805 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
2806 if (!list) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2807 char *name;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2808 debug_printf("ssi: adding deny %s from server list to local list\n", curitem->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2809 name = g_strdup(normalize(curitem->name));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2810 gc->deny = g_slist_append(gc->deny, name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2811 build_block_list();
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2812 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2813 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2814 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2815 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2816
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2817 case 0x0004: /* Permit/deny item */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2818 if (curitem->data) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2819 fu8_t permdeny;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2820 if (permdeny = aim_ssi_getpermdeny(curitem->data)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2821 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
2822 gc->permdeny = permdeny;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2823 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2824 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2825 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2826 } /* End of switch on curitem->type */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2827 } /* End of for loop */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2828 if (tmp)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2829 do_export(gc);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2830
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2831 /* Add from local list to server list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2832 if (gc) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2833 /* Buddies */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2834 grp = gc->groups;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2835 while (grp) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2836 g = (struct group*)grp->data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2837 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2838 for (mem=g->members; mem; mem=mem->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2839 if (!aim_ssi_inlist(sess, fr->conn, ((struct buddy*)mem->data)->name, 0x0000))
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2840 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2841 sns = (char **)malloc(tmp*sizeof(char*));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2842 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2843 for (mem=g->members; mem; mem=mem->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2844 if (!aim_ssi_inlist(sess, fr->conn, ((struct buddy*)mem->data)->name, 0x0000)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2845 debug_printf("ssi: adding buddy %s from local list to server list\n", ((struct buddy*)mem->data)->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2846 sns[tmp] = ((char *)((struct buddy*)mem->data)->name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2847 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2848 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2849 if (tmp) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2850 aim_ssi_addbuddies(sess, fr->conn, g->name, sns, tmp);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2851 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2852 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2853 grp = g_slist_next(grp);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2854 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2855
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2856 /* Permit list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2857 if (gc->permit) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2858 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2859 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2860 for (list=gc->permit; list; list=list->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2861 if (!aim_ssi_inlist(sess, fr->conn, list->data, 0x0002)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2862 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2863 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2864 sns = (char **)malloc(tmp*sizeof(char*));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2865 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2866 for (list=gc->permit; list; list=list->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2867 if (!aim_ssi_inlist(sess, fr->conn, list->data, 0x0002)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2868 debug_printf("ssi: adding permit %s from local list to server list\n", list->data);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2869 sns[tmp] = list->data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2870 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2871 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2872 if (tmp) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2873 aim_ssi_addpermits(sess, fr->conn, sns, tmp);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2874 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2875 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2876 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2877
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2878 /* Deny list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2879 if (gc->deny) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2880 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2881 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2882 for (list=gc->deny; list; list=list->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2883 if (!aim_ssi_inlist(sess, fr->conn, list->data, 0x0003)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2884 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2885 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2886 sns = (char **)malloc(tmp*sizeof(char*));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2887 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2888 for (list=gc->deny; list; list=list->next)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2889 if (!aim_ssi_inlist(sess, fr->conn, list->data, 0x0003)) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2890 debug_printf("ssi: adding deny %s from local list to server list\n", list->data);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2891 sns[tmp] = list->data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2892 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2893 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2894 if (tmp) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2895 aim_ssi_adddenies(sess, fr->conn, sns, tmp);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2896 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2897 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2898 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2899 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2900
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
2901 return 1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2902 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2903
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2904 static GList *oscar_chat_info(struct gaim_connection *gc) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2905 GList *m = NULL;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2906 struct proto_chat_entry *pce;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2907
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2908 pce = g_new0(struct proto_chat_entry, 1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2909 pce->label = _("Join what group:");
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2910 m = g_list_append(m, pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2911
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2912 pce = g_new0(struct proto_chat_entry, 1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2913 pce->label = _("Exchange:");
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2914 pce->is_int = TRUE;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2915 pce->min = 4;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2916 pce->max = 20;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2917 m = g_list_append(m, pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2918
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2919 return m;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2920 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2921
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2922 static void oscar_join_chat(struct gaim_connection *g, GList *data) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2923 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2924 aim_conn_t *cur;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2925 char *name;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2926 int *exchange;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2927
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2928 if (!data || !data->next)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2929 return;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2930
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2931 name = data->data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2932 exchange = data->next->data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2933
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2934 debug_printf("Attempting to join chat room %s.\n", name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2935 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2936 debug_printf("chatnav exists, creating room\n");
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
2937 aim_chatnav_createroom(odata->sess, cur, name, *exchange);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2938 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2939 /* this gets tricky */
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2940 struct create_room *cr = g_new0(struct create_room, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2941 debug_printf("chatnav does not exist, opening chatnav\n");
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2942 cr->exchange = *exchange;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2943 cr->name = g_strdup(name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2944 odata->create_rooms = g_slist_append(odata->create_rooms, cr);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
2945 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2946 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2947 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2948
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2949 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
2950 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2951 struct chat_connection *ccon = find_oscar_chat(g, id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2952
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2953 if (!ccon)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2954 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2955
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2956 aim_chat_invite(odata->sess, odata->conn, name, message ? message : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2957 ccon->exchange, ccon->name, 0x0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2958 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2959
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2960 static void oscar_chat_leave(struct gaim_connection *g, int id) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2961 struct oscar_data *odata = g ? (struct oscar_data *)g->proto_data : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2962 GSList *bcs = g->buddy_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2963 struct conversation *b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2964 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2965 int count = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2966
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2967 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2968 count++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2969 b = (struct conversation *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2970 if (id == b->id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2971 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2972 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2973 b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2974 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2975
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2976 if (!b)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2977 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2978
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2979 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
2980
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2981 c = find_oscar_chat(g, b->id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2982 if (c != NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2983 if (odata)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2984 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2985 if (c->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
2986 gaim_input_remove(c->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2987 if (g && odata->sess)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2988 aim_conn_kill(odata->sess, &c->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2989 g_free(c->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2990 g_free(c->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2991 g_free(c);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2992 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2993 /* 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
2994 serv_got_chat_left(g, b->id);
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
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2997 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
2998 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2999 GSList *bcs = g->buddy_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3000 struct conversation *b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3001 struct chat_connection *c = NULL;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3002 char *buf, *buf2;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3003 int i, j;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3004
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3005 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3006 b = (struct conversation *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3007 if (id == b->id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3008 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3009 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3010 b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3011 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3012 if (!b)
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3013 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3014
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3015 bcs = odata->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3016 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3017 c = (struct chat_connection *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3018 if (b == c->cnv)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3019 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3020 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3021 c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3022 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3023 if (!c)
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3024 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3025
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3026 buf = g_malloc(strlen(message) * 4 + 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3027 for (i = 0, j = 0; i < strlen(message); i++) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3028 if (message[i] == '\n') {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3029 buf[j++] = '<';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3030 buf[j++] = 'B';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3031 buf[j++] = 'R';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3032 buf[j++] = '>';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3033 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3034 buf[j++] = message[i];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3035 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3036 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3037 buf[j] = '\0';
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3038
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3039 if (strlen(buf) > c->maxlen)
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3040 return -E2BIG;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3041
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3042 buf2 = strip_html(buf);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3043 if (strlen(buf2) > c->maxvis) {
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3044 g_free(buf2);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3045 return -E2BIG;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3046 }
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3047 g_free(buf2);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3048
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3049 aim_chat_send_im(odata->sess, c->conn, 0, buf, strlen(buf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3050 g_free(buf);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3051 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3052 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3053
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3054 static char **oscar_list_icon(int uc) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3055 if (uc == 0)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3056 return (char **)icon_online_xpm;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3057 if (uc & 0x7fc0) {
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3058 uc >>= 6;
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3059 if (uc & AIM_ICQ_STATE_AWAY)
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3060 return icon_away_xpm;
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3061 if (uc & AIM_ICQ_STATE_DND)
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3062 return icon_dnd_xpm;
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
3063 if (uc & AIM_ICQ_STATE_OUT)
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3064 return icon_na_xpm;
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
3065 if (uc & AIM_ICQ_STATE_BUSY)
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3066 return icon_occ_xpm;
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3067 if (uc & AIM_ICQ_STATE_CHAT)
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3068 return icon_ffc_xpm;
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3069 if (uc & AIM_ICQ_STATE_INVISIBLE)
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3070 return icon_offline_xpm;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3071 return icon_online_xpm;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3072 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3073 if (uc & UC_UNAVAILABLE)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3074 return (char **)away_icon_xpm;
2689
870450d36999 [gaim-migrate @ 2702]
Adam Fritzler <mid@auk.cx>
parents: 2681
diff changeset
3075 if (uc & UC_AB)
2679
94aa499ecd39 [gaim-migrate @ 2692]
Adam Fritzler <mid@auk.cx>
parents: 2675
diff changeset
3076 return (char **)ab_xpm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3077 if (uc & UC_AOL)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3078 return (char **)aol_icon_xpm;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3079 if (uc & UC_ADMIN)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3080 return (char **)admin_icon_xpm;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3081 if (uc & UC_UNCONFIRMED)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3082 return (char **)dt_icon_xpm;
2297
a0f6ead876ca [gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2288
diff changeset
3083 if (uc & UC_NORMAL)
a0f6ead876ca [gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2288
diff changeset
3084 return (char **)free_icon_xpm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3085 return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3086 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3087
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3088 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
3089 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3090 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3091 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3092 aim_conn_t *newconn, *listenerconn;
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
3093 struct conversation *cnv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3094 struct direct_im *dim;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3095 char buf[256];
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3096 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3097
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3098 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3099 newconn = va_arg(ap, aim_conn_t *);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3100 listenerconn = va_arg(ap, aim_conn_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3101 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3102
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3103 aim_conn_close(listenerconn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3104 aim_conn_kill(sess, &listenerconn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3105
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3106 sn = g_strdup(aim_directim_getsn(newconn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3107
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3108 debug_printf("DirectIM: initiate success to %s\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3109 dim = find_direct_im(od, sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3110
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3111 if (!(cnv = find_conversation(sn)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3112 cnv = new_conversation(sn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
3113 gaim_input_remove(dim->watcher);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3114 dim->conn = newconn;
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
3115 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3116 oscar_callback, dim->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3117 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3118 g_free(sn);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
3119 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3120
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3121 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
3122 gaim_directim_incoming, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3123 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
3124 gaim_directim_typing, 0);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3125 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DOWNLOADIMAGE,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3126 gaim_update_ui, 0);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3127 return 1;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3128 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3129
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3130 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
3131 va_list ap;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3132 char *sn;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3133 double percent;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3134 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3135 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3136 struct conversation *c;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3137 struct direct_im *dim;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3138
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3139 va_start(ap, fr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3140 sn = va_arg(ap, char *);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3141 percent = va_arg(ap, double);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3142 va_end(ap);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3143
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3144 dim = find_direct_im(od, sn);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3145 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3146 if ((c = find_conversation(sn)))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3147 update_progress(c, percent);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3148 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3149 oscar_callback, dim->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3150
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3151 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3152 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3153
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3154 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
3155 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3156 char *msg, *sn;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3157 int len;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3158 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3159
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3160 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3161 sn = va_arg(ap, char *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3162 msg = va_arg(ap, char *);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3163 len = va_arg(ap, int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3164 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3165
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3166 debug_printf("Got DirectIM message from %s\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3167
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3168 serv_got_im(gc, sn, msg, 0, time(NULL), len);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3169
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3170 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3171 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3172
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3173 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
3174 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3175 char *sn;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3176 int typing;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3177 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3178
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3179 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3180 sn = va_arg(ap, char *);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3181 typing = va_arg(ap, int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3182 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3183
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3184 if (typing) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3185 /* 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
3186 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
3187 serv_got_typing(gc,sn,0);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3188 } else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3189 serv_got_typing_stopped(gc,sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3190 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3191 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3192
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3193 struct ask_do_dir_im {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3194 char *who;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3195 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3196 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3197
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
3198 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
3199 g_free(data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3200 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3201
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
3202 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
3203 struct gaim_connection *gc = data->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3204 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3205 struct direct_im *dim;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3206
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3207 dim = find_direct_im(od, data->who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3208 if (dim) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3209 do_error_dialog("Direct IM request already pending.", "Unable");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3210 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3211 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3212 dim = g_new0(struct direct_im, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3213 dim->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3214 g_snprintf(dim->name, sizeof dim->name, "%s", data->who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3215
2717
03bf072c6238 [gaim-migrate @ 2730]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2713
diff changeset
3216 dim->conn = aim_directim_initiate(od->sess, data->who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3217 if (dim->conn != NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3218 od->direct_ims = g_slist_append(od->direct_ims, dim);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
3219 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3220 oscar_callback, dim->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3221 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
3222 gaim_directim_initiate, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3223 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3224 do_error_dialog(_("Unable to open Direct IM"), _("Error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3225 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3226 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3227 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3228
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3229 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
3230 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3231 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
3232 data->who = who;
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3233 data->gc = gc;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3234 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
3235 " Doing this will let them see your IP address, and may be"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3236 " a security risk. Do you wish to continue?"), who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3237 do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3238 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3239
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3240 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
3241 struct oscar_data *od = gc->proto_data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3242 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who)));
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3243 oscar_get_info(gc, who);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3244 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3245
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3246 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) {
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3247 GList *m = NULL;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3248 struct proto_buddy_menu *pbm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3249 char *n = g_strdup(normalize(gc->username));
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3250 struct oscar_data *odata = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3251
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3252 pbm = g_new0(struct proto_buddy_menu, 1);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3253 pbm->label = _("Get Info");
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3254 pbm->callback = oscar_get_info;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3255 pbm->gc = gc;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3256 m = g_list_append(m, pbm);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3257
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3258 if (!odata->icq) {
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3259 pbm = g_new0(struct proto_buddy_menu, 1);
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3260 pbm->label = _("Get Away Msg");
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3261 pbm->callback = oscar_get_away_msg;
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3262 pbm->gc = gc;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3263 m = g_list_append(m, pbm);
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3264
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3265 if (strcmp(n, normalize(who))) {
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3266 pbm = g_new0(struct proto_buddy_menu, 1);
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3267 pbm->label = _("Direct IM");
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3268 pbm->callback = oscar_ask_direct_im;
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3269 pbm->gc = gc;
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3270 m = g_list_append(m, pbm);
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
3271 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3272 }
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3273
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3274 pbm = g_new0(struct proto_buddy_menu, 1);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3275 pbm->label = _("Get Capabilities");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3276 pbm->callback = oscar_get_caps;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3277 pbm->gc = gc;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3278 m = g_list_append(m, pbm);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3279
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3280 g_free(n);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3281
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3282 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3283 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3284
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3285 static GList *oscar_user_opts()
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3286 {
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3287 GList *m = NULL;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3288 struct proto_user_opt *puo;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3289
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3290 puo = g_new0(struct proto_user_opt, 1);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3291 puo->label = "Auth Host:";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3292 puo->def = "login.oscar.aol.com";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3293 puo->pos = USEROPT_AUTH;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3294 m = g_list_append(m, puo);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3295
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3296 puo = g_new0(struct proto_user_opt, 1);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3297 puo->label = "Auth Port:";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3298 puo->def = "5190";
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3299 puo->pos = USEROPT_AUTHPORT;
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3300 m = g_list_append(m, puo);
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3301
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2141
diff changeset
3302 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3303 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3304
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3305 static void oscar_set_permit_deny(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3306 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3307 /* GSList *list;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3308 char buf[MAXMSGLEN];
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3309 int at; */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3310
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3311 if (od->sess->ssi.received_data)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3312 aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3313
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3314 /* switch(gc->permdeny) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3315 case 1:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3316 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3317 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3318 case 2:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3319 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3320 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3321 case 3:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3322 list = gc->permit;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3323 at = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3324 while (list) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3325 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3326 list = list->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3327 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3328 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3329 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3330 case 4:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3331 list = gc->deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3332 at = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3333 while (list) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3334 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3335 list = list->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3336 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3337 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3338 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3339 default:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3340 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3341 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3342 signoff_blocked(gc); */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3343 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3344
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3345 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
3346 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3347 debug_printf("ssi: About to add a permit\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3348 if (od->sess->ssi.received_data)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3349 aim_ssi_addpermits(od->sess, od->conn, &who, 1);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3350 /* if (gc->permdeny != 3) return;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3351 oscar_set_permit_deny(gc); */
2086
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_add_deny(struct gaim_connection *gc, char *who) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3355 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3356 debug_printf("ssi: About to add a deny\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3357 if (od->sess->ssi.received_data)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3358 aim_ssi_adddenies(od->sess, od->conn, &who, 1);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3359 /* if (gc->permdeny != 4) return;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3360 oscar_set_permit_deny(gc); */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3361 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3362
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3363 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
3364 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3365 debug_printf("ssi: About to delete a permit\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3366 if (od->sess->ssi.received_data)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3367 aim_ssi_delpermits(od->sess, od->conn, &who, 1);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3368 /* if (gc->permdeny != 3) return;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3369 oscar_set_permit_deny(gc); */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3370 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3371
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3372 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
3373 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3374 debug_printf("ssi: About to delete a deny\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3375 if (od->sess->ssi.received_data)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3376 aim_ssi_deldenies(od->sess, od->conn, &who, 1);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3377 /* if (gc->permdeny != 4) return;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3378 oscar_set_permit_deny(gc); */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3379 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3380
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3381 static GList *oscar_away_states(struct gaim_connection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3382 {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3383 struct oscar_data *od = gc->proto_data;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3384 GList *m = NULL;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3385
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3386 if (!od->icq)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3387 return g_list_append(m, GAIM_AWAY_CUSTOM);
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3388
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3389 m = g_list_append(m, "Online");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3390 m = g_list_append(m, "Away");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3391 m = g_list_append(m, "Do Not Disturb");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3392 m = g_list_append(m, "Not Available");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3393 m = g_list_append(m, "Occupied");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3394 m = g_list_append(m, "Free For Chat");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3395 m = g_list_append(m, "Invisible");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3396
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3397 return m;
2086
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
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3400 static void oscar_change_email(struct gaim_connection *gc, char *email)
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3401 {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3402 struct oscar_data *od = gc->proto_data;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3403 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
3404
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3405 if (conn) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3406 aim_admin_setemail(od->sess, conn, email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3407 } else {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3408 od->setemail = TRUE;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3409 od->email = g_strdup(email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3410 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3411 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3412 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3413
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3414 static void oscar_format_screenname(struct gaim_connection *gc, char *nick) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3415 struct oscar_data *od = gc->proto_data;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3416 if (!strcmp(normalize(nick), gc->username)) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3417 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3418 od->setnick = TRUE;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3419 od->newsn = g_strdup(nick);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3420 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3421 } else {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3422 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
3423 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3424 } else {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3425 do_error_dialog("The new formatting is invalid.", "Gaim");
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3426 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3427 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3428
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3429 static void oscar_do_action(struct gaim_connection *gc, char *act)
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 struct oscar_data *od = gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3432 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
3433
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3434 if (!strcmp(act, "Set User Info")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3435 show_set_info(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3436 } else if (!strcmp(act, "Change Password")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3437 show_change_passwd(gc);
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3438 } else if (!strcmp(act, "Format Screenname")) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3439 do_prompt_dialog("New screenname formatting:",
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3440 gc->displayname, gc, oscar_format_screenname, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3441 } else if (!strcmp(act, "Confirm Account")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3442 if (!conn) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3443 od->conf = TRUE;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3444 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3445 } else
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3446 aim_admin_reqconfirm(od->sess, conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3447 } else if (!strcmp(act, "Display Current Registered Address")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3448 if (!conn) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3449 od->reqemail = TRUE;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3450 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3451 } else
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3452 aim_admin_getinfo(od->sess, conn, 0x11);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3453 } else if (!strcmp(act, "Change Current Registered Address")) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3454 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
3455 } else if (!strcmp(act, "Search for Buddy by Email")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3456 show_find_email(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3457 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3458 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3459
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3460 static GList *oscar_actions()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3461 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3462 GList *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3463
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3464 m = g_list_append(m, "Set User Info");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3465 m = g_list_append(m, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3466 m = g_list_append(m, "Change Password");
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3467 m = g_list_append(m, "Format Screenname");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3468 m = g_list_append(m, "Confirm Account");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3469 m = g_list_append(m, "Display Current Registered Address");
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3470 m = g_list_append(m, "Change Current Registered Address");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3471 m = g_list_append(m, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3472 m = g_list_append(m, "Search for Buddy by Email");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3473
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3474 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3475 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3476
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3477 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
3478 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3479 struct oscar_data *od = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3480 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3481 od->chpass = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3482 od->oldp = g_strdup(old);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3483 od->newp = g_strdup(new);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3484 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3485 } else {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3486 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
3487 new, old);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3488 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3489 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3490
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3491 static void oscar_convo_closed(struct gaim_connection *gc, char *who)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3492 {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3493 struct oscar_data *od = gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3494 struct direct_im *dim = find_direct_im(od, who);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3495
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3496 if (!dim)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3497 return;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3498
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3499 od->direct_ims = g_slist_remove(od->direct_ims, dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3500 gaim_input_remove(dim->watcher);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3501 aim_conn_kill(od->sess, &dim->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3502 g_free(dim);
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
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3505 static struct prpl *my_protocol = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3506
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3507 void oscar_init(struct prpl *ret) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3508 ret->protocol = PROTO_OSCAR;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3509 ret->options = OPT_PROTO_BUDDY_ICON;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3510 ret->name = oscar_name;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3511 ret->list_icon = oscar_list_icon;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3512 ret->away_states = oscar_away_states;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3513 ret->actions = oscar_actions;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3514 ret->do_action = oscar_do_action;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3515 ret->buddy_menu = oscar_buddy_menu;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3516 ret->user_opts = oscar_user_opts;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3517 ret->login = oscar_login;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3518 ret->close = oscar_close;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3519 ret->send_im = oscar_send_im;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3520 ret->send_typing = oscar_send_typing;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3521 ret->send_typing_stopped = oscar_send_typing_stopped;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3522 ret->set_info = oscar_set_info;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3523 ret->get_info = oscar_get_info;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3524 ret->set_away = oscar_set_away;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3525 ret->get_away = oscar_get_away;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3526 ret->set_dir = oscar_set_dir;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3527 ret->get_dir = NULL; /* Oscar really doesn't have this */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3528 ret->dir_search = oscar_dir_search;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3529 ret->set_idle = oscar_set_idle;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3530 ret->change_passwd = oscar_change_passwd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3531 ret->add_buddy = oscar_add_buddy;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3532 ret->add_buddies = oscar_add_buddies;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3533 ret->remove_buddy = oscar_remove_buddy;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3534 ret->remove_buddies = oscar_remove_buddies;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3535 ret->add_permit = oscar_add_permit;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3536 ret->add_deny = oscar_add_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3537 ret->rem_permit = oscar_rem_permit;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3538 ret->rem_deny = oscar_rem_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3539 ret->set_permit_deny = oscar_set_permit_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3540 ret->warn = oscar_warn;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
3541 ret->chat_info = oscar_chat_info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3542 ret->join_chat = oscar_join_chat;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3543 ret->chat_invite = oscar_chat_invite;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3544 ret->chat_leave = oscar_chat_leave;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3545 ret->chat_whisper = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3546 ret->chat_send = oscar_chat_send;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3547 ret->keepalive = oscar_keepalive;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3548 ret->convo_closed = oscar_convo_closed;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3549
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3550 my_protocol = ret;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3551 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3552
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3553 #ifndef STATIC
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 char *gaim_plugin_init(GModule *handle)
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 load_protocol(oscar_init, sizeof(struct prpl));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3558 return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3559 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3560
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3561 void gaim_plugin_remove()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3562 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3563 struct prpl *p = find_prpl(PROTO_OSCAR);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3564 if (p == my_protocol)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3565 unload_protocol(p);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3566 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3567
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3568 char *name()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3569 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3570 return "Oscar";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3571 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3572
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3573 char *description()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3574 {
2162
a464da684307 [gaim-migrate @ 2172]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2154
diff changeset
3575 return PRPL_DESC("Oscar");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3576 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3577
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3578 #endif