annotate src/protocols/oscar/oscar.c @ 4200:c8fb43808a4b

[gaim-migrate @ 4431] I try to look at it like this: At least now I know a little more about va_args. So when you pass stuff through "...", gcc promotes the argument to an integer. So passing fu16_t because 4 bytes instead of 2. Then when using va_args, you have to use a type that is 4 bytes instead of 2. I guess va_args is different in gcc 2, in that, if you give it a 2 byte type, it will get 4 bytes anyway. Either that, or gcc2 doesn't promote stuff to 4 bytes when passed through .... Anyway, sorry to all gcc3.x users. This patch just fixes a little bit of whitespace stuff, again, for no real reason. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 04 Jan 2003 19:41:07 +0000
parents 97de60e7b7ba
children 511c2b63caa4
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
3664
1a6d3f3bc682 [gaim-migrate @ 3793]
Luke Schierer <lschiere@pidgin.im>
parents: 3660
diff changeset
27 #include <sys/types.h>
1a6d3f3bc682 [gaim-migrate @ 3793]
Luke Schierer <lschiere@pidgin.im>
parents: 3660
diff changeset
28 /*this must happen before sys/socket.h or freebsd won't compile*/
1a6d3f3bc682 [gaim-migrate @ 3793]
Luke Schierer <lschiere@pidgin.im>
parents: 3660
diff changeset
29
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
30 #ifndef _WIN32
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include <netdb.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include <netinet/in.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 #include <arpa/inet.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
34 #include <sys/socket.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
35 #include <unistd.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
36 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
37
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
38 #include <errno.h>
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
39 #include <ctype.h>
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 #include <string.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 #include <stdlib.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 #include <stdio.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 #include <time.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 #include <sys/stat.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
45 #include <signal.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
46
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 #include "multi.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 #include "prpl.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 #include "gaim.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 #include "aim.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 #include "proxy.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
53 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
54 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
55 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
56
3490
16f4776742af [gaim-migrate @ 3547]
Rob Flynn <gaim@robflynn.com>
parents: 3466
diff changeset
57 #include "pixmaps/protocols/oscar/ab.xpm"
16f4776742af [gaim-migrate @ 3547]
Rob Flynn <gaim@robflynn.com>
parents: 3466
diff changeset
58 #include "pixmaps/protocols/oscar/admin_icon.xpm"
16f4776742af [gaim-migrate @ 3547]
Rob Flynn <gaim@robflynn.com>
parents: 3466
diff changeset
59 #include "pixmaps/protocols/oscar/aol_icon.xpm"
16f4776742af [gaim-migrate @ 3547]
Rob Flynn <gaim@robflynn.com>
parents: 3466
diff changeset
60 #include "pixmaps/protocols/oscar/away_icon.xpm"
16f4776742af [gaim-migrate @ 3547]
Rob Flynn <gaim@robflynn.com>
parents: 3466
diff changeset
61 #include "pixmaps/protocols/oscar/dt_icon.xpm"
16f4776742af [gaim-migrate @ 3547]
Rob Flynn <gaim@robflynn.com>
parents: 3466
diff changeset
62 #include "pixmaps/protocols/oscar/free_icon.xpm"
16f4776742af [gaim-migrate @ 3547]
Rob Flynn <gaim@robflynn.com>
parents: 3466
diff changeset
63 #include "pixmaps/protocols/oscar/wireless_icon.xpm"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64
3579
8b3491f1ca56 [gaim-migrate @ 3681]
Sean Egan <seanegan@gmail.com>
parents: 3574
diff changeset
65 #include "pixmaps/protocols/icq/gnomeicu-online.xpm"
8b3491f1ca56 [gaim-migrate @ 3681]
Sean Egan <seanegan@gmail.com>
parents: 3574
diff changeset
66 #include "pixmaps/protocols/icq/gnomeicu-offline.xpm"
8b3491f1ca56 [gaim-migrate @ 3681]
Sean Egan <seanegan@gmail.com>
parents: 3574
diff changeset
67 #include "pixmaps/protocols/icq/gnomeicu-away.xpm"
8b3491f1ca56 [gaim-migrate @ 3681]
Sean Egan <seanegan@gmail.com>
parents: 3574
diff changeset
68 #include "pixmaps/protocols/icq/gnomeicu-dnd.xpm"
8b3491f1ca56 [gaim-migrate @ 3681]
Sean Egan <seanegan@gmail.com>
parents: 3574
diff changeset
69 #include "pixmaps/protocols/icq/gnomeicu-na.xpm"
8b3491f1ca56 [gaim-migrate @ 3681]
Sean Egan <seanegan@gmail.com>
parents: 3574
diff changeset
70 #include "pixmaps/protocols/icq/gnomeicu-occ.xpm"
8b3491f1ca56 [gaim-migrate @ 3681]
Sean Egan <seanegan@gmail.com>
parents: 3574
diff changeset
71 #include "pixmaps/protocols/icq/gnomeicu-ffc.xpm"
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
72
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 /* constants to identify proto_opts */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 #define USEROPT_AUTH 0
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 #define USEROPT_AUTHPORT 1
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
77 #define UC_AOL 0x02
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
78 #define UC_ADMIN 0x04
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
79 #define UC_UNCONFIRMED 0x08
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
80 #define UC_NORMAL 0x10
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
81 #define UC_AB 0x20
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
82 #define UC_WIRELESS 0x40
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
83
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
86 /* For win32 compatability */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
87 G_MODULE_IMPORT GSList *connections;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
88 G_MODULE_IMPORT int report_idle;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
89
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
90 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON |
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
91 AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE;
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
92
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
93 /* Set AIM caps, because Gaim can still do them over ICQ and
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
94 * Winicq doesn't mind. */
4154
3468d666d3cc [gaim-migrate @ 4382]
Mark Doliner <mark@kingant.net>
parents: 4152
diff changeset
95 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE;
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
96 /* static int caps_icq = AIM_CAPS_ICQ; */
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
97 /* What does AIM_CAPS_ICQ actually mean? -SE */
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
98
2308
a90be9567452 [gaim-migrate @ 2318]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2305
diff changeset
99 static fu8_t gaim_features[] = {0x01, 0x01, 0x01, 0x02};
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 struct oscar_data {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
102 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
103 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 guint cnpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 guint paspa;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
107 guint emlpa;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
109 GSList *create_rooms;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 gboolean conf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 gboolean reqemail;
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
113 gboolean setemail;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
114 char *email;
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
115 gboolean setnick;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
116 char *newsn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 gboolean chpass;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 char *oldp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 char *newp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 GSList *oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 GSList *direct_ims;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
123 GSList *file_transfers;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 GSList *hasicons;
3600
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
125 GHashTable *supports_tn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
127 gboolean killme;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
128 gboolean icq;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
129 GSList *evilhack;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
130
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
131 struct {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
132 guint maxbuddies; /* max users you can watch */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
133 guint maxwatchers; /* max users who can watch you */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
134 guint maxpermits; /* max users on permit list */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
135 guint maxdenies; /* max users on deny list */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
136 guint maxsiglen; /* max size (bytes) of profile */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
137 guint maxawaymsglen; /* max size (bytes) of posted away message */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
138 } rights;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
141 struct create_room {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
142 char *name;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
143 int exchange;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
144 };
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
145
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 struct chat_connection {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 char *name;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 char *show; /* AOL did something funny to us */
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
149 fu16_t exchange;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
150 fu16_t instance;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 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
152 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 int inpa;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 int id;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 struct gaim_connection *gc; /* i hate this. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 struct conversation *cnv; /* bah. */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
157 int maxlen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
158 int maxvis;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 struct direct_im {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 char name[80];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 int watcher;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
165 aim_conn_t *conn;
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
166 gboolean connected;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 };
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 struct ask_direct {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 char *sn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
172 char ip[64];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
173 fu8_t cookie[8];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
176 struct oscar_file_transfer {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
177 enum { OFT_SENDFILE_IN, OFT_SENDFILE_OUT } type;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
178 aim_conn_t *conn;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
179 struct file_transfer *xfer;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
180 char *sn;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
181 char ip[64];
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
182 fu16_t port;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
183 fu8_t cookie[8];
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
184 int totsize;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
185 int filesdone;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
186 int totfiles;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
187 int watcher;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
188 };
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
189
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 struct icon_req {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 char *user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 time_t timestamp;
2196
016c5307f26b [gaim-migrate @ 2206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2194
diff changeset
193 unsigned long length;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2172
diff changeset
194 unsigned long checksum;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 gboolean request;
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
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
198 struct channel4_data {
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
199 struct gaim_connection *gc;
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
200 gchar *uin;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
201 gchar *nick;
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
202 };
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
203
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
204 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
205 GSList *d = od->direct_ims;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 char *n = g_strdup(normalize(who));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 struct direct_im *m = 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 while (d) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 m = (struct direct_im *)d->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 if (!strcmp(n, normalize(m->name)))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 d = d->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
221 static char *extract_name(const char *name) {
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
222 char *tmp, *x;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 int i, j;
4120
697217b52ebd [gaim-migrate @ 4337]
Rob Flynn <gaim@robflynn.com>
parents: 4111
diff changeset
224
697217b52ebd [gaim-migrate @ 4337]
Rob Flynn <gaim@robflynn.com>
parents: 4111
diff changeset
225 if (!name)
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
226 return NULL;
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
227
4120
697217b52ebd [gaim-migrate @ 4337]
Rob Flynn <gaim@robflynn.com>
parents: 4111
diff changeset
228 x = strchr(name, '-');
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
229
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 if (!x) return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 x = strchr(++x, '-');
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 if (!x) return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 tmp = g_strdup(++x);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 for (i = 0, j = 0; x[i]; i++) {
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
236 char hex[3];
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
237 if (x[i] != '%') {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 tmp[j++] = x[i];
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
239 continue;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 }
2361
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
241 strncpy(hex, x + ++i, 2); hex[2] = 0;
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
242 i++;
554b001d7d98 [gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2357
diff changeset
243 tmp[j++] = strtol(hex, NULL, 16);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 tmp[j] = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 return tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 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
251 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 while (g) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 c = (struct chat_connection *)g->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 if (c->id == id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 g = g->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 return c;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 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
266 aim_conn_t *conn) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 while (g) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 c = (struct chat_connection *)g->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 if (c->conn == conn)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 g = g->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 return c;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
281 /* XXX there must be a better way than this.... -- wtm */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
282 static struct oscar_file_transfer *find_oft_by_conn(struct gaim_connection *gc,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
283 aim_conn_t *conn) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
284 GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
285 struct oscar_file_transfer *f = NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
286
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
287 while (g) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
288 f = (struct oscar_file_transfer *)g->data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
289 if (f->conn == conn)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
290 break;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
291 g = g->next;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
292 f = NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
293 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
294
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
295 return f;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
296 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
297
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
298 static struct oscar_file_transfer *find_oft_by_xfer(struct gaim_connection *gc,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
299 struct file_transfer *xfer) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
300 GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
301 struct oscar_file_transfer *f = NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
302
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
303 while (g) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
304 f = (struct oscar_file_transfer *)g->data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
305 if (f->xfer == xfer)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
306 break;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
307 g = g->next;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
308 f = NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
309 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
310
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
311 return f;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
312 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
313
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
314 static struct oscar_file_transfer *find_oft_by_cookie(struct gaim_connection *gc,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
315 const char *cookie) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
316 GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
317 struct oscar_file_transfer *f = NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
318
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
319 while (g) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
320 f = (struct oscar_file_transfer *)g->data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
321 if (!strncmp(f->cookie, cookie, 8))
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
322 break;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
323 g = g->next;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
324 f = NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
325 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
326
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
327 return f;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
328 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
329
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
330 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
331 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
332 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
333 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
334 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
335 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
336 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
337 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
338 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
339 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
340 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
341 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
342 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
343 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
344 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
345 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
346 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
347 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
348 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
349 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
350 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
351 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
352 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
353 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
354 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
355 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
356 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
357 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
358 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
359 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
360 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
361 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
362 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
363 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
364 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
365 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
366 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
367 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
368 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
369 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
370 static int gaim_icqsimpleinfo (aim_session_t *, aim_frame_t *, ...);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
371 static int gaim_icqallinfo (aim_session_t *, aim_frame_t *, ...);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
372 static int gaim_popup (aim_session_t *, aim_frame_t *, ...);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
373 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
374 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
375
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
376 static int gaim_directim_initiate(aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
377 static int gaim_directim_incoming(aim_session_t *, aim_frame_t *, ...);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
378 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
379 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
381 static int oscar_file_transfer_do(aim_session_t *, aim_frame_t *, ...);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
382 static void oscar_file_transfer_disconnect(aim_session_t *,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
383 aim_conn_t *);
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
384 static void oscar_file_transfer_cancel(struct gaim_connection *,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
385 struct file_transfer *);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
386 static int oscar_sendfile_request(aim_session_t *sess,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
387 struct oscar_file_transfer *oft);
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
388 static int oscar_sendfile_timeout(aim_session_t *sess, aim_frame_t *fr, ...);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
389
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
390 static fu32_t check_encoding(const char *utf8);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
391 static fu32_t parse_encoding(const char *enc);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
392
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 static char *msgerrreason[] = {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
394 N_("Invalid error"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
395 N_("Invalid SNAC"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
396 N_("Rate to host"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
397 N_("Rate to client"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
398 N_("Not logged in"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
399 N_("Service unavailable"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
400 N_("Service not defined"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
401 N_("Obsolete SNAC"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
402 N_("Not supported by host"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
403 N_("Not supported by client"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
404 N_("Refused by client"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
405 N_("Reply too big"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
406 N_("Responses lost"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
407 N_("Request denied"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
408 N_("Busted SNAC payload"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
409 N_("Insufficient rights"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
410 N_("In local permit/deny"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
411 N_("Too evil (sender)"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
412 N_("Too evil (receiver)"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
413 N_("User temporarily unavailable"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
414 N_("No match"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
415 N_("List overflow"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
416 N_("Request ambiguous"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
417 N_("Queue full"),
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
418 N_("Not while on AOL")
2086
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 static int msgerrreasonlen = 25;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
422 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
423 * This is called to clean up whenever a file transfer is no longer in progress,
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
424 * whether because it finished sucessfully, it was canceled, or there was an error.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
425 */
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
426 static void oscar_file_transfer_disconnect(aim_session_t *sess, aim_conn_t *conn) {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
427 struct gaim_connection *gc = sess->aux_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
428 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
429 struct oscar_file_transfer *oft = find_oft_by_conn(gc,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
430 conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
431
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
432 od->file_transfers = g_slist_remove(od->file_transfers, oft);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
433
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
434 if (oft->watcher) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
435 gaim_input_remove(oft->watcher);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
436 oft->watcher = 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
437 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
438
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
439 aim_conn_kill(sess, &conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
440
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
441 g_free(oft->sn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
442 g_free(oft);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
443 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
444
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
445 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
446 struct gaim_connection *gc = sess->aux_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
447 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
448 struct conversation *cnv;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
449 struct direct_im *dim;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
450 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
451 char buf[256];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
452
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
453 sn = g_strdup(aim_directim_getsn(conn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
454
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
455 debug_printf("%s disconnected Direct IM.\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
456
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
457 dim = find_direct_im(od, sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
458 od->direct_ims = g_slist_remove(od->direct_ims, dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
459 gaim_input_remove(dim->watcher);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
460
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
461 if (dim->connected)
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
462 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
463 else
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
464 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
465
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
466 if ((cnv = find_conversation(sn)))
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
467 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
468 update_progress(cnv, 100);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
469
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
470 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
471 g_free(sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
472
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
473 return;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
474 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
475
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476 static void oscar_callback(gpointer data, gint source,
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
477 GaimInputCondition condition) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
478 aim_conn_t *conn = (aim_conn_t *)data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
479 aim_session_t *sess = aim_conn_getsess(conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
480 struct gaim_connection *gc = sess ? sess->aux_data : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481 struct oscar_data *odata;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483 if (!gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484 /* gc is null. we return, else we seg SIGSEG on next line. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
485 debug_printf("oscar callback for closed connection (1).\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
487 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
488
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
491 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492 /* oh boy. this is probably bad. i guess the only thing we
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 * can really do is return? */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494 debug_printf("oscar callback for closed connection (2).\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
498 if (condition & GAIM_INPUT_READ) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
499 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500 debug_printf("got information on rendezvous\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501 if (aim_handlerendconnect(odata->sess, conn) < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502 debug_printf(_("connection error (rend)\n"));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
503 aim_conn_kill(odata->sess, &conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 if (aim_get_command(odata->sess, conn) >= 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 aim_rxdispatch(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 if (odata->killme)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511 if ((conn->type == AIM_CONN_TYPE_BOS) ||
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 debug_printf(_("major connection error\n"));
3074
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3068
diff changeset
514 hide_login_progress_error(gc, _("Disconnected."));
2086
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 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519 debug_printf("disconnected from chat room %s\n", c->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520 c->conn = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 if (c->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
522 gaim_input_remove(c->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
523 c->inpa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524 c->fd = -1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 aim_conn_kill(odata->sess, &conn);
3574
2b43124e8475 [gaim-migrate @ 3673]
Luke Schierer <lschiere@pidgin.im>
parents: 3572
diff changeset
526 snprintf(buf, sizeof(buf), _("You have been disconnected from chat room %s."), c->name);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
527 do_error_dialog(buf, NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529 if (odata->cnpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
530 gaim_input_remove(odata->cnpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 odata->cnpa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 debug_printf("removing chatnav input watcher\n");
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
533 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
534 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
535 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
536 odata->create_rooms =
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
537 g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
538 g_free(cr);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
539 do_error_dialog(_("Chat is currently unavailable"), NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 if (odata->paspa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
544 gaim_input_remove(odata->paspa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545 odata->paspa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546 debug_printf("removing authconn input watcher\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547 aim_conn_kill(odata->sess, &conn);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
548 } else if (conn->type == AIM_CONN_TYPE_EMAIL) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
549 if (odata->emlpa > 0)
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
550 gaim_input_remove(odata->emlpa);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
551 odata->emlpa = 0;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
552 debug_printf("removing email input watcher\n");
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
553 aim_conn_kill(odata->sess, &conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
555 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
556 gaim_directim_disconnect(odata->sess, conn);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
557 else if (conn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
558 struct oscar_file_transfer *oft = find_oft_by_conn(gc, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
559 if (oft) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
560 transfer_abort(oft->xfer, _("Buddy canceled transfer"));
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
561 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
562 oscar_file_transfer_disconnect(odata->sess, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
563 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
564 else {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
565 debug_printf("No handler for rendezvous disconnect (%d).\n",
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
566 source);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
567 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569 } else {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
570 debug_printf("holy crap! generic connection error! %hu\n",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
571 conn->type);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572 aim_conn_kill(odata->sess, &conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
573 }
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 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
577 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
579 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
580 char *s = g_strdup_vprintf(format, va);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 char buf[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 char *t;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586 t = g_strconcat(buf, s, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587 debug_printf(t);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 if (t[strlen(t)-1] != '\n')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 debug_printf("\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590 g_free(t);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 g_free(s);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
594 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
2086
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 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
598 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
599 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
603 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 hide_login_progress(gc, _("Couldn't connect to host"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616 aim_conn_completeconnect(sess, conn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
617 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 oscar_callback, conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 debug_printf(_("Password sent, waiting for response\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622 static void oscar_login(struct aim_user *user) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
623 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
624 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 char buf[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 struct gaim_connection *gc = new_gaim_conn(user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 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
628
2589
4e149a0b9665 [gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2507
diff changeset
629 if (isdigit(*user->username)) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
630 odata->icq = TRUE;
2589
4e149a0b9665 [gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2507
diff changeset
631 /* 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
632 gc->protocol = PROTO_ICQ;
3064
f0aaea918717 [gaim-migrate @ 3078]
Sean Egan <seanegan@gmail.com>
parents: 3063
diff changeset
633 gc->password[8] = 0;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
634 } else {
2590
2dd86a1af92b [gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2589
diff changeset
635 gc->protocol = PROTO_TOC;
2918
4df759d607f3 [gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2916
diff changeset
636 gc->flags |= OPT_CONN_HTML;
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
637 gc->flags |= OPT_CONN_AUTO_RESP;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
638 }
3600
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
639 odata->supports_tn = g_hash_table_new(g_str_hash, g_str_equal);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
641 sess = g_new0(aim_session_t, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 aim_setdebuggingcb(sess, oscar_debug);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 /* 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
647 * see if things need to be sent. */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 odata->sess = sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 sess->aux_data = gc;
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 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653 if (conn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 debug_printf(_("internal connection error\n"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655 hide_login_progress(gc, _("Unable to login to AIM"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 set_login_progress(gc, 2, buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666 conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671 oscar_login_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 if (conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 hide_login_progress(gc, _("Couldn't connect to host"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
675 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677 aim_request_login(sess, conn, gc->username);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
679
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
680 static void oscar_close(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
681 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
683 while (odata->oscar_chats) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
684 struct chat_connection *n = odata->oscar_chats->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685 if (n->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
686 gaim_input_remove(n->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
687 g_free(n->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
688 g_free(n->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
689 odata->oscar_chats = g_slist_remove(odata->oscar_chats, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
690 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
691 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692 while (odata->direct_ims) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693 struct direct_im *n = odata->direct_ims->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
694 if (n->watcher > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
695 gaim_input_remove(n->watcher);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
696 odata->direct_ims = g_slist_remove(odata->direct_ims, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
699 while (odata->file_transfers) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
700 struct oscar_file_transfer *n = odata->file_transfers->data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
701 if (n->watcher > 0)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
702 gaim_input_remove(n->watcher);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
703 odata->file_transfers = g_slist_remove(odata->file_transfers, n);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
704 g_free(n);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
705 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
706 while (odata->hasicons) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
707 struct icon_req *n = odata->hasicons->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 g_free(n->user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
709 odata->hasicons = g_slist_remove(odata->hasicons, n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
710 g_free(n);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
711 }
3600
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
712 g_hash_table_destroy(odata->supports_tn);
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
713 while (odata->evilhack) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
714 g_free(odata->evilhack->data);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
715 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
716 }
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
717 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
718 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
719 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
720 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
721 g_free(cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
722 }
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
723 if (odata->email)
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
724 g_free(odata->email);
2754
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
725 if (odata->newp)
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
726 g_free(odata->newp);
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
727 if (odata->oldp)
642413968b03 [gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2742
diff changeset
728 g_free(odata->oldp);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
729 if (gc->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
730 gaim_input_remove(gc->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
731 if (odata->cnpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
732 gaim_input_remove(odata->cnpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733 if (odata->paspa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
734 gaim_input_remove(odata->paspa);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
735 if (odata->emlpa > 0)
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
736 gaim_input_remove(odata->emlpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
737 aim_session_kill(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
738 g_free(odata->sess);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739 odata->sess = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
740 g_free(gc->proto_data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
741 gc->proto_data = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
742 debug_printf(_("Signed off.\n"));
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
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
745 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
748 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
749 aim_conn_t *bosconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
752 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
754 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
756 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
757 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758 bosconn = odata->conn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
759
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761 hide_login_progress(gc, _("Could Not Connect"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
765
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 aim_conn_completeconnect(sess, bosconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
767 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 oscar_callback, bosconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 set_login_progress(gc, 4, _("Connection established, cookie sent"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
770 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
771
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
772 static void oscar_ask_send_file(struct gaim_connection *gc, char *destsn) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
773 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
774
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
775 struct oscar_file_transfer *oft = g_new0(struct oscar_file_transfer,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
776 1);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
777
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
778 oft->type = OFT_SENDFILE_OUT;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
779 oft->sn = g_strdup(destsn);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
780
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
781 od->file_transfers = g_slist_append(od->file_transfers, oft);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
782
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
783 oft->xfer = transfer_out_add(gc, oft->sn);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
784 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
785
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
786 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
787 va_list ap;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
788 struct aim_authresp_info *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
789 int i; char *host; int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
790 struct aim_user *user;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
791 aim_conn_t *bosconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
792
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
793 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
794 struct oscar_data *od = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795 user = gc->user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
796 port = user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
797 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
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 va_start(ap, fr);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
800 info = va_arg(ap, struct aim_authresp_info *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
801 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
803 debug_printf("inside auth_resp (Screen name: %s)\n", info->sn);
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
804
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
805 if (info->errorcode || !info->bosip || !info->cookie) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
806 char buf[256];
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
807 switch (info->errorcode) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
808 case 0x05:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809 /* Incorrect nick/password */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810 hide_login_progress(gc, _("Incorrect nickname or password."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811 plugin_event(event_error, (void *)980, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
812 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
813 case 0x11:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
814 /* Suspended account */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
815 hide_login_progress(gc, _("Your account is currently suspended."));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
816 break;
3498
5a4569cea6be [gaim-migrate @ 3561]
Mark Doliner <mark@kingant.net>
parents: 3490
diff changeset
817 case 0x14:
5a4569cea6be [gaim-migrate @ 3561]
Mark Doliner <mark@kingant.net>
parents: 3490
diff changeset
818 /* service temporarily unavailable */
5a4569cea6be [gaim-migrate @ 3561]
Mark Doliner <mark@kingant.net>
parents: 3490
diff changeset
819 hide_login_progress(gc, _("The AOL Instant Messenger service is temporarily unavailable."));
5a4569cea6be [gaim-migrate @ 3561]
Mark Doliner <mark@kingant.net>
parents: 3490
diff changeset
820 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
821 case 0x18:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
822 /* connecting too frequently */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
823 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
824 plugin_event(event_error, (void *)983, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
825 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
826 case 0x1c:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
827 /* client too old */
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
828 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), WEBSITE);
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
829 hide_login_progress(gc, buf);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
830 plugin_event(event_error, (void *)989, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
831 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
832 default:
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
833 hide_login_progress(gc, _("Authentication Failed"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
834 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
835 }
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
836 debug_printf("Login Error Code 0x%04hx\n", info->errorcode);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
837 debug_printf("Error URL: %s\n", info->errorurl);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
838 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
839 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
840 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
841
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
842
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
843 debug_printf("Reg status: %hu\n", info->regstatus);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
844 if (info->email) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
845 debug_printf("Email: %s\n", info->email);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
846 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
847 debug_printf("Email is NULL\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
848 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
849 debug_printf("BOSIP: %s\n", info->bosip);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
850 debug_printf("Closing auth connection...\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
851 aim_conn_kill(sess, &fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
852
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
853 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
854 if (bosconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
855 hide_login_progress(gc, _("Internal Error"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
856 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
857 return 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
858 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
859
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
860 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
861 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
862 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
863 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
864 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
865 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
866 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
867 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
868 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
869 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
870 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
871 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
872 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
873 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
874 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
875 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
876 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
877 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878 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
879 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
880 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
881 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
882 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
883 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
884 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
885 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0);
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
886 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0);
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
887 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
888 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
889 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
890 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_SIMPLEINFO, gaim_icqsimpleinfo, 0);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
891 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALLINFO, gaim_icqallinfo, 0);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
892 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
893 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
894 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0);
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
895 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_MSGTIMEOUT, oscar_sendfile_timeout, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
896
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
897 ((struct oscar_data *)gc->proto_data)->conn = bosconn;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
898 for (i = 0; i < (int)strlen(info->bosip); i++) {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
899 if (info->bosip[i] == ':') {
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
900 port = atoi(&(info->bosip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
901 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
902 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
903 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
904 host = g_strndup(info->bosip, i);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
905 bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
906 bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
907 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
908 if (bosconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
909 hide_login_progress(gc, _("Could Not Connect"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
910 od->killme = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
911 return 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
912 }
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
913 aim_sendcookie(sess, bosconn, info->cookie);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
914 gaim_input_remove(gc->inpa);
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
915
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
916 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
917 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
918
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
919 struct pieceofcrap {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
920 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
921 unsigned long offset;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
922 unsigned long len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
923 char *modname;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
924 int fd;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
925 aim_conn_t *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
926 unsigned int inpa;
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
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
929 static void damn_you(gpointer data, gint source, GaimInputCondition c)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
930 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
931 struct pieceofcrap *pos = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
932 struct oscar_data *od = pos->gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
933 char in = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
934 int x = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
935 unsigned char m[17];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
936
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
937 while (read(pos->fd, &in, 1) == 1) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
938 if (in == '\n')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
939 x++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
940 else if (in != '\r')
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
941 x = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
942 if (x == 2)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
943 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
944 in = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
945 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
946 if (in != '\n') {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
947 char buf[256];
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
948 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until "
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
949 "this is fixed. Check %s for updates."), WEBSITE);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
950 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."),
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
951 buf, GAIM_WARNING);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
952 gaim_input_remove(pos->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
953 close(pos->fd);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
954 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
955 return;
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 read(pos->fd, m, 16);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
958 m[16] = '\0';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
959 debug_printf("Sending hash: ");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
960 for (x = 0; x < 16; x++)
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
961 debug_printf("%02hhx ", (unsigned char)m[x]);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
962 debug_printf("\n");
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
963 gaim_input_remove(pos->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
964 close(pos->fd);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
965 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
966 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
967 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
968
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
969 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
970 struct pieceofcrap *pos = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
971 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
972
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
973 if (source < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
974 char buf[256];
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
975 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until "
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
976 "this is fixed. Check %s for updates."), WEBSITE);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
977 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."),
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
978 buf, GAIM_WARNING);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
979 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
980 g_free(pos->modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
981 g_free(pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
982 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
983 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
984
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
985 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
986 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
987 pos->offset, pos->len, pos->modname ? pos->modname : "");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
988 write(pos->fd, buf, strlen(buf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
989 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
990 g_free(pos->modname);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
991 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
992 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
993 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
994
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
995 /* size of icbmui.ocm, the largest module in AIM 3.5 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
996 #define AIM_MAX_FILE_SIZE 98304
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
997
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
998 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
999 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1000 struct pieceofcrap *pos;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1001 fu32_t offset, len;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1002 char *modname;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1003 int fd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1004
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1005 va_start(ap, fr);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
1006 offset = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
1007 len = va_arg(ap, fu32_t);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1008 modname = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1009 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1010
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1011 debug_printf("offset: %lu, len: %lu, file: %s\n", offset, len, (modname ? modname : "aim.exe"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1012 if (len == 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1013 debug_printf("len is 0, hashing NULL\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1014 aim_sendmemblock(sess, fr->conn, offset, len, NULL,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1015 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1016 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1017 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1018 /* 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
1019 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1020 char *buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1021 int i = 8;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1022 if (modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1023 i += strlen(modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1024 buf = g_malloc(i);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1025 i = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1026 if (modname) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1027 memcpy(buf, modname, strlen(modname));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1028 i += strlen(modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1029 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1030 buf[i++] = offset & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1031 buf[i++] = (offset >> 8) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1032 buf[i++] = (offset >> 16) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1033 buf[i++] = (offset >> 24) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1034 buf[i++] = len & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1035 buf[i++] = (len >> 8) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1036 buf[i++] = (len >> 16) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1037 buf[i++] = (len >> 24) & 0xff;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1038 debug_printf("len + offset is invalid, hashing request\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1039 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1040 g_free(buf);
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 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1043 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1044
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1045 pos = g_new0(struct pieceofcrap, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1046 pos->gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1047 pos->conn = fr->conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1048
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1049 pos->offset = offset;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1050 pos->len = len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1051 pos->modname = modname ? g_strdup(modname) : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1052
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1053 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1054 if (fd < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
1055 char buf[256];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1056 if (pos->modname)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1057 g_free(pos->modname);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1058 g_free(pos);
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
1059 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until "
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
1060 "this is fixed. Check %s for updates."), WEBSITE);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
1061 do_error_dialog(_("Gaim was Unable to get valid login hash."),
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
1062 buf, GAIM_WARNING);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1063 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1064 pos->fd = fd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1065
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1066 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1067 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1068
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1069 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
1070 char *key;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1071 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1072 struct gaim_connection *gc = sess->aux_data;
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1073 struct oscar_data *odata = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1074
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1075 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1076 key = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1077 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1078
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1079 if (odata->icq) {
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1080 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1081 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1082 } else {
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1083 #if 0
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1084 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1085 #endif
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1086 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1087 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1088 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1089
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1090 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1091 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1092
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1093 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
1094 struct gaim_connection *gc = sess->aux_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1095 struct chat_connection *chatcon;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1096 static int id = 1;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1097
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1098 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
1099 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
1100 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
1101 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
1102 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
1103
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
1104 aim_clientready(sess, fr->conn);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1105
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1106 chatcon = find_oscar_chat_by_conn(gc, fr->conn);
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1107 chatcon->id = id;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1108 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show);
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1109
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1110 return 1;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1111 }
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
1112
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1113 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
1114
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1115 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
1116 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
1117
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1118 aim_clientready(sess, fr->conn);
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1119
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1120 aim_chatnav_reqrights(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1121
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1122 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1123 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1124
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1125 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1126
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1127 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1128 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1129
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1130 aim_email_sendcookies(sess, fr->conn);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1131 aim_email_activate(sess, fr->conn);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1132 aim_clientready(sess, fr->conn);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1133
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1134 return 1;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1135 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1136
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1137 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1138 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1139 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1140 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1141 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1142
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1143 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1144 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1145 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1146 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1147
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1148 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1149 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1150 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1151
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1152 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1153 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1154 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1155 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1156 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1157
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1158 aim_conn_completeconnect(sess, tstconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1159 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1160 oscar_callback, tstconn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1161 debug_printf("chatnav: connected\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1162 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1163
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1164 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1165 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1166 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1167 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1168 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1169 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1170
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1171 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1172 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1173 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1174 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1175
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1176 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1177 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1178 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
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 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1181 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1182 debug_printf("unable to connect to authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1183 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1184 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1185
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1186 aim_conn_completeconnect(sess, tstconn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1187 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1188 oscar_callback, tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1189 debug_printf("chatnav: connected\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1190 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1191
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1192 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
2086
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 struct chat_connection *ccon = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1195 struct gaim_connection *gc = ccon->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1196 struct oscar_data *odata;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1197 aim_session_t *sess;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1198 aim_conn_t *tstconn;
2086
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 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1201 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1202 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1203 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1204 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1205 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1206 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1207
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1208 odata = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1209 sess = odata->sess;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1210 tstconn = ccon->conn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1211
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1212 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1213 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1214 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1215 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1216 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1217 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1218 }
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 aim_conn_completeconnect(sess, ccon->conn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1221 ccon->inpa = gaim_input_add(tstconn->fd,
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1222 GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1223 oscar_callback, tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1224 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1225 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1226
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1227 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1228 struct gaim_connection *gc = data;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1229 struct oscar_data *odata;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1230 aim_session_t *sess;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1231 aim_conn_t *tstconn;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1232
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1233 if (!g_slist_find(connections, gc)) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1234 close(source);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1235 return;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1236 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1237
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1238 odata = gc->proto_data;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1239 sess = odata->sess;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1240 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1241
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1242 if (source < 0) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1243 aim_conn_kill(sess, &tstconn);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1244 debug_printf("unable to connect to email server\n");
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1245 return;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1246 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1247
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1248 aim_conn_completeconnect(sess, tstconn);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1249 odata->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1250 debug_printf("email: connected\n");
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1251 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1252
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1253 /* 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
1254 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
1255 va_list ap;
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1256 struct aim_redirect_data *redir;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1257 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1258 struct aim_user *user = gc->user;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1259 aim_conn_t *tstconn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1260 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1261 char *host;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1262 int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1263
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1264 port = user->proto_opt[USEROPT_AUTHPORT][0] ?
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1265 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1266
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1267 va_start(ap, fr);
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1268 redir = va_arg(ap, struct aim_redirect_data *);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1269 va_end(ap);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1270
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1271 for (i = 0; i < (int)strlen(redir->ip); i++) {
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1272 if (redir->ip[i] == ':') {
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1273 port = atoi(&(redir->ip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1274 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1275 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1276 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1277 host = g_strndup(redir->ip, i);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1278
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1279 switch(redir->group) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1280 case 0x7: /* Authorizer */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1281 debug_printf("Reconnecting with authorizor...\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1282 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1283 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1284 debug_printf("unable to reconnect with authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1285 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1286 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1287 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1288 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
1289 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1290 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1291 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1292
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1293 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1294 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1295 if (tstconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1296 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1297 debug_printf("unable to reconnect with authorizer\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1298 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1299 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1300 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1301 aim_sendcookie(sess, tstconn, redir->cookie);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1302 break;
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1303
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1304 case 0xd: /* ChatNav */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1305 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1306 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1307 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1308 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1309 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1310 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1311 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
1312
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1313 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1314 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1315 if (tstconn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1316 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1317 debug_printf("unable to connect to chatnav server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1318 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1319 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1320 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1321 aim_sendcookie(sess, tstconn, redir->cookie);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1322 break;
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1323
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1324 case 0xe: { /* Chat */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1325 struct chat_connection *ccon;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1326
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1327 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1328 if (tstconn == NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1329 debug_printf("unable to connect to chat server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1330 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1331 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1332 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1333
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
1334 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
1335
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1336 ccon = g_new0(struct chat_connection, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1337 ccon->conn = tstconn;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1338 ccon->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1339 ccon->fd = -1;
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1340 ccon->name = g_strdup(redir->chat.room);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1341 ccon->exchange = redir->chat.exchange;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1342 ccon->instance = redir->chat.instance;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1343 ccon->show = extract_name(redir->chat.room);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1344
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1345 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1346 ccon->conn->fd = proxy_connect(host, port, oscar_chat_connect, ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1347 if (ccon->conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1348 aim_conn_kill(sess, &tstconn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1349 debug_printf("unable to connect to chat server\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1350 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1351 g_free(ccon->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1352 g_free(ccon->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1353 g_free(ccon);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1354 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1355 }
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1356 aim_sendcookie(sess, tstconn, redir->cookie);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1357 debug_printf("Connected to chat room %s exchange %hu\n", ccon->name, ccon->exchange);
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1358 } break;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1359
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1360 case 0x0018: { /* email */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1361 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1362 debug_printf("unable to connect to email server\n");
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1363 g_free(host);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1364 return 1;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1365 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1366 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1367
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1368 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1369 tstconn->fd = proxy_connect(host, port, oscar_email_connect, gc);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1370 if (tstconn->fd < 0) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1371 aim_conn_kill(sess, &tstconn);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1372 debug_printf("unable to connect to email server\n");
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1373 g_free(host);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1374 return 1;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1375 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1376 aim_sendcookie(sess, tstconn, redir->cookie);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1377 } break;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
1378
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1379 default: /* huh? */
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1380 debug_printf("got redirect for unknown service 0x%04hx\n", redir->group);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1381 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1382 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1383
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1384 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1385 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1386 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1387
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1388 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
1389 struct gaim_connection *gc = sess->aux_data;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1390 struct oscar_data *od = gc->proto_data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1391 aim_userinfo_t *info;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1392 time_t time_idle = 0, signon = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1393 int type = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1394 int caps = 0;
2305
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1395 char *tmp;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1396 va_list ap;
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1397
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1398 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1399 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1400 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1401
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1402 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1403 caps = info->capabilities;
3267
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1404 if (info->flags & AIM_FLAG_ACTIVEBUDDY)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1405 type |= UC_AB;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1406
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1407 if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) {
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1408 if (info->flags & AIM_FLAG_UNCONFIRMED)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1409 type |= UC_UNCONFIRMED;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1410 if (info->flags & AIM_FLAG_ADMINISTRATOR)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1411 type |= UC_ADMIN;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1412 if (info->flags & AIM_FLAG_AOL)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1413 type |= UC_AOL;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1414 if (info->flags & AIM_FLAG_FREE)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1415 type |= UC_NORMAL;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1416 if (info->flags & AIM_FLAG_AWAY)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1417 type |= UC_UNAVAILABLE;
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1418 if (info->flags & AIM_FLAG_WIRELESS)
5947e31a01c0 [gaim-migrate @ 3285]
Sean Egan <seanegan@gmail.com>
parents: 3214
diff changeset
1419 type |= UC_WIRELESS;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
1420 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1421 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
1422 type = (info->icqinfo.status << 16);
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3009
diff changeset
1423 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) &&
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3009
diff changeset
1424 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1425 type |= UC_UNAVAILABLE;
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3009
diff changeset
1426 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1427 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1428
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1429 if (caps & AIM_CAPS_ICQ)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1430 caps ^= AIM_CAPS_ICQ;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1431
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1432 if (info->present & AIM_USERINFO_PRESENT_IDLE) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1433 time(&time_idle);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1434 time_idle -= info->idletime*60;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1435 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1436
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1437 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1438 signon = time(NULL) - info->sessionlen;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1439
2305
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1440 tmp = g_strdup(normalize(gc->username));
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1441 if (!strcmp(tmp, normalize(info->sn)))
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1442 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1443 g_free(tmp);
0371b905baef [gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1444
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1445 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
1446 time_idle, type, caps);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1447
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1448 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1449 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1450
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1451 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
1452 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1453 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1454 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1455
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1456 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1457 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1458 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1459
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1460 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1461
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1462 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1463 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1464
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
1465 static void cancel_direct_im(struct ask_direct *d) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1466 debug_printf("Freeing DirectIM prompts.\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1467
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1468 g_free(d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1469 g_free(d);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1470 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1471
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1472 static void oscar_directim_callback(gpointer data, gint source, GaimInputCondition condition) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1473 struct direct_im *dim = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1474 struct gaim_connection *gc = dim->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1475 struct oscar_data *od = gc->proto_data;
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
1476 struct conversation *cnv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1477 char buf[256];
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1478 struct sockaddr name;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1479 socklen_t name_len = 1;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1480
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1481 if (!g_slist_find(connections, gc)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1482 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1483 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1484 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1485
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1486 if (source < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1487 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1488 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1489 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1490
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1491 if (dim->conn->fd != source)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1492 dim->conn->fd = source;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1493 aim_conn_completeconnect(od->sess, dim->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1494 if (!(cnv = find_conversation(dim->name)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1495 cnv = new_conversation(dim->name);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1496
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1497 /* This is the best way to see if we're connected or not */
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1498 if (getpeername(source, &name, &name_len) == 0) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1499 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1500 dim->connected = TRUE;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1501 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1502 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1503 od->direct_ims = g_slist_append(od->direct_ims, dim);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1504
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1505 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1506 oscar_callback, dim->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1507 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1508
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1509 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1510 * This is called every time we are finished sending a file and the receiving buddy
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1511 * has sent back an acknowledgement; we start the next file or tear down the
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1512 * connection as appropriate.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1513 */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1514 static int oscar_sendfile_out_done(aim_session_t *sess, aim_frame_t *fr, ...) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1515 struct gaim_connection *gc = sess->aux_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1516 va_list ap;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1517 aim_conn_t *conn;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1518 const char *cook;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1519 struct oscar_file_transfer *oft;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1520
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1521 va_start(ap, fr);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1522 conn = va_arg(ap, aim_conn_t *);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1523 cook = va_arg(ap, const char *);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1524 va_end(ap);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1525
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1526 oft = find_oft_by_cookie(gc, cook);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1527 if (oft->filesdone == oft->totfiles)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1528 oscar_file_transfer_disconnect(sess, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1529 else
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1530 /* Send header for next file */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1531 oscar_sendfile_request(sess, oft);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1532
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1533 return 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1534 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1535
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1536 /* Called once for each file before sending the raw data. */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1537 static int oscar_sendfile_request(aim_session_t *sess,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1538 struct oscar_file_transfer *oft) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1539 char *name;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1540 int size;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1541
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1542 transfer_get_file_info(oft->xfer, &size, &name);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1543 /* AAA convert the name to UCS-2 if necessary, and pass the encoding to the call below */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1544 aim_oft_sendfile_request(sess, oft->conn, name, oft->filesdone,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1545 oft->totfiles, size, oft->totsize);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1546
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1547 return 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1548 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1549
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1550 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1551 * This is called when sending a file and a direct connection has been set up with
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1552 * the buddy; we can now transmit the appropriate headers describing the transfer.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1553 */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1554 static int oscar_sendfile_accepted(aim_session_t *sess, aim_frame_t *fr, ...) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1555 struct gaim_connection *gc = sess->aux_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1556 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1557 struct oscar_file_transfer *oft;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1558 va_list ap;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1559 aim_conn_t *conn, *listenerconn;
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1560
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1561 va_start(ap, fr);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1562 conn = va_arg(ap, aim_conn_t *);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1563 listenerconn = va_arg(ap, aim_conn_t *);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1564 va_end(ap);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1565
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1566 oft = find_oft_by_conn(gc, listenerconn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1567 oft->conn = conn;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1568 /* Stop watching listener conn; watch transfer conn instead */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1569 gaim_input_remove(oft->watcher);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1570 aim_conn_kill(sess, &listenerconn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1571
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1572 aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT,
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1573 AIM_CB_OFT_SENDFILEFILESEND,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1574 oscar_file_transfer_do,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1575 0);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1576 aim_conn_addhandler(sess, conn,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1577 AIM_CB_FAM_OFT,
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1578 AIM_CB_OFT_SENDFILECOMPLETE,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1579 oscar_sendfile_out_done,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1580 0);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1581 oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1582 oscar_callback, oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1583
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1584 oscar_sendfile_request(sess, oft);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1585
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1586 return 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1587 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1588
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1589 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1590 * This is called when we requested to send a file to a buddy, but he or she didn't
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1591 * respond; we need to clean up.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1592 */
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1593 static int oscar_sendfile_timeout(aim_session_t *sess, aim_frame_t *fr, ...) {
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1594 struct gaim_connection *gc = sess->aux_data;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1595 va_list ap;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1596 struct oscar_file_transfer *oft;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1597 char *cookie;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1598 aim_conn_t *bosconn;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1599
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1600 va_start(ap, fr);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1601 bosconn = va_arg(ap, aim_conn_t *);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1602 cookie = va_arg(ap, char *);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1603 va_end(ap);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1604
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1605 if ((oft = find_oft_by_cookie(gc, cookie))) {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1606 aim_canceltransfer(sess, bosconn, oft->cookie,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1607 oft->sn, AIM_CAPS_SENDFILE);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1608
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1609 transfer_abort(oft->xfer, _("Transfer timed out"));
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1610 oscar_file_transfer_disconnect(sess, oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1611 }
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1612
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1613 return 1; /* success */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1614 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1615
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1616 /* Called once at the beginning of an outgoing transfer session. */
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1617 static void oscar_file_transfer_out(struct gaim_connection *gc,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1618 struct file_transfer *xfer, const char *name, int totfiles,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1619 int totsize) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1620 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1621 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1622
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1623 oft->xfer = xfer;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1624 oft->totsize = totsize;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1625 oft->totfiles = totfiles;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1626 oft->filesdone = 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1627
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1628 oft->conn = aim_sendfile_initiate(od->sess, oft->sn,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1629 name, totfiles, oft->totsize, oft->cookie);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1630 if (!oft->conn) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1631 do_error_dialog(_("Couldn't open listener to send file"),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1632 _("File transfer aborted"),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1633 GAIM_ERROR);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1634 return;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1635 }
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1636
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1637 aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT,
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1638 AIM_CB_OFT_SENDFILEINITIATE,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1639 oscar_sendfile_accepted,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1640 0);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1641 oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1642 oscar_callback, oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1643 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1644
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1645 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1646 * This is called after a chunk of data has been sent out or received; it is used
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1647 * to update the checksum.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1648 */
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1649 static void oscar_file_transfer_data_chunk(struct gaim_connection *gc,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1650 struct file_transfer *xfer, const char *buf, int len)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1651 {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1652 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1653 aim_session_t *sess = aim_conn_getsess(oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1654
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1655 if (oft->type == OFT_SENDFILE_IN)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1656 aim_update_checksum(sess, oft->conn, buf, len);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1657 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1658
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1659 /* Called once at the beginning of an incoming transfer session. */
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1660 static void oscar_file_transfer_in(struct gaim_connection *gc,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1661 struct file_transfer *xfer, int offset) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1662 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1663 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1664
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1665 oft->xfer = xfer;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1666 oft->conn = aim_accepttransfer(od->sess, od->conn, oft->sn,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1667 oft->cookie, oft->ip,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1668 oft->port,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1669 AIM_CAPS_SENDFILE);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1670 if (!oft->conn) {
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1671 /* XXX implement reverse connections for receiving from behind a firewall */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1672 char *buf = g_strdup_printf("Couldn't connect to remote host");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1673 do_error_dialog(buf, NULL, GAIM_ERROR);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1674 g_free(buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1675 return;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1676 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1677
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1678 aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT,
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1679 AIM_CB_OFT_SENDFILEFILEREQ, oscar_file_transfer_do,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1680 0);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1681
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1682 oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1683 oscar_callback, oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1684 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1685
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1686 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1687 * This is called when the user began a file transfer, but subsequently canceled.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1688 */
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1689 static void oscar_file_transfer_cancel(struct gaim_connection *gc, struct file_transfer *xfer) {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1690 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1691 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1692
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1693 if (oft->type == OFT_SENDFILE_IN)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1694 aim_denytransfer(od->sess, oft->sn, oft->cookie,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1695 AIM_TRANSFER_DENY_DECLINE);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1696
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1697 od->file_transfers = g_slist_remove(od->file_transfers, oft);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1698 aim_conn_kill(od->sess, &oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1699 g_free(oft->sn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1700 g_free(oft);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1701 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1702
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
1703 static int accept_direct_im(struct ask_direct *d) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1704 struct gaim_connection *gc = d->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1705 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1706 struct direct_im *dim;
2945
6a26e125b623 [gaim-migrate @ 2958]
Rob Flynn <gaim@robflynn.com>
parents: 2943
diff changeset
1707 char *host; int port = 4443;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1708 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1709
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1710 debug_printf("Accepted DirectIM.\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1711
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1712 dim = find_direct_im(od, d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1713 if (dim) {
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
1714 cancel_direct_im(d); /* 40 */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1715 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1716 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1717 dim = g_new0(struct direct_im, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1718 dim->gc = d->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1719 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1720
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1721 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
1722 if (!dim->conn) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1723 g_free(dim);
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
1724 cancel_direct_im(d);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1725 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1726 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1727
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1728 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
1729 gaim_directim_incoming, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1730 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
1731 gaim_directim_typing, 0);
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3031
diff changeset
1732 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER,
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
1733 gaim_update_ui, 0);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1734 for (i = 0; i < (int)strlen(d->ip); i++) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1735 if (d->ip[i] == ':') {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1736 port = atoi(&(d->ip[i+1]));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1737 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1738 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1739 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1740 host = g_strndup(d->ip, i);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1741 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1742 dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1743 g_free(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1744 if (dim->conn->fd < 0) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1745 aim_conn_kill(od->sess, &dim->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1746 g_free(dim);
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
1747 cancel_direct_im(d);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1748 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1749 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1750
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
1751 cancel_direct_im(d);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1752
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1753 return TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1754 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1755
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1756 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
1757 char *tmp;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1758 struct gaim_connection *gc = sess->aux_data;
3600
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
1759 struct oscar_data *od = gc->proto_data;
2273
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1760 int flags = 0;
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1761 int convlen;
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1762 GError *err = NULL;
2273
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1763
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1764 if (args->icbmflags & AIM_IMFLAGS_AWAY)
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2249
diff changeset
1765 flags |= IM_FLAG_AWAY;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1766
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1767 if (args->icbmflags & AIM_IMFLAGS_HASICON) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1768 struct icon_req *ir = NULL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1769 GSList *h = od->hasicons;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1770 char *who = normalize(userinfo->sn);
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1771
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1772 if (!args->iconlen || !args->iconsum || !args->iconstamp)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1773 return 1;
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1774
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1775 debug_printf("%s has an icon\n", userinfo->sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1776 while (h) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1777 ir = h->data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1778 if (!strcmp(ir->user, who))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1779 break;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1780 h = h->next;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1781 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1782 if (!h) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1783 ir = g_new0(struct icon_req, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1784 ir->user = g_strdup(who);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1785 od->hasicons = g_slist_append(od->hasicons, ir);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1786 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1787 if ((args->iconlen != ir->length) ||
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1788 (args->iconsum != ir->checksum) ||
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1789 (args->iconstamp != ir->timestamp))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1790 ir->request = TRUE;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1791 ir->length = args->iconlen;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1792 ir->checksum = args->iconsum;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1793 ir->timestamp = args->iconstamp;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1794 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1795
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1796 if (gc->user->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1797 FILE *file;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1798 struct stat st;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1799
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
1800 if (!stat(gc->user->iconfile, &st)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1801 char *buf = g_malloc(st.st_size);
2248
cef6d4e81aec [gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
1802 file = fopen(gc->user->iconfile, "r");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1803 if (file) {
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1804 int len = fread(buf, 1, st.st_size, file);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1805 debug_printf("Sending buddy icon to %s (%d bytes, %lu reported)\n",
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1806 userinfo->sn, len, st.st_size);
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
1807 aim_send_icon(sess, userinfo->sn, buf, st.st_size,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1808 st.st_mtime, aim_iconsum(buf, st.st_size));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1809 fclose(file);
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1810 } else
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1811 debug_printf("Can't open buddy icon file!\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1812 g_free(buf);
2336
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1813 } else
c6c5eaf69188 [gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
1814 debug_printf("Can't stat buddy icon file!\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1815 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1816
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1817 if (args->icbmflags & AIM_IMFLAGS_UNICODE) {
3722
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1818 /* This message is marked as UNICODE, so we have to
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1819 * convert it to utf-8 before handing it to the gaim core.
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1820 * This conversion should *never* fail, if it does it
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1821 * means that either the incoming ICBM is corrupted or
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1822 * there is something we don't understand about it. */
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1823 /* For the record, AIM Unicode is big-endian UCS-2 */
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1824
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1825 if (!args->msg || !args->msglen)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1826 return 1;
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1827
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1828 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1829 if (err) {
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1830 debug_printf("Unicode IM conversion: %s\n", err->message);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1831 tmp = strdup(_("(There was an error receiving this message)"));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1832 }
3722
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1833 } else {
3850
daf2cec08eac [gaim-migrate @ 4002]
Luke Schierer <lschiere@pidgin.im>
parents: 3783
diff changeset
1834 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and
3722
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1835 * unflagged messages, which are ASCII. That's OK because
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1836 * ASCII is a strict subset of ISO-8859-1; this should
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1837 * help with compatibility with old, broken versions of
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1838 * gaim (everything before 0.60) and other broken clients
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1839 * that will happily send ISO-8859-1 without marking it as
5ab55c267294 [gaim-migrate @ 3855]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1840 * such */
3850
daf2cec08eac [gaim-migrate @ 4002]
Luke Schierer <lschiere@pidgin.im>
parents: 3783
diff changeset
1841 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1842 debug_printf("Received ISO-8859-1 IM\n");
3850
daf2cec08eac [gaim-migrate @ 4002]
Luke Schierer <lschiere@pidgin.im>
parents: 3783
diff changeset
1843 }
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1844
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1845 if (!args->msg || !args->msglen)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1846 return 1;
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1847
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1848 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1849 if (err) {
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1850 debug_printf("ISO-8859-1 IM conversion: %s\n", err->message);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1851 tmp = strdup(_("(There was an error receiving this message)"));
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
1852 }
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
1853 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1854
3850
daf2cec08eac [gaim-migrate @ 4002]
Luke Schierer <lschiere@pidgin.im>
parents: 3783
diff changeset
1855 if (args->icbmflags & AIM_IMFLAGS_CUSTOMCHARSET) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1856 debug_printf("Custom character set: %hu %hu\n", args->charset, args->charsubset);
3850
daf2cec08eac [gaim-migrate @ 4002]
Luke Schierer <lschiere@pidgin.im>
parents: 3783
diff changeset
1857 }
daf2cec08eac [gaim-migrate @ 4002]
Luke Schierer <lschiere@pidgin.im>
parents: 3783
diff changeset
1858
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
1859 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) {
3600
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
1860 char *who = normalize(userinfo->sn);
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
1861 if (!g_hash_table_lookup(od->supports_tn, who))
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
1862 g_hash_table_insert(od->supports_tn, who, who);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
1863 }
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
1864
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
1865 //strip_linefeed(tmp);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
1866 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
1867 g_free(tmp);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1868
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1869 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1870 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1871
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
1872 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
1873 struct gaim_connection *gc = sess->aux_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1874
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1875 if (!args)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1876 return 0;
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1877
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1878 debug_printf("rendezvous status %hu (%s)\n", args->status, userinfo->sn);
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1879
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1880 if (args->status == AIM_RENDEZVOUS_CANCEL) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1881 struct oscar_file_transfer *oft;
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1882 if (!args->cookie)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1883 return 1;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1884 oft = find_oft_by_cookie(gc, args->cookie);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1885 if (oft) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1886 transfer_abort(oft->xfer, _("Buddy canceled transfer"));
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1887 oscar_file_transfer_disconnect(sess, oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1888 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1889 return 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1890 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1891 else if (args->status == AIM_RENDEZVOUS_ACCEPT) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1892 /* The user accepted our transfer request, but we don't
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1893 * really need to do anything yet.
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1894 * -- wtm
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1895 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1896 return 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1897 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1898 else if (args->status != AIM_RENDEZVOUS_PROPOSE) {
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1899 debug_printf("unknown rendezvous status\n");
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1900 return 1;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1901 }
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1902
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1903 if (args->reqclass & AIM_CAPS_CHAT) {
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1904 char *name;
4120
697217b52ebd [gaim-migrate @ 4337]
Rob Flynn <gaim@robflynn.com>
parents: 4111
diff changeset
1905 int *exch;
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1906 GList *m = NULL;
4120
697217b52ebd [gaim-migrate @ 4337]
Rob Flynn <gaim@robflynn.com>
parents: 4111
diff changeset
1907
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1908 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1909 return 1;
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1910 name = extract_name(args->info.chat.roominfo.name);
4120
697217b52ebd [gaim-migrate @ 4337]
Rob Flynn <gaim@robflynn.com>
parents: 4111
diff changeset
1911 exch = g_new0(int, 1);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1912 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
1913 *exch = args->info.chat.roominfo.exchange;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1914 m = g_list_append(m, exch);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1915 serv_got_chat_invite(gc,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1916 name ? name : args->info.chat.roominfo.name,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1917 userinfo->sn,
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
1918 (char *)args->msg,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1919 m);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1920 if (name)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1921 g_free(name);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
1922 } else if (args->reqclass & AIM_CAPS_SENDFILE) {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1923 struct oscar_file_transfer *oft;
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1924 struct oscar_data *od = gc->proto_data;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1925
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1926 if (!args->cookie || !args->verifiedip || !args->port ||
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1927 !args->info.sendfile.filename || !args->info.sendfile.totsize ||
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1928 !args->info.sendfile.totfiles || !args->msg || !args->reqclass)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
1929 return 1;
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1930 if ((oft = find_oft_by_cookie(sess->aux_data, args->cookie)))
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1931 {
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1932 /* This is a request for a reverse connection,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1933 * which is used by newer clients when for some
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1934 * reason they are unable to connect to our listener
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1935 * (e.g. they are behind a firewall).
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1936 */
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1937 if (oft->type != OFT_SENDFILE_OUT)
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1938 return -1;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1939
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1940 /* It seems that Trillian sends some weird
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1941 * packets. Sanity check.
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1942 */
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1943 if (!args->verifiedip)
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1944 return -1;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1945
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1946 /* This connection isn't used for anything, since
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1947 * we're using a reverse connection instead.
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1948 */
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1949 gaim_input_remove(oft->watcher);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1950 aim_conn_kill(sess, &oft->conn);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1951
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
1952 debug_printf("sendfile: doing reverse connection to %s:%hu\n", args->verifiedip, args->port);
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1953
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1954 oft->conn = aim_accepttransfer(sess, od->conn,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1955 userinfo->sn,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1956 args->cookie, args->verifiedip,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1957 args->port,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1958 AIM_CAPS_SENDFILE);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1959
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1960 /* XXX: this is a bit of a hack: ideally
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1961 * we should wait on GAIM_INPUT_WRITE. -- wtm
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1962 */
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1963 aim_conn_completeconnect(sess, oft->conn);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1964
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1965 oscar_sendfile_request(sess, oft);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1966
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1967 aim_conn_addhandler(sess, oft->conn,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1968 AIM_CB_FAM_OFT,
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1969 AIM_CB_OFT_SENDFILECOMPLETE,
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1970 oscar_sendfile_out_done,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1971 0);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1972 aim_conn_addhandler(sess, oft->conn,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1973 AIM_CB_FAM_OFT,
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
1974 AIM_CB_OFT_SENDFILEFILESEND,
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1975 oscar_file_transfer_do,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1976 0);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1977 oft->watcher = gaim_input_add(oft->conn->fd,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1978 GAIM_INPUT_READ, oscar_callback,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1979 oft->conn);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1980 return 0;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1981 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1982
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
1983 /* Someone wants to send a file (or files) to us */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1984 debug_printf("%s (%s) requests to send a file to %s\n",
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1985 userinfo->sn, args->verifiedip, gc->username);
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1986
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1987 oft = g_new0(struct oscar_file_transfer, 1);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1988
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1989 oft->type = OFT_SENDFILE_IN;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1990 oft->sn = g_strdup(userinfo->sn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1991 strncpy(oft->ip, args->verifiedip, sizeof(oft->ip));
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1992 oft->port = args->port;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1993 memcpy(oft->cookie, args->cookie, 8);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1994
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
1995 od->file_transfers = g_slist_append(od->file_transfers, oft);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1996
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1997 oft->xfer = transfer_in_add(gc, userinfo->sn,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1998 args->info.sendfile.filename,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
1999 args->info.sendfile.totsize,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2000 args->info.sendfile.totfiles,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2001 args->msg);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2002 } else if (args->reqclass & AIM_CAPS_GETFILE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2003 } else if (args->reqclass & AIM_CAPS_VOICE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2004 } else if (args->reqclass & AIM_CAPS_BUDDYICON) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2005 set_icon_data(gc, normalize(userinfo->sn), args->info.icon.icon,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2006 args->info.icon.length);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2007 } else if (args->reqclass & AIM_CAPS_IMIMAGE) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2008 struct ask_direct *d = g_new0(struct ask_direct, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2009 char buf[256];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2010
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2011 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
2012 gc->username, userinfo->sn, args->verifiedip);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2013
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2014 d->gc = gc;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2015 d->sn = g_strdup(userinfo->sn);
2869
9b029055cfba [gaim-migrate @ 2882]
Adam Fritzler <mid@auk.cx>
parents: 2866
diff changeset
2016 strncpy(d->ip, args->verifiedip, sizeof(d->ip));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2017 memcpy(d->cookie, args->cookie, 8);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2018 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
2019 userinfo->sn, gc->username);
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2020 do_ask_dialog(buf, _("This requires a direct connection between the two computers and is necessary for IM Images. Because your IP address will be revealed, this may be considered a privacy risk."), d, _("Connect"), accept_direct_im, _("Cancel"), cancel_direct_im);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2021 } else {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2022 debug_printf("Unknown reqclass %hu\n", args->reqclass);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2023 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2024
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2025 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2026 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2027
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2028 /*
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2029 * Next 2 functions are for when other people ask you for authorization
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2030 */
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2031 static void gaim_icq_authgrant(struct channel4_data *data) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2032 gchar message;
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2033 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2034 message = 0;
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2035 aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHGRANTED, &message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2036 show_got_added(data->gc, NULL, data->uin, NULL, NULL);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2037 g_free(data->uin);
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2038 g_free(data);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2039 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2040
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2041 static void gaim_icq_authdeny(struct channel4_data *data) {
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2042 gchar *message;
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2043 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2044 message = g_strdup_printf("No reason given.");
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2045 aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHDENIED, message);
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2046 g_free(data->uin);
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2047 g_free(message);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2048 g_free(data);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2049 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2050
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2051 /*
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2052 * Next 2 functions are for when someone sends you contacts
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2053 */
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2054 static void gaim_icq_contactadd(struct channel4_data *data) {
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2055 show_add_buddy(data->gc, data->uin, NULL, data->nick);
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2056 free(data->uin);
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2057 free(data->nick);
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2058 g_free(data);
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2059 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2060
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2061 static void gaim_icq_contactdontadd(struct channel4_data *data) {
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2062 free(data->uin);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2063 free(data->nick);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2064 g_free(data);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2065 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2066
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
2067 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) {
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2068 struct gaim_connection *gc = sess->aux_data;
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2069 gchar **msg1, **msg2;
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2070 GError *err = NULL;
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2071 int i;
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2072
4121
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
2073 if (!args->type || !args->msg || !args->uin)
69c049c48a96 [gaim-migrate @ 4338]
Rob Flynn <gaim@robflynn.com>
parents: 4120
diff changeset
2074 return 1;
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2075
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2076 debug_printf("Received a channel 4 message of type 0x%02hhx.\n", args->type);
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2077
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2078 /* Split up the message at the delimeter character, then convert each string to UTF-8 */
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2079 msg1 = g_strsplit(args->msg, "\376", 0);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2080 msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2081 for (i=0; msg1[i]; i++) {
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2082 strip_linefeed(msg1[i]);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2083 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2084 if (err)
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2085 debug_printf("Error converting a string from ISO-8859-1 to UTF-8 in oscar ICBM channel 4 parsing\n");
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2086 }
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2087 msg2[i] = NULL;
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2088
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
2089 switch (args->type) {
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2090 case 0x01: { /* MacICQ message or basic offline message */
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2091 if (i >= 1) {
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2092 gchar *uin = g_strdup_printf("%lu", args->uin);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2093 if (t) { /* This is an offline message */
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2094 /* I think this timestamp is in UTC, or something */
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2095 serv_got_im(gc, uin, msg2[0], 0, t, -1);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2096 } else { /* This is a message from MacICQ/Miranda */
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2097 serv_got_im(gc, uin, msg2[0], 0, time(NULL), -1);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2098 }
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2099 g_free(uin);
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
2100 }
3316
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
2101 } break;
76a0e566d834 [gaim-migrate @ 3334]
Jim Seymour <jseymour>
parents: 3279
diff changeset
2102
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2103 case 0x04: { /* Someone sent you a URL */
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2104 if (i >= 2) {
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2105 gchar *uin = g_strdup_printf("%lu", args->uin);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2106 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]);
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2107 serv_got_im(gc, uin, message, 0, time(NULL), -1);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2108 g_free(uin);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2109 g_free(message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2110 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2111 } break;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2112
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2113 case 0x06: { /* Someone requested authorization */
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2114 if (i >= 6) {
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2115 struct channel4_data *data = g_new(struct channel4_data, 1);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2116 gchar *dialog_msg = g_strdup_printf(_("The user %lu wants to add you to their buddy list for the following reason: %s"), args->uin, msg2[5] ? msg2[5] : _("No reason given."));
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2117 debug_printf("Received an authorization request from UIN %lu\n", args->uin);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2118 data->gc = gc;
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2119 data->uin = g_strdup_printf("%lu", args->uin);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2120 do_ask_dialog(_("Authorization Request"), dialog_msg, data, _("Authorize"), gaim_icq_authgrant, _("Deny"), gaim_icq_authdeny);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2121 g_free(dialog_msg);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2122 }
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2123 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2124
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2125 case 0x07: { /* Someone has denied you authorization */
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2126 if (i >= 1) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2127 gchar *dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given."));
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2128 do_error_dialog(_("ICQ authorization denied."), dialog_msg, GAIM_ERROR);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2129 g_free(dialog_msg);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2130 }
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2131 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2132
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2133 case 0x08: { /* Someone has granted you authorization */
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2134 gchar *dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2135 do_error_dialog("ICQ authorization accepted.", dialog_msg, GAIM_INFO);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2136 g_free(dialog_msg);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2137 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2138
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2139 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2140 if (i >= 6) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2141 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]);
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2142 do_error_dialog("ICQ Page", dialog_msg, GAIM_INFO);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2143 g_free(dialog_msg);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2144 }
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
2145 } break;
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
2146
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2147 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2148 if (i >= 6) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2149 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email\n\n1=%s\n2=%s\n3=%s\n4=%s\n5=%s\n6=%s\n"), msg2[0], msg2[1], msg2[2], msg2[3], msg2[4], msg2[5]);
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2150 do_error_dialog("ICQ Email", dialog_msg, GAIM_INFO);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2151 g_free(dialog_msg);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2152 }
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
2153 } break;
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
2154
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2155 case 0x12: {
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2156 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2157 /* Someone added you to their contact list? */
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2158 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2159
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2160 case 0x13: { /* Someone has sent you some ICQ contacts */
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2161 int i, num;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2162 gchar **text;
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2163 text = g_strsplit(args->msg, "\376", 0);
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2164 if (text) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2165 num = 0;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2166 for (i=0; i<strlen(text[0]); i++)
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2167 num = num*10 + text[0][i]-48;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2168 for (i=0; i<num; i++) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2169 struct channel4_data *data = g_new(struct channel4_data, 1);
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
2170 gchar *message = g_strdup_printf(_("ICQ user %lu has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]);
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2171 data->gc = gc;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2172 data->uin = g_strdup(text[i*2+2]);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2173 data->nick = g_strdup(text[i*2+1]);
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2174 do_ask_dialog(message, _("Do you want to add this contact to your Buddy List?"), data, _("Add"), gaim_icq_contactadd, _("Deny"), gaim_icq_contactdontadd);
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2175 g_free(message);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2176 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2177 g_strfreev(text);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2178 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2179 } break;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2180
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
2181 case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2182 /* This is boring and silly. */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2183 } break;
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
2184
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2185 default: {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2186 debug_printf("Received a channel 4 message of unknown type (type 0x%02hhx).\n", args->type);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2187 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2188 }
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2189
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2190 g_strfreev(msg1);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2191 g_strfreev(msg2);
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
2192
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2193 return 1;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2194 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2195
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2196 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) {
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2197 fu16_t channel;
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2198 int ret = 0;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2199 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2200 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2201
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2202 va_start(ap, fr);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2203 channel = (fu16_t)va_arg(ap, unsigned int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2204 userinfo = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2205
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2206 switch (channel) {
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2207 case 1: { /* standard message */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2208 struct aim_incomingim_ch1_args *args;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2209 args = va_arg(ap, struct aim_incomingim_ch1_args *);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2210 ret = incomingim_chan1(sess, fr->conn, userinfo, args);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2211 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2212
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2213 case 2: { /* rendevous */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2214 struct aim_incomingim_ch2_args *args;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2215 args = va_arg(ap, struct aim_incomingim_ch2_args *);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2216 ret = incomingim_chan2(sess, fr->conn, userinfo, args);
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2217 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2218
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2219 case 4: { /* ICQ */
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2220 struct aim_incomingim_ch4_args *args;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2221 args = va_arg(ap, struct aim_incomingim_ch4_args *);
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
2222 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2223 } break;
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2224
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2225 default: {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2226 debug_printf("ICBM received on unsupported channel (channel 0x%04hx).", channel);
3141
bcdbffc2c3e6 [gaim-migrate @ 3156]
Rob Flynn <gaim@robflynn.com>
parents: 3140
diff changeset
2227 } break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2228 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2229
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2230 va_end(ap);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2231
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2232 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2233 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2234
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2235 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
2236 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2237 fu16_t chan, nummissed, reason;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2238 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2239 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2240
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2241 va_start(ap, fr);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2242 chan = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2243 userinfo = va_arg(ap, aim_userinfo_t *);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2244 nummissed = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2245 reason = (fu16_t)va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2246 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2247
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2248 switch(reason) {
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2249 case 0:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2250 /* Invalid (0) */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2251 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2252 sizeof(buf),
2946
9ef2fae94c80 [gaim-migrate @ 2959]
Rob Flynn <gaim@robflynn.com>
parents: 2945
diff changeset
2253 nummissed == 1 ?
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2254 _("You missed %hu message from %s because it was invalid.") :
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2255 _("You missed %hu messages from %s because they were invalid."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2256 nummissed,
2947
6226ccbdff2b [gaim-migrate @ 2960]
Rob Flynn <gaim@robflynn.com>
parents: 2946
diff changeset
2257 userinfo->sn);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2258 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2259 case 1:
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2260 /* Message too large */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2261 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2262 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
2263 nummissed == 1 ?
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2264 _("You missed %hu message from %s because it was too large.") :
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2265 _("You missed %hu messages from %s because they were too large."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2266 nummissed,
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
2267 userinfo->sn);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2268 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2269 case 2:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2270 /* Rate exceeded */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2271 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2272 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
2273 nummissed == 1 ?
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2274 _("You missed %hu message from %s because the rate limit has been exceeded.") :
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2275 _("You missed %hu messages from %s because the rate limit has been exceeded."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2276 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2277 userinfo->sn);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2278 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2279 case 3:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2280 /* Evil Sender */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2281 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2282 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
2283 nummissed == 1 ?
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2284 _("You missed %hu message from %s because he/she was too evil.") :
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2285 _("You missed %hu messages from %s because he/she was too evil."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2286 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2287 userinfo->sn);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2288 break;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2289 case 4:
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2290 /* Evil Receiver */
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2291 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2292 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
2293 nummissed == 1 ?
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2294 _("You missed %hu message from %s because you are too evil.") :
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2295 _("You missed %hu messages from %s because you are too evil."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2296 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2297 userinfo->sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2298 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2299 default:
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2300 g_snprintf(buf,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2301 sizeof(buf),
2943
5d757d040a6a [gaim-migrate @ 2956]
Rob Flynn <gaim@robflynn.com>
parents: 2931
diff changeset
2302 nummissed == 1 ?
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2303 _("You missed %hu message from %s for an unknown reason.") :
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2304 _("You missed %hu messages from %s for an unknown reason."),
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2305 nummissed,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2306 userinfo->sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2307 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2308 }
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2309 do_error_dialog(buf, NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2310
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2311 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2312 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2313
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2314 static char *gaim_icq_status(int state) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2315 /* Make a cute little string that shows the status of the dude or dudet */
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2316 if (state & AIM_ICQ_STATE_CHAT)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2317 return g_strdup_printf("Free For Chat");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2318 else if (state & AIM_ICQ_STATE_DND)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2319 return g_strdup_printf("Do Not Disturb");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2320 else if (state & AIM_ICQ_STATE_OUT)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2321 return g_strdup_printf("Not Available");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2322 else if (state & AIM_ICQ_STATE_BUSY)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2323 return g_strdup_printf("Occupied");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2324 else if (state & AIM_ICQ_STATE_AWAY)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2325 return g_strdup_printf("Away");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2326 else if (state & AIM_ICQ_STATE_WEBAWARE)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2327 return g_strdup_printf("Web Aware");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2328 else if (state & AIM_ICQ_STATE_INVISIBLE)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2329 return g_strdup_printf("Invisible");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2330 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2331 return g_strdup_printf("Online");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2332 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2333
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2334 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2335 struct gaim_connection *gc = sess->aux_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2336
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2337 switch (reason) {
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2338 case 3: { /* Decline sendfile. */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2339 struct oscar_file_transfer *oft = find_oft_by_cookie(gc, cookie);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2340
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2341 if (oft) {
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2342 char *buf = g_strdup_printf(_("%s has declined to receive a file from %s.\n"),
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2343 who, gc->username);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2344 transfer_abort(oft->xfer, buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2345 g_free(buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2346 oscar_file_transfer_disconnect(sess, oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2347 }
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2348 } break;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2349
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2350 default: {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2351 debug_printf("Received an unknown rendezvous client auto-response from %s. Type 0x%04hx\n", who, reason);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2352 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2353
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2354 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2355
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2356 return 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2357 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2358
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2359 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) {
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2360 struct gaim_connection *gc = sess->aux_data;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2361
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2362 switch(reason) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2363 case 0x0003: { /* Reply from an ICQ status message request */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2364 char *status_msg = gaim_icq_status(state);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2365 char *dialog_msg, **splitmsg;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2366 struct oscar_data *od = gc->proto_data;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2367 GSList *l = od->evilhack;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2368 gboolean evilhack = FALSE;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2369
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2370 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2371 splitmsg = g_strsplit(msg, "\r\n", 0);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2372
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2373 /* If who is in od->evilhack, then we're just getting the away message, otherwise this
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2374 * will just get appended to the info box (which is already showing). */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2375 while (l) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2376 char *x = l->data;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2377 if (!strcmp(x, normalize(who))) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2378 evilhack = TRUE;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2379 g_free(x);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2380 od->evilhack = g_slist_remove(od->evilhack, x);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2381 break;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2382 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2383 l = l->next;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2384 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2385
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2386 if (evilhack)
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2387 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR>%s<BR>"), who, status_msg, g_strjoinv("<BR>", splitmsg));
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2388 else
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2389 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<BR><HR>%s<BR>"), status_msg, g_strjoinv("<BR>", splitmsg));
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2390 g_show_info_text(gc, who, 2, dialog_msg, NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2391
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2392 g_free(status_msg);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2393 g_free(dialog_msg);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2394 g_strfreev(splitmsg);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2395 } break;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2396
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2397 default: {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2398 debug_printf("Received an unknown client auto-response from %s. Type 0x%04hx\n", who, reason);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2399 } break;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2400 } /* end of switch */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2401
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2402 return 0;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2403 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2404
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2405 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2406 va_list ap;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2407 fu16_t chan, reason;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2408 char *who;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2409
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2410 va_start(ap, fr);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2411 chan = (fu16_t)va_arg(ap, unsigned int);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2412 who = va_arg(ap, char *);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2413 reason = (fu16_t)va_arg(ap, unsigned int);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2414
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
2415 if (chan == 0x0002) { /* File transfer declined */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2416 char *cookie = va_arg(ap, char *);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2417 return gaim_parse_clientauto_ch2(sess, who, reason, cookie);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
2418 } else if (chan == 0x0004) { /* ICQ message */
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2419 fu32_t state = 0;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2420 char *msg = NULL;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2421 if (reason == 0x0003) {
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2422 state = va_arg(ap, fu32_t);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2423 msg = va_arg(ap, char *);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2424 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2425 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2426 }
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
2427
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2428 va_end(ap);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2429
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2430 return 1;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2431 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
2432
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2433 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
2434 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2435 fu16_t reason;
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
2436 char *m;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2437
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2438 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2439 reason = (fu16_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2440 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2441
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2442 debug_printf("snac threw error (reason 0x%04hx: %s)\n", reason,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2443 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2444
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
2445 m = g_strdup_printf(_("SNAC threw error: %s\n"),
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
2446 reason < msgerrreasonlen ? gettext(msgerrreason[reason]) : _("Unknown error"));
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2447 do_error_dialog(m, NULL, GAIM_ERROR);
2865
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
2448 g_free(m);
88dc3623a2ae [gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2864
diff changeset
2449
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2450 return 1;
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
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2453 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
2454 va_list ap;
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2455 char *data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2456 fu16_t reason;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2457 char buf[1024];
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2458 struct gaim_connection *gc = sess->aux_data;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2459 struct oscar_file_transfer *oft;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2460
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2461 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2462 reason = (fu16_t) va_arg(ap, unsigned int);
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2463 data = va_arg(ap, char *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2464 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2465
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2466 /* If this was a file transfer request, data is a cookie. */
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2467 if ((oft = find_oft_by_cookie(gc, data))) {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2468 transfer_abort(oft->xfer,
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
2469 (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."));
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2470
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2471 oscar_file_transfer_disconnect(sess, oft->conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2472 return 1;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2473 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
2474
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2475 /* Data is assumed to be the destination sn. */
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
2476 snprintf(buf, sizeof(buf), _("Your message to %s did not get sent:"), data);
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
2477 do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."), GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2478
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2479 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2480 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2481
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2482 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) {
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2483 struct gaim_connection *gc = sess->aux_data;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2484 va_list ap;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2485 fu16_t type1, type2;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2486 char *sn;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2487
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2488 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2489 type1 = (fu16_t) va_arg(ap, unsigned int);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2490 sn = va_arg(ap, char *);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2491 type2 = (fu16_t) va_arg(ap, unsigned int);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2492 va_end(ap);
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2493
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2494 debug_printf("Received an mtn from %s. Type1 is 0x%04hx and type2 is 0x%04hx.\n", sn, type1, type2);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2495
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2496 switch (type2) {
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2497 case 0x0000: { /* Text has been cleared */
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2498 serv_got_typing_stopped(gc, sn);
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2499 } break;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2500
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2501 case 0x0001: { /* Paused typing */
3768
f53370197bb9 [gaim-migrate @ 3907]
Sean Egan <seanegan@gmail.com>
parents: 3752
diff changeset
2502 serv_got_typing(gc, sn, 0, TYPED);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2503 } break;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2504
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2505 case 0x0002: { /* Typing */
3768
f53370197bb9 [gaim-migrate @ 3907]
Sean Egan <seanegan@gmail.com>
parents: 3752
diff changeset
2506 serv_got_typing(gc, sn, 0, TYPING);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2507 } break;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2508
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2509 default: {
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2510 printf("Received unknown typing notification type.\n");
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2511 } break;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2512 }
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2513
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2514 return 1;
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2515 }
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
2516
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2517 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
2518 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2519 char *destn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2520 fu16_t reason;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2521 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2522
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2523 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2524 reason = (fu16_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2525 destn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2526 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2527
3574
2b43124e8475 [gaim-migrate @ 3673]
Luke Schierer <lschiere@pidgin.im>
parents: 3572
diff changeset
2528 snprintf(buf, sizeof(buf), _("User information for %s unavailable:"), destn);
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
2529 do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."), GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2530
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2531 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2532 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2533
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2534 static char *images(int flags) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2535 static char buf[1024];
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2536 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
2679
94aa499ecd39 [gaim-migrate @ 2692]
Adam Fritzler <mid@auk.cx>
parents: 2675
diff changeset
2537 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2538 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2539 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "",
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2540 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2541 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "",
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
2542 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "",
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
2543 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : "");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2544 return buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2545 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2546
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2547
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2548 /* XXX This is horribly copied from ../../buddy.c. */
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2549 static char *caps_string(guint caps)
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2550 {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2551 static char buf[512], *tmp;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2552 int count = 0, i = 0;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2553 guint bit = 1;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2554 while (bit <= 0x10000) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2555 if (bit & caps) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2556 switch (bit) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2557 case 0x1:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2558 tmp = _("Buddy Icon");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2559 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2560 case 0x2:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2561 tmp = _("Voice");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2562 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2563 case 0x4:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2564 tmp = _("IM Image");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2565 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2566 case 0x8:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2567 tmp = _("Chat");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2568 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2569 case 0x10:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2570 tmp = _("Get File");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2571 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2572 case 0x20:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2573 tmp = _("Send File");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2574 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2575 case 0x40:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2576 case 0x200:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2577 tmp = _("Games");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2578 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2579 case 0x80:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2580 tmp = _("Stocks");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2581 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2582 case 0x100:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2583 tmp = _("Send Buddy List");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2584 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2585 case 0x400:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2586 tmp = _("EveryBuddy Bug");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2587 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2588 case 0x800:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2589 tmp = _("AP User");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2590 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2591 case 0x1000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2592 tmp = _("ICQ RTF");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2593 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2594 case 0x2000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2595 tmp = _("Nihilist");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2596 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2597 case 0x4000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2598 tmp = _("ICQ Server Relay");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2599 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2600 case 0x8000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2601 tmp = _("ICQ Unknown");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2602 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2603 case 0x10000:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2604 tmp = _("Trillian Encryption");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2605 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2606 default:
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2607 tmp = NULL;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2608 break;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2609 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2610 if (tmp)
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2611 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2612 tmp);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2613 count++;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2614 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2615 bit <<= 1;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2616 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2617 return buf;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2618 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2619
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2620 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
2621 aim_userinfo_t *info;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2622 char *text_enc = NULL, *text = NULL, *utf8 = NULL;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2623 int text_len;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2624 fu16_t infotype;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2625 fu32_t flags;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2626 char header[BUF_LONG];
2137
18722ae5b882 [gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2131
diff changeset
2627 char legend[BUF_LONG];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2628 struct gaim_connection *gc = sess->aux_data;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2629 struct oscar_data *od = gc->proto_data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2630 GSList *l = od->evilhack;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2631 gboolean evilhack = FALSE;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2632 va_list ap;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2633 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2634
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2635 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2636 info = va_arg(ap, aim_userinfo_t *);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2637 infotype = (fu16_t) va_arg(ap, unsigned int);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2638 text_enc = va_arg(ap, char *);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2639 text = va_arg(ap, char *);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2640 text_len = va_arg(ap, int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2641 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2642
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2643 if (text_len > 0) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2644 flags = parse_encoding (text_enc);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2645 switch (flags) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2646 case 0:
4159
3f267c74e50a [gaim-migrate @ 4387]
Mark Doliner <mark@kingant.net>
parents: 4154
diff changeset
2647 utf8 = g_strndup(text, text_len);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2648 break;
4166
481c51159627 [gaim-migrate @ 4395]
Mark Doliner <mark@kingant.net>
parents: 4159
diff changeset
2649 case AIM_IMFLAGS_ISO_8859_1:
481c51159627 [gaim-migrate @ 4395]
Mark Doliner <mark@kingant.net>
parents: 4159
diff changeset
2650 utf8 = g_convert(text, text_len, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
481c51159627 [gaim-migrate @ 4395]
Mark Doliner <mark@kingant.net>
parents: 4159
diff changeset
2651 break;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2652 case AIM_IMFLAGS_UNICODE:
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2653 utf8 = g_convert(text, text_len, "UTF-8", "UCS-2BE", NULL, NULL, NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2654 break;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2655 default:
4152
57bf2c1b76e0 [gaim-migrate @ 4378]
Mark Doliner <mark@kingant.net>
parents: 4151
diff changeset
2656 utf8 = g_strdup(_("<I>Unable to display information because it was sent in an unknown encoding.</I>"));
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2657 debug_printf("Encountered an unknown encoding while parsing userinfo\n");
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2658 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2659 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2660
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2661 if (!od->icq) {
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2662 g_snprintf(legend, sizeof legend,
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
2663 _("<BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>"
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2664 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2665 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2666 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2667 "<IMG SRC=\"admin_icon.gif\"> : Administrator <br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2668 "<IMG SRC=\"ab_icon.gif\"> : ActiveBuddy Interactive Agent<br>"
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2669 "<IMG SRC=\"wireless_icon.gif\"> : Wireless Device User<br>"));
3106
d3cb7d47fcb4 [gaim-migrate @ 3120]
Sean Egan <seanegan@gmail.com>
parents: 3101
diff changeset
2670 } else {
d3cb7d47fcb4 [gaim-migrate @ 3120]
Sean Egan <seanegan@gmail.com>
parents: 3101
diff changeset
2671 legend[0] = 0;
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2672 }
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
2673
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2674 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2675 onlinesince = g_strdup_printf("Online Since : <B>%s</B><BR>\n",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2676 asctime(localtime(&info->onlinesince)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2677 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2678
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2679 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2680 membersince = g_strdup_printf("Member Since : <B>%s</B><BR>\n",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2681 asctime(localtime(&info->membersince)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2682 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2683
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2684 if (info->present & AIM_USERINFO_PRESENT_IDLE) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2685 idle = g_strdup_printf("Idle : <B>%hu minutes</B>",
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2686 info->idletime);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2687 } else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2688 idle = g_strdup("Idle: <B>Active</B>");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2689
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2690 g_snprintf(header, sizeof header,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2691 _("Username : <B>%s</B> %s <BR>\n"
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2692 "Warning Level : <B>%d %%</B><BR>\n"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2693 "%s"
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2694 "%s"
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2695 "%s<BR>\n"
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
2696 "<HR>\n"),
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2697 info->sn, images(info->flags),
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2698 info->warnlevel/10,
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2699 onlinesince ? onlinesince : "",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2700 membersince ? membersince : "",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2701 idle ? idle : "");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2702
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2703 g_free(onlinesince);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2704 g_free(membersince);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
2705 g_free(idle);
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
2706
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2707 while (l) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2708 char *x = l->data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2709 if (!strcmp(x, normalize(info->sn))) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2710 evilhack = TRUE;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2711 g_free(x);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2712 od->evilhack = g_slist_remove(od->evilhack, x);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2713 break;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2714 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2715 l = l->next;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2716 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2717
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2718 if (infotype == AIM_GETINFO_AWAYMESSAGE) {
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2719 if (evilhack) {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2720 g_show_info_text(gc, info->sn, 2,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2721 header,
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2722 (utf8 && *utf8) ? away_subs(utf8, gc->username) :
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2723 _("<i>User has no away message</i>"),
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2724 legend, NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2725 } else {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2726 g_show_info_text(gc, info->sn, 0,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2727 header,
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2728 (utf8 && *utf8) ? away_subs(utf8, gc->username) : NULL,
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2729 (utf8 && *utf8) ? "<BR><HR>" : NULL,
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2730 NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2731 }
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2732 } else if (infotype == AIM_GETINFO_CAPABILITIES) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2733 g_show_info_text(gc, info->sn, 2,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2734 header,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2735 "<i>", _("Client Capabilities: "),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2736 caps_string(info->capabilities),
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2737 "</i>",
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2738 legend,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
2739 NULL);
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2740 } else {
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2741 g_show_info_text(gc, info->sn, 1,
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2742 (utf8 && *utf8) ? away_subs(utf8, gc->username) :
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2743 _("<i>No Information Provided</i>"),
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2744 legend,
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2745 NULL);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
2746 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2747
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2748 g_free(utf8);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
2749
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2750 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2751 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2752
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2753 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
2754 char *msg;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2755 fu16_t id;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2756 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2757 char buildbuf[150];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2758
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2759 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2760 id = (fu16_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2761 msg = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2762 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2763
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2764 aim_getbuildstring(buildbuf, sizeof(buildbuf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2765
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2766 debug_printf("MOTD: %s (%hu)\n", msg ? msg : "Unknown", id);
2092
59b0377d18aa [gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2767 if (id < 4)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
2768 do_error_dialog(_("Your AIM connection may be lost."), NULL, GAIM_WARNING);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2769
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2770 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2771 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2772
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2773 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
2774 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2775 fu16_t type;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2776 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2777 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2778
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2779 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2780 type = (fu16_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2781
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2782 switch(type) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2783 case 0x0002: {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2784 fu8_t maxrooms;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2785 struct aim_chat_exchangeinfo *exchanges;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2786 int exchangecount, i;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2787
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2788 maxrooms = (fu8_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2789 exchangecount = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2790 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2791
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2792 debug_printf("chat info: Chat Rights:\n");
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2793 debug_printf("chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2794 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2795 for (i = 0; i < exchangecount; i++)
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2796 debug_printf("chat info: \t\t%hu %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
2797 while (odata->create_rooms) {
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2798 struct create_room *cr = odata->create_rooms->data;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2799 debug_printf("creating room %s\n", cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2800 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2801 g_free(cr->name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2802 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
2803 g_free(cr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2804 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2805 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2806 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2807 case 0x0008: {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2808 char *fqcn, *name, *ck;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2809 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2810 fu8_t createperms;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2811 fu32_t createtime;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2812
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2813 fqcn = va_arg(ap, char *);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2814 instance = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2815 exchange = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2816 flags = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2817 createtime = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2818 maxmsglen = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2819 maxoccupancy = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2820 createperms = (fu8_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2821 unknown = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2822 name = va_arg(ap, char *);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2823 ck = va_arg(ap, char *);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2824
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2825 debug_printf("created room: %s %hu %hu %hu %lu %hu %hu %hhu %hu %s %s\n",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2826 fqcn,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2827 exchange, instance, flags,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2828 createtime,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2829 maxmsglen, maxoccupancy, createperms, unknown,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2830 name, ck);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2831 aim_chat_join(odata->sess, odata->conn, exchange, ck, instance);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2832 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2833 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2834 default:
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2835 debug_printf("chatnav info: unknown type (%04hx)\n", type);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2836 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2837 }
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2838
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2839 va_end(ap);
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2840
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2841 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2842 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2843
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2844 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
2845 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2846 int count, i;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2847 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2848 struct gaim_connection *g = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2849
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2850 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2851
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2852 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2853 count = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2854 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2855 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2856
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2857 c = find_oscar_chat_by_conn(g, fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2858 if (!c)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2859 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2860
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2861 for (i = 0; i < count; i++)
3708
da6e3c984985 [gaim-migrate @ 3841]
Luke Schierer <lschiere@pidgin.im>
parents: 3694
diff changeset
2862 add_chat_buddy(c->cnv, info[i].sn, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2863
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2864 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2865 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2866
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2867 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
2868 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2869 int count, i;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2870 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2871 struct gaim_connection *g = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2872
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2873 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2874
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2875 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2876 count = va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2877 info = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2878 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2879
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2880 c = find_oscar_chat_by_conn(g, fr->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2881 if (!c)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2882 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2883
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2884 for (i = 0; i < count; i++)
2820
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2817
diff changeset
2885 remove_chat_buddy(c->cnv, info[i].sn, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2886
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2887 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2888 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2889
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2890 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
2891 va_list ap;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2892 aim_userinfo_t *userinfo;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2893 struct aim_chat_roominfo *roominfo;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2894 char *roomname;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2895 int usercount;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2896 char *roomdesc;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2897 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2898 fu32_t creationtime;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2899 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2900 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
2901
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2902 va_start(ap, fr);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2903 roominfo = va_arg(ap, struct aim_chat_roominfo *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2904 roomname = va_arg(ap, char *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2905 usercount= va_arg(ap, int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2906 userinfo = va_arg(ap, aim_userinfo_t *);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2907 roomdesc = va_arg(ap, char *);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2908 unknown_c9 = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2909 creationtime = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2910 maxmsglen = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2911 unknown_d2 = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2912 unknown_d5 = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
2913 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2914 va_end(ap);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2915
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2916 debug_printf("inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n",
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2917 maxmsglen, maxvisiblemsglen);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2918
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2919 ccon->maxlen = maxmsglen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2920 ccon->maxvis = maxvisiblemsglen;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
2921
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2922 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2923 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2924
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2925 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
2926 va_list ap;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2927 aim_userinfo_t *info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2928 char *msg;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2929 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2930 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
2931 char *tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2932
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2933 va_start(ap, fr);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
2934 info = va_arg(ap, aim_userinfo_t *);
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2935 msg = va_arg(ap, char *);
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2936 va_end(ap);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2937
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2938 tmp = g_malloc(BUF_LONG);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2939 g_snprintf(tmp, BUF_LONG, "%s", msg);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2940 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
2941 g_free(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2942
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2943 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2944 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2945
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2946 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2947 va_list ap;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2948 struct gaim_connection *gc = sess->aux_data;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2949 struct aim_emailinfo *emailinfo;
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3722
diff changeset
2950 int havenewmail;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2951
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2952 va_start(ap, fr);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2953 emailinfo = va_arg(ap, struct aim_emailinfo *);
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3722
diff changeset
2954 havenewmail = va_arg(ap, int);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2955 va_end(ap);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2956
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3722
diff changeset
2957 if (emailinfo) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2958 debug_printf("Got email info. webmail address for screenname@%s is %s, new email: %hhu, number new: %hu, flag is %hu, havenewmail is %d\n", emailinfo->domain, emailinfo->url, emailinfo->unread, emailinfo->nummsgs, emailinfo->flag, havenewmail);
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3722
diff changeset
2959 if (emailinfo->unread) {
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3722
diff changeset
2960 if (havenewmail)
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3722
diff changeset
2961 connection_has_mail(gc, emailinfo->nummsgs ? emailinfo->nummsgs : -1, NULL, NULL, emailinfo->url);
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3722
diff changeset
2962 } else
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2963 connection_has_mail(gc, 0, NULL, NULL, emailinfo->url);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2964 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2965
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2966 return 1;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2967 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
2968
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2969 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2970 * 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
2971 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2972 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
2973 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2974 fu16_t type;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2975 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2976
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2977 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
2978 type = (fu16_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2979 sn = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2980 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2981
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2982 debug_printf("Sent message to %s.\n", sn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2983
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2984 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2985 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2986
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2987 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
2988 static const char *codes[5] = {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2989 "invalid",
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2990 "change",
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2991 "warning",
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2992 "limit",
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
2993 "limit cleared",
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2994 };
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2995 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2996 fu16_t code, rateclass;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2997 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2998
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
2999 va_start(ap, fr);
4200
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3000 code = (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3001 rateclass= (fu16_t)va_arg(ap, unsigned int);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3002 windowsize = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3003 clear = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3004 alert = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3005 limit = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3006 disconnect = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3007 currentavg = va_arg(ap, fu32_t);
c8fb43808a4b [gaim-migrate @ 4431]
Mark Doliner <mark@kingant.net>
parents: 4199
diff changeset
3008 maxavg = va_arg(ap, fu32_t);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3009 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3010
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3011 debug_printf("rate %s (param ID 0x%04hx): curavg = %lu, maxavg = %lu, alert at %lu, "
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3012 "clear warning at %lu, limit at %lu, disconnect at %lu (window size = %lu)\n",
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3013 (code < 5) ? codes[code] : codes[0],
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3014 rateclass,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3015 currentavg, maxavg,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3016 alert, clear,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3017 limit, disconnect,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3018 windowsize);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3019
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3020 /* XXX fix these values */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3021 if (code == AIM_RATE_CODE_CHANGE) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3022 if (currentavg >= clear)
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3023 aim_conn_setlatency(fr->conn, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3024 } else if (code == AIM_RATE_CODE_WARNING) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3025 aim_conn_setlatency(fr->conn, windowsize/4);
2909
48ec70928d7f [gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2906
diff changeset
3026 } else if (code == AIM_RATE_CODE_LIMIT) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3027 do_error_dialog(_("Rate limiting error."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3028 _("The last message was not sent because you are over the rate limit. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3029 "Please wait 10 seconds and try again."), GAIM_ERROR);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3030 aim_conn_setlatency(fr->conn, windowsize/2);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3031 } else if (code == AIM_RATE_CODE_CLEARLIMIT) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3032 aim_conn_setlatency(fr->conn, 0);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3033 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3034
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3035 return 1;
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
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3038 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
3039 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3040 fu16_t newevil;
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
3041 aim_userinfo_t *userinfo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3042 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3043
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3044 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3045 newevil = (fu16_t) va_arg(ap, unsigned int);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
3046 userinfo = va_arg(ap, aim_userinfo_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3047 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3048
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3049 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
3050
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3051 return 1;
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
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3054 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
3055 va_list ap;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3056 aim_userinfo_t *info;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3057 struct gaim_connection *gc = sess->aux_data;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3058
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3059 va_start(ap, fr);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3060 info = va_arg(ap, aim_userinfo_t *);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3061 va_end(ap);
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3062
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3063 gc->evil = info->warnlevel/10;
2698
e80f4b4f840f [gaim-migrate @ 2711]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2689
diff changeset
3064 /* gc->correction_time = (info->onlinesince - gc->login_time); */
2507
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3065
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3066 return 1;
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3067 }
1069b0940237 [gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2501
diff changeset
3068
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
3069 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) {
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3070 struct gaim_connection *gc = sess->aux_data;
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3071 struct oscar_data *od = gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3072
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3073 aim_reqpersonalinfo(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3074 aim_bos_reqlocaterights(sess, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3075 aim_bos_reqbuddyrights(sess, fr->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3076
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
3077 aim_reqicbmparams(sess);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3078
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3079 aim_bos_reqrights(sess, fr->conn);
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3080 if (od->icq) {
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3081 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3082 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE |
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3083 AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3084 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3085
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3086 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3087 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3088
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
3089 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
3090 struct gaim_connection *gc = sess->aux_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3091 struct oscar_data *od = gc->proto_data;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3092
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
3093 aim_clientready(sess, fr->conn);
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2674
diff changeset
3094 debug_printf("connected to admin\n");
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3095
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3096 if (od->chpass) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3097 debug_printf("changing password\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3098 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3099 g_free(od->oldp);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3100 od->oldp = NULL;
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3101 g_free(od->newp);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3102 od->newp = NULL;
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3103 od->chpass = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3104 }
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3105 if (od->setnick) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3106 debug_printf("formatting screenname\n");
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3107 aim_admin_setnick(sess, fr->conn, od->newsn);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3108 g_free(od->newsn);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3109 od->newsn = NULL;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3110 od->setnick = FALSE;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
3111 }
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3112 if (od->conf) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3113 debug_printf("confirming account\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3114 aim_admin_reqconfirm(sess, fr->conn);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3115 od->conf = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3116 }
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3117 if (od->reqemail) {
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3118 debug_printf("requesting email\n");
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3119 aim_admin_getinfo(sess, fr->conn, 0x0011);
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3120 od->reqemail = FALSE;
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3121 }
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3122 if (od->setemail) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3123 debug_printf("setting email\n");
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3124 aim_admin_setemail(sess, fr->conn, od->email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3125 g_free(od->email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3126 od->setemail = FALSE;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3127 }
2647
6781ee2b9db0 [gaim-migrate @ 2660]
Adam Fritzler <mid@auk.cx>
parents: 2603
diff changeset
3128
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3129 return 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3130 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3131
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3132 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
3133 struct aim_icbmparameters *params;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3134 va_list ap;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3135
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3136 va_start(ap, fr);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3137 params = va_arg(ap, struct aim_icbmparameters *);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3138 va_end(ap);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3139
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3140 /* XXX - evidently this crashes on solaris. i have no clue why
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3141 debug_printf("ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, "
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3142 "max sender evil = %f, max receiver evil = %f, min msg interval = %lu\n",
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3143 params->maxchan, params->flags, params->maxmsglen,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3144 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0,
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3145 params->minmsginterval);
2427
5bc3b39fc0a5 [gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2421
diff changeset
3146 */
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3147
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3148 /* Maybe senderwarn and recverwarn should be user preferences... */
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3149 params->flags = 0x0000000b;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3150 params->maxmsglen = 8000;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3151 params->minmsginterval = 0;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3152
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
3153 aim_seticbmparam(sess, params);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3154
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3155 return 1;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3156 }
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
3157
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3158 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
3159 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3160 va_list ap;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3161 fu16_t maxsiglen;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3162 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3163 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3164 char *unicode;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3165 int unicode_len;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3166 fu32_t flags;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3167
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3168 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3169 maxsiglen = (fu16_t) va_arg(ap, int);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3170 va_end(ap);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3171
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3172 debug_printf("locate rights: max sig len = %d\n", maxsiglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3173
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3174 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3175
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3176 if (odata->icq)
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3177 aim_bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3178 else {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3179 flags = check_encoding (gc->user->user_info);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3180
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3181 if (flags == 0) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3182 aim_bos_setprofile(sess, fr->conn, "us-ascii", gc->user->user_info,
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3183 strlen(gc->user->user_info), NULL, NULL, 0, caps_aim);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3184 } else {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3185 unicode = g_convert (gc->user->user_info, strlen(gc->user->user_info),
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3186 "UCS-2BE", "UTF-8", NULL, &unicode_len, NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3187 aim_bos_setprofile(sess, fr->conn, "unicode-2-0", unicode, unicode_len,
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3188 NULL, NULL, 0, caps_aim);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3189 g_free(unicode);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3190 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3191 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3192
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3193 return 1;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3194 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3195
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3196 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
3197 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3198 fu16_t maxbuddies, maxwatchers;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3199 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3200 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3201
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3202 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3203 maxbuddies = (fu16_t) va_arg(ap, unsigned int);
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3204 maxwatchers = (fu16_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3205 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3206
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3207 debug_printf("buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3208
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3209 odata->rights.maxbuddies = (guint)maxbuddies;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3210 odata->rights.maxwatchers = (guint)maxwatchers;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3211
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3212 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3213 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3214
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3215 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
3216 fu16_t maxpermits, maxdenies;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3217 va_list ap;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3218 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3219 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3220
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3221 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3222 maxpermits = (fu16_t) va_arg(ap, unsigned int);
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3223 maxdenies = (fu16_t) va_arg(ap, unsigned int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3224 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3225
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3226 debug_printf("BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3227
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3228 odata->rights.maxpermits = (guint)maxpermits;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3229 odata->rights.maxdenies = (guint)maxdenies;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3230
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3231 account_online(gc);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3232 serv_finish_login(gc);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3233
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3234 if (bud_list_cache_exists(gc))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3235 do_import(gc, NULL);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3236
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3237 debug_printf("buddy list loaded\n");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3238
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2647
diff changeset
3239 aim_clientready(sess, fr->conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3240
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
3241 /* XXX - Should call aim_bos_setidle with 0x0000 */
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
3242
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
3243 /* XXX - Should only call reqofflinemsgs when using ICQ? */
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3244 aim_icq_reqofflinemsgs(sess);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3245
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3246 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV);
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4076
diff changeset
3247 if (sess->authinfo->email)
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4076
diff changeset
3248 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3249
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3250 if (!odata->icq) {
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3251 debug_printf("ssi: requesting ssi list\n");
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3252 aim_ssi_reqrights(sess, fr->conn);
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3253 aim_ssi_reqdata(sess, fr->conn, sess->ssi.timestamp, sess->ssi.revision);
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
3254 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3255
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3256 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3257 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3258
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3259 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
3260 va_list ap;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3261 struct aim_icq_offlinemsg *msg;
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3262 struct aim_incomingim_ch4_args args;
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3263 time_t t;
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3264
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3265 va_start(ap, fr);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3266 msg = va_arg(ap, struct aim_icq_offlinemsg *);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3267 va_end(ap);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3268
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3269 debug_printf("Received offline message. Converting to channel 4 ICBM...\n");
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3270 args.uin = msg->sender;
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3271 args.type = msg->type;
4173
b66f960bfe60 [gaim-migrate @ 4403]
Mark Doliner <mark@kingant.net>
parents: 4166
diff changeset
3272 args.flags = msg->flags;
4076
91c4bd698d39 [gaim-migrate @ 4291]
Mark Doliner <mark@kingant.net>
parents: 4075
diff changeset
3273 args.msglen = msg->msglen;
4075
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3274 args.msg = msg->msg;
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3275 t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
2221f6801577 [gaim-migrate @ 4290]
Mark Doliner <mark@kingant.net>
parents: 4056
diff changeset
3276 incomingim_chan4(sess, fr->conn, NULL, &args, t);
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3277
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3278 return 1;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3279 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3280
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3281 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
3282 {
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3283 aim_icq_ackofflinemsgs(sess);
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3284 return 1;
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3285 }
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
3286
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3287 static int gaim_icqsimpleinfo(aim_session_t *sess, aim_frame_t *fr, ...)
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3288 {
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2768
diff changeset
3289 struct gaim_connection *gc = sess->aux_data;
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3290 struct buddy *budlight;
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3291 va_list ap;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3292 struct aim_icq_info *info;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3293 gchar *buf, *tmp;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3294 gchar who[16];
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3295
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3296 va_start(ap, fr);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3297 info = va_arg(ap, struct aim_icq_info *);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3298 va_end(ap);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3299
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3300 g_snprintf(who, sizeof(who), "%lu", info->uin);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3301 buf = g_strdup_printf("<b>UIN:</b> %s<br>", who);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3302 if (info->nick) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3303 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3304 buf = g_strconcat(tmp, "<b>Nick:</b> ", info->nick, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3305 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3306 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3307 if (info->first) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3308 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3309 buf = g_strconcat(tmp, "<b>First Name:</b> ", info->first, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3310 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3311 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3312 if (info->last) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3313 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3314 buf = g_strconcat(tmp, "<b>Last Name:</b> ", info->last, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3315 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3316 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3317 if (info->email) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3318 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3319 buf = g_strconcat(tmp, "<b>Email Address:</b> ", info->email, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3320 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3321 }
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3322
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3323 /* If the contact is away, then we also want to get their status message
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3324 * and show it in the same window as info. g_show_info_text gets the status
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3325 * message if the third arg is 0 (this seems really gross to me). The
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3326 * parse-icq-status-message function knows if it is putting it's message in
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3327 * an info window because the name will _not_ be in od->evilhack. For getting
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3328 * only the away message the contact's UIN is put in od->evilhack. */
3279
86fdd015f40e [gaim-migrate @ 3297]
Sean Egan <seanegan@gmail.com>
parents: 3270
diff changeset
3329 if ((budlight = find_buddy(gc, who))) {
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3330 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) {
3270
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3331 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3332 g_show_info_text(gc, who, 0, buf, NULL);
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3333 else {
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3334 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
3335 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, "<BR>\n<HR><I>Remote client does not support sending status messages.</I><BR>\n", NULL);
3270
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3336 free(state_msg);
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3337 }
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3338 } else {
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3339 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16);
3270
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3340 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, NULL);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3341 free(state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3342 }
3270
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3343 } else
6231e0f0ee9e [gaim-migrate @ 3288]
Jim Seymour <jseymour>
parents: 3267
diff changeset
3344 g_show_info_text(gc, who, 2, buf, NULL);
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3345
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3346 g_free(buf);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3347
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3348 return 1;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3349 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3350
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3351 static int gaim_icqallinfo(aim_session_t *sess, aim_frame_t *fr, ...)
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3352 {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3353 struct gaim_connection *gc = sess->aux_data;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3354 va_list ap;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3355 struct aim_icq_info *info;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3356 gchar *buf, *tmp;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3357 gchar who[16];
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3358
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3359 va_start(ap, fr);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3360 info = va_arg(ap, struct aim_icq_info *);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3361 va_end(ap);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3362
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3363 g_snprintf(who, sizeof(who), "%lu", info->uin);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3364 buf = g_strdup_printf("<b>UIN:</b> %s<br>", who);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3365 if (info->nick) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3366 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3367 buf = g_strconcat(tmp, "<b>Nick:</b> ", info->nick, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3368 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3369 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3370 if (info->first) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3371 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3372 buf = g_strconcat(tmp, "<b>First Name:</b> ", info->first, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3373 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3374 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3375 if (info->last) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3376 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3377 buf = g_strconcat(tmp, "<b>Last Name:</b> ", info->last, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3378 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3379 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3380 if (info->email) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3381 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3382 buf = g_strconcat(tmp, "<b>Email Address:</b> ", info->email, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3383 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3384 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3385 if (info->personalwebpage) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3386 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3387 buf = g_strconcat(tmp, "<b>Personal Webpage:</b> ", info->personalwebpage, "<br>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3388 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3389 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3390 if (info->info) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3391 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3392 buf = g_strconcat(tmp, "<br><b>Additional Information:</b><br>", info->info, "<br><hr>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3393 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3394 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3395 if (info->homecity && info->homestate && info->homeaddr && info->homezip) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3396 tmp = buf;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3397 buf = g_strconcat(tmp, "<br><b>Home Address:</b><br>\n", info->homeaddr, "<br>\n", info->homecity, ", ", info->homestate, " ", info->homezip, "<hr>\n", NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3398 g_free(tmp);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3399 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3400
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3401 g_show_info_text(gc, who, 2, buf, NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3402 g_free(buf);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3403
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3404 return 1;
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3405 }
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3406
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3407 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
3408 {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3409 char *msg, *url;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3410 fu16_t wid, hei, delay;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3411 va_list ap;
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 va_start(ap, fr);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3414 msg = va_arg(ap, char *);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3415 url = va_arg(ap, char *);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3416 wid = (fu16_t) va_arg(ap, int);
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3417 hei = (fu16_t) va_arg(ap, int);
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3418 delay = (fu16_t) va_arg(ap, int);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3419 va_end(ap);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3420
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3421 serv_got_popup(msg, url, wid, hei);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3422
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3423 return 1;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3424 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
3425
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3426 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
3427 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3428 char *address, *SNs;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3429 int i, num;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3430 char *buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3431 int at = 0, len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3432
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3433 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3434 address = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3435 num = va_arg(ap, int);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3436 SNs = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3437 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3438
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3439 len = num * (MAXSNLEN + 1) + 1024;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3440 buf = g_malloc(len);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3441 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
3442 for (i = 0; i < num; i++)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3443 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3444 g_show_info_text(NULL, NULL, 2, buf, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3445 g_free(buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3446
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3447 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3448 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3449
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3450 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
3451 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3452 char *address;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3453 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3454
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3455 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3456 address = va_arg(ap, char *);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3457 va_end(ap);
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 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3460 do_error_dialog(buf, NULL, GAIM_ERROR);
2086
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 return 1;
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
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3465 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
3466 fu16_t status;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3467 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3468 char msg[256];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3469 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3470
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3471 va_start(ap, fr);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3472 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
3473 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3474
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3475 debug_printf("account confirmation returned status 0x%04x (%s)\n", status,
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3476 status ? "unknown" : "email sent");
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3477 if (!status) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3478 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
3479 gc->username);
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
3480 do_error_dialog(_("Account Confirmation Requested"), msg, GAIM_INFO);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3481 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3482
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3483 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3484 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3485
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3486 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) {
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3487 struct gaim_connection *gc = sess->aux_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3488 va_list ap;
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3489 fu16_t perms, err;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3490 char *url, *sn, *email;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3491 int change;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3492
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3493 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
3494 change = va_arg(ap, int);
4199
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3495 perms = (fu16_t) va_arg(ap, unsigned int);
97de60e7b7ba [gaim-migrate @ 4430]
Luke Schierer <lschiere@pidgin.im>
parents: 4194
diff changeset
3496 err = (fu16_t) va_arg(ap, unsigned int);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3497 url = va_arg(ap, char *);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3498 sn = va_arg(ap, char *);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3499 email = va_arg(ap, char *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3500 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3501
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3502 debug_printf("account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n",
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3503 change ? "change" : "request", perms, err, url, sn, email);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3504
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3505 if (err && url) {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3506 char *dialog_msg;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3507 char *dialog_top = g_strdup_printf(_("Error Changing Account Info"));
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3508 switch (err) {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3509 case 0x0001: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3510 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3511 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3512 case 0x0006: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3513 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3514 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3515 case 0x000b: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3516 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3517 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3518 case 0x001d: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3519 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because there is already a request pending for this screen name."), err);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3520 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3521 case 0x0021: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3522 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address has too many screen names associated with it."), err);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3523 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3524 case 0x0023: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3525 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3526 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3527 default: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3528 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3529 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3530 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3531 do_error_dialog(dialog_top, dialog_msg, GAIM_ERROR);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3532 g_free(dialog_top);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3533 g_free(dialog_msg);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3534 return 1;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3535 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3536
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3537 if (sn) {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3538 char *dialog_msg = g_strdup_printf(_("Your screen name is currently formated as follows:\n%s"), sn);
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
3539 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3540 g_free(dialog_msg);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3541 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3542
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3543 if (email) {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3544 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), gc->username, email);
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 3952
diff changeset
3545 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3867
diff changeset
3546 g_free(dialog_msg);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3547 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3548
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3549 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3550 }
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 static void oscar_keepalive(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3553 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3554 aim_flap_nop(odata->sess, odata->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3555 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3556
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 3000
diff changeset
3557 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) {
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3558 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3559 struct direct_im *dim = find_direct_im(odata, name);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3560 if (dim)
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3561 aim_send_typing(odata->sess, dim->conn, typing);
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3562 else {
3600
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
3563 char *who = normalize(name);
f6a55922110a [gaim-migrate @ 3702]
Mark Doliner <mark@kingant.net>
parents: 3596
diff changeset
3564 if (g_hash_table_lookup(odata->supports_tn, who)) {
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3595
diff changeset
3565 if (typing == TYPING)
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3566 aim_mtn_send(odata->sess, 0x0001, name, 0x0002);
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3595
diff changeset
3567 else if (typing == TYPED)
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3595
diff changeset
3568 aim_mtn_send(odata->sess, 0x0001, name, 0x0001);
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3569 else
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3570 aim_mtn_send(odata->sess, 0x0001, name, 0x0000);
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3571 }
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3572 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3573 return 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3574 }
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
3575 static void oscar_ask_direct_im(struct gaim_connection *gc, char *name);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3576
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3031
diff changeset
3577 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3578 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3579 struct direct_im *dim = find_direct_im(odata, name);
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
3580 int ret = 0;
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3581 GError *err = NULL;
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3582
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3583 if (dim) {
3009
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
3584 if (dim->connected) { /* If we're not connected yet, send through server */
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
3585 /* AAA - The last parameter below is the encoding. Let Paco-Paco do something with it. */
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
3586 ret = aim_send_im_direct(odata->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0);
3009
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
3587 if (ret == 0)
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
3588 return 1;
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
3589 else return ret;
f188ae5e575b [gaim-migrate @ 3022]
Sean Egan <seanegan@gmail.com>
parents: 3008
diff changeset
3590 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3591 debug_printf("Direct IM pending, but not connected; sending through server\n");
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3592 } else if (len != -1) {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3593 /* Trying to send an IM image outside of a direct connection. */
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3594 oscar_ask_direct_im(gc, name);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3595 return -ENOTCONN;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
3596 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3597 if (imflags & IM_FLAG_AWAY) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3598 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3599 } else {
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3600 struct aim_sendimext_args args;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3601 GSList *h = odata->hasicons;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3602 struct icon_req *ir = NULL;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3603 char *who = normalize(name);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3604 struct stat st;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3605 int len;
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3606
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3607 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3608 if (odata->icq)
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3609 args.flags |= AIM_IMFLAGS_OFFLINE;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3610
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3611 args.features = gaim_features;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3612 args.featureslen = sizeof(gaim_features);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3613
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3614 while (h) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3615 ir = h->data;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3616 if (ir->request && !strcmp(who, ir->user))
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3617 break;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3618 h = h->next;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3619 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3620 if (h) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3621 ir->request = FALSE;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3622 args.flags |= AIM_IMFLAGS_BUDDYREQ;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3623 debug_printf("sending buddy icon request with message\n");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3624 }
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3625
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3626 if (gc->user->iconfile[0] && !stat(gc->user->iconfile, &st)) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3627 FILE *file = fopen(gc->user->iconfile, "r");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3628 if (file) {
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3629 char *buf = g_malloc(st.st_size);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3630 fread(buf, 1, st.st_size, file);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3631
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3632 args.iconlen = st.st_size;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3633 args.iconsum = aim_iconsum(buf, st.st_size);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3634 args.iconstamp = st.st_mtime;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3635
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3636 args.flags |= AIM_IMFLAGS_HASICON;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3637 debug_printf("Claiming to have an icon.\n");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3638
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3639 fclose(file);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3640 g_free(buf);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3641 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3642 }
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3643
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3644 args.destsn = name;
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3645
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3646 len = strlen(message);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3647 args.flags |= check_encoding(message);
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3648 if (args.flags & AIM_IMFLAGS_UNICODE) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3649 debug_printf("Sending Unicode IM\n");
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3650 args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3651 if (err) {
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3652 debug_printf("Error converting a unicode message: %s\n", err->message);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3653 debug_printf("This really shouldn't happen!\n");
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3654 /* We really shouldn't try to send the
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3655 * IM now, but I'm not sure what to do */
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3656 }
3850
daf2cec08eac [gaim-migrate @ 4002]
Luke Schierer <lschiere@pidgin.im>
parents: 3783
diff changeset
3657 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3658 debug_printf("Sending ISO-8859-1 IM\n");
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3659 args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3660 if (err) {
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3661 debug_printf("conversion error: %s\n", err->message);
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3662 debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n");
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3663 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE;
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3664 len = strlen(message);
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3665 args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err);
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3666 if (err) {
4194
9325df841a40 [gaim-migrate @ 4425]
Mark Doliner <mark@kingant.net>
parents: 4173
diff changeset
3667 debug_printf("Error in unicode fallback: %s\n", err->message);
3659
5b439da85c3b [gaim-migrate @ 3788]
Luke Schierer <lschiere@pidgin.im>
parents: 3643
diff changeset
3668 }
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3669 }
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3670 } else {
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3671 args.msg = message;
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3672 }
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3639
diff changeset
3673 args.msglen = len;
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3674
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3675 ret = aim_send_im_ext(odata->sess, &args);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3676 }
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
3677 if (ret >= 0)
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
3678 return 1;
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2297
diff changeset
3679 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3680 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3681
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3682 static void oscar_get_info(struct gaim_connection *g, char *name) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3683 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2742
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3684 if (odata->icq)
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3685 aim_icq_getsimpleinfo(odata->sess, name);
6f527cbd899d [gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
3686 else
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3687 /* 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
3688 * 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
3689 * insert in the middle. i hate people. */
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3690 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3691 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3692
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3693 static void oscar_get_away(struct gaim_connection *g, char *who) {
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
3694 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3695 if (odata->icq) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3696 struct buddy *budlight = find_buddy(g, who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3697 if (budlight)
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3698 if ((budlight->uc & 0xffff0000) >> 16)
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3699 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3700 aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xffff0000) >> 16);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3701 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3702 debug_printf("Error: Remote client does not support retrieval of status messages.\n");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3703 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3704 debug_printf("Error: The user %s has no status message, therefore not requesting.\n", who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3705 else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3706 debug_printf("Error: Could not find %s in local contact list, therefore unable to request status message.\n", who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3707 } else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3708 aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_GENERALINFO);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3709 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3710
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3711 static void oscar_get_caps(struct gaim_connection *g, char *name) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3712 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3713 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_CAPABILITIES);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3714 }
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
3715
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
3716 static void oscar_set_dir(struct gaim_connection *g, const char *first, const char *middle, const char *last,
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
3717 const char *maiden, const char *city, const char *state, const char *country, int web) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3718 /* FIXME : some of these things are wrong, but i'm lazy */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3719 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3720 aim_setdirectoryinfo(odata->sess, odata->conn, first, middle, last,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3721 maiden, NULL, NULL, city, state, NULL, 0, web);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3722 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3723
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3724
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3725 static void oscar_set_idle(struct gaim_connection *g, int time) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3726 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3727 aim_bos_setidle(odata->sess, odata->conn, time);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3728 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3729
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3730 static void oscar_set_info(struct gaim_connection *g, char *info) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3731 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3732 gchar *inforeal, *unicode;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3733 fu32_t flags;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3734 int unicode_len;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3735
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3736 if (odata->rights.maxsiglen == 0)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3737 do_error_dialog(_("Unable to set AIM profile."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3738 _("You have probably requested to set your profile before the login procedure completed. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3739 "Your profile remains unset; try setting it again when you are fully connected."), GAIM_ERROR);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3740
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3741 if (strlen(info) > odata->rights.maxsiglen) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3742 gchar *errstr;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3743
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3744 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3745 "Gaim has truncated and set it."), odata->rights.maxsiglen);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3746 do_error_dialog("Profile too long.", errstr, GAIM_WARNING);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3747
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3748 g_free(errstr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3749 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3750
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3751 inforeal = g_strndup(info, odata->rights.maxsiglen);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3752
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
3753 if (odata->icq)
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3754 aim_bos_setprofile(odata->sess, odata->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3755 else {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3756 flags = check_encoding(inforeal);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3757
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3758 if (flags == 0) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3759 aim_bos_setprofile(odata->sess, odata->conn, "us-ascii", inforeal, strlen (inforeal),
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3760 NULL, NULL, 0, caps_aim);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3761 } else {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3762 unicode = g_convert (inforeal, strlen(inforeal), "UCS-2BE", "UTF-8", NULL,
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3763 &unicode_len, NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3764 aim_bos_setprofile(odata->sess, odata->conn, "unicode-2-0", unicode, unicode_len,
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3765 NULL, NULL, 0, caps_aim);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3766 g_free(unicode);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3767 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3768 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3769 g_free(inforeal);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3770
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3771 return;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3772 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3773
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3774 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
3775 {
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3776 fu32_t flags;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3777 char *unicode;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3778 int unicode_len;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3779
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3780 if (od->rights.maxawaymsglen == 0)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3781 do_error_dialog(_("Unable to set AIM away message."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3782 _("You have probably requested to set your away message before the login procedure completed. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3783 "You remain in a \"present\" state; try setting it again when you are fully connected."), GAIM_ERROR);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3784
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3785 if (gc->away) {
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3786 g_free(gc->away);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3787 gc->away = NULL;
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3788 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3789
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3790 if (!message) {
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3791 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, "", 0, caps_aim);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3792 return;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3793 }
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3794
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3795 if (strlen(message) > od->rights.maxawaymsglen) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3796 gchar *errstr;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3797
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3798 errstr = g_strdup_printf(_("The away message length of %d bytes has been exceeded. "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3799 "Gaim has truncated it and set you away."), od->rights.maxawaymsglen);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
3800 do_error_dialog("Away message too long.", errstr, GAIM_WARNING);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3801 g_free(errstr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3802 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3803
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3804 gc->away = g_strndup(message, od->rights.maxawaymsglen);
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3805 flags = check_encoding(message);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3806
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3807 if (flags == 0) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3808 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", gc->away, strlen(gc->away),
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3809 caps_aim);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3810 } else {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3811 unicode = g_convert(message, strlen(message), "UCS-2BE", "UTF-8", NULL, &unicode_len, NULL);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3812 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", unicode, unicode_len,
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3813 caps_aim);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3814 g_free(unicode);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
3815 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3816
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3817 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3818 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3819
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3820 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
3821 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3822
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3823 if (gc->away) {
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3824 g_free(gc->away);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3825 gc->away = NULL;
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3826 }
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3827
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3828 if (!strcmp(state, "Online"))
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
3829 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3830 else if (!strcmp(state, "Away")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3831 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3832 gc->away = g_strdup("");
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3833 } else if (!strcmp(state, "Do Not Disturb")) {
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3834 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3835 gc->away = g_strdup("");
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3836 } else if (!strcmp(state, "Not Available")) {
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3837 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3838 gc->away = g_strdup("");
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3839 } else if (!strcmp(state, "Occupied")) {
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
3840 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3841 gc->away = g_strdup("");
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3842 } else if (!strcmp(state, "Free For Chat")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3843 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3844 gc->away = g_strdup("");
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3845 } else if (!strcmp(state, "Invisible")) {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
3846 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3847 gc->away = g_strdup("");
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3848 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) {
2998
6fe330f1b951 [gaim-migrate @ 3011]
Sean Egan <seanegan@gmail.com>
parents: 2995
diff changeset
3849 if (message) {
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
3850 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4102
diff changeset
3851 gc->away = g_strdup("");
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3852 } else {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2865
diff changeset
3853 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
3854 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3855 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3856
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3857 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3858 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3859
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3860 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
3861 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3862 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3863
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3864 if (od->icq)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3865 oscar_set_away_icq(gc, od, state, message);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3866 else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3867 oscar_set_away_aim(gc, od, message);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3868
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
3869 return;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3870 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3871
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3872 static void oscar_warn(struct gaim_connection *g, char *name, int anon) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3873 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2113
9f83b7ef1fdc [gaim-migrate @ 2123]
Adam Fritzler <mid@auk.cx>
parents: 2092
diff changeset
3874 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
3875 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3876
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
3877 static void oscar_dir_search(struct gaim_connection *g, const char *first, const char *middle, const char *last,
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
3878 const char *maiden, const char *city, const char *state, const char *country, const char *email) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3879 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3880 if (strlen(email))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3881 aim_usersearch_address(odata->sess, odata->conn, email);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3882 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3883
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
3884 static void oscar_add_buddy(struct gaim_connection *g, const char *name) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3885 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3886 if (odata->icq) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3887 aim_add_buddy(odata->sess, odata->conn, name);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3888 } else {
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3889 if ((odata->sess->ssi.received_data) && !(aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000))) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3890 debug_printf("ssi: adding buddy %s to group %s\n", name, find_group_by_buddy(g, name)->name);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3891 aim_ssi_addbuddies(odata->sess, odata->conn, find_group_by_buddy(g, name)->name, &name, 1);
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3892 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3893 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3894 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3895
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3896 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3897 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3898 if (odata->icq) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3899 char buf[MSG_LEN];
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3900 int n=0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3901 while (buddies) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3902 if (n > MSG_LEN - 18) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3903 aim_bos_setbuddylist(odata->sess, odata->conn, buf);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3904 n = 0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3905 }
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3906 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3907 buddies = buddies->next;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3908 }
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3909 aim_bos_setbuddylist(odata->sess, odata->conn, buf);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3910 } else {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3911 if (odata->sess->ssi.received_data) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3912 int tmp;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3913 GSList *curgrp, *curbud;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3914 for (curgrp=g->groups; curgrp; curgrp=g_slist_next(curgrp)) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3915 tmp = 0;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3916 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3917 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000))
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3918 tmp++;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3919 if (tmp) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3920 char **sns = (char **)malloc(tmp*sizeof(char*));
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3921 tmp = 0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3922 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3923 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) {
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3924 debug_printf("ssi: adding buddy %s to group %s\n", ((struct buddy*)curbud->data)->name, ((struct group*)curgrp->data)->name);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3925 sns[tmp] = (char *)((struct buddy*)curbud->data)->name;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3926 tmp++;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3927 }
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
3928 aim_ssi_addbuddies(odata->sess, odata->conn, ((struct group*)curgrp->data)->name, (const char**)sns, tmp);
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3929 free(sns);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3930 }
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3931 }
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3932 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3933 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3934 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3935
3867
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3858
diff changeset
3936 static void oscar_move_buddy(struct gaim_connection *g, const char *name, const char *old_group, const char *new_group) {
3140
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3937 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3938 if (!odata->icq)
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3939 if (odata->sess->ssi.received_data) {
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3940 aim_ssi_movebuddy(odata->sess, odata->conn, old_group, new_group, name);
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3941 debug_printf("ssi: moved buddy %s from group %s to group %s\n", name, old_group, new_group);
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3942 }
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3943 }
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
3944
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3945 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3946 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3947 if (odata->icq) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3948 aim_remove_buddy(odata->sess, odata->conn, name);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3949 } else {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3950 if (odata->sess->ssi.received_data) {
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3951 struct aim_ssi_item *ssigroup;
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3952 while (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000) && (ssigroup = aim_ssi_itemlist_findparent(odata->sess->ssi.items, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1))
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3953 debug_printf("ssi: deleted buddy %s from group %s\n", name, group);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3954 }
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3955 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3956 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3957
3867
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3858
diff changeset
3958 static void oscar_remove_buddies(struct gaim_connection *g, GList *buddies, const char *group) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3959 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3960 if (odata->icq) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3961 GList *cur;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3962 for (cur=buddies; cur; cur=cur->next)
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3963 aim_remove_buddy(odata->sess, odata->conn, cur->data);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3964 } else {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3965 if (odata->sess->ssi.received_data) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3966 GList *cur;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3967 int tmp = 0;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
3968 for (cur=buddies; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3969 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3970 tmp++;
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3971 if (tmp) {
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3972 char **sns;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3973 sns = (char **)malloc(tmp*sizeof(char*));
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3974 tmp = 0;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3975 for (cur=buddies; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
3976 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000)) {
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3977 debug_printf("ssi: deleting buddy %s from group %s\n", cur->data, group);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3978 sns[tmp] = cur->data;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3979 tmp++;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3980 }
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3981 aim_ssi_delbuddies(odata->sess, odata->conn, group, sns, tmp);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3982 free(sns);
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
3983 }
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3984 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3985 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3986 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
3987
3867
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3858
diff changeset
3988 static void oscar_rename_group(struct gaim_connection *g, const char *old_group, const char *new_group, GList *members) {
3348
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3989 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3990 if (!odata->icq)
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3991 if (odata->sess->ssi.received_data) {
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3992 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, new_group, 0x0001)) {
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3993 oscar_remove_buddies(g, members, old_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3994 oscar_add_buddies(g, members);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3995 debug_printf("ssi: moved all buddies from group %s to %s\n", old_group, new_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3996 } else {
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3997 aim_ssi_rename_group(odata->sess, odata->conn, old_group, new_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3998 debug_printf("ssi: renamed group %s to %s\n", old_group, new_group);
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
3999 }
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
4000 }
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
4001 }
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
4002
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4003 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
4004 /* 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
4005 fu16_t maxbuddies, maxgroups, maxpermits, maxdenies;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4006 va_list ap;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4007
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4008 va_start(ap, fr);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4009 maxbuddies = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4010 maxgroupss = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4011 maxpermits = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4012 maxdenies = (fu16_t)va_arg(ap, unsigned int);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4013 va_end(ap);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4014
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4015 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
4016 */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4017
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4018 return 1;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4019 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4020
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4021 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
4022 struct gaim_connection *gc = sess->aux_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4023 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4024 struct aim_ssi_item *curitem;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4025 int tmp;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4026 const char **sns;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4027
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4028 debug_printf("ssi: syncing local list and server list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4029
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4030 if (odata->icq)
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
4031 return 1;
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
4032
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4033 /* Activate SSI */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4034 debug_printf("ssi: activating server-stored buddy list\n");
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4035 aim_ssi_enable(sess, fr->conn);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4036
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4037 /* Clean the buddy list */
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4038 aim_ssi_cleanlist(sess, fr->conn);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4039
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4040 /* Add from server list to local list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4041 tmp = 0;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4042 for (curitem=sess->ssi.items; curitem; curitem=curitem->next) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4043 switch (curitem->type) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4044 case 0x0000: /* Buddy */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4045 if ((curitem->name) && (!find_buddy(gc, curitem->name))) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4046 struct aim_ssi_item *curgroup = sess->ssi.items;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4047 while (curgroup) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4048 if ((curgroup->type == 0x0001) && (curgroup->gid == curitem->gid) && (curgroup->name)) {
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4049 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, curgroup->name);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4050 add_buddy(gc, curgroup->name, curitem->name, 0);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4051 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4052 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4053 curgroup = curgroup->next;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4054 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4055 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4056 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4057
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4058 case 0x0002: /* Permit buddy */
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4059 if (curitem->name) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4060 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4061 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
4062 if (!list) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4063 char *name;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4064 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4065 name = g_strdup(normalize(curitem->name));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4066 gc->permit = g_slist_append(gc->permit, name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4067 build_allow_list();
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4068 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4069 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4070 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4071 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4072
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4073 case 0x0003: /* Deny buddy */
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4074 if (curitem->name) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4075 GSList *list;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4076 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
4077 if (!list) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4078 char *name;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4079 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4080 name = g_strdup(normalize(curitem->name));
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4081 gc->deny = g_slist_append(gc->deny, name);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4082 build_block_list();
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4083 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4084 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4085 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4086 break;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4087
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4088 case 0x0004: /* Permit/deny setting */
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4089 if (curitem->data) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4090 fu8_t permdeny;
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4091 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) {
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4092 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
4093 gc->permdeny = permdeny;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4094 tmp++;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4095 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4096 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4097 break;
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4098
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4099 case 0x0005: /* Presence setting */
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4100 /* We don't want to change Gaim's setting because it applies to all accounts */
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4101 break;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4102 } /* End of switch on curitem->type */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4103 } /* End of for loop */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4104 if (tmp)
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4105 do_export(gc);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4106
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4107 /* Add from local list to server list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4108 if (gc) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4109 GSList *cur;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4110
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4111 /* Buddies */
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4112 cur = gc->groups;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4113 while (cur) {
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4114 GSList *curbud;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4115 tmp = 0;
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4116 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4117 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4118 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4119 if (tmp) {
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4120 sns = malloc(tmp*sizeof(char*));
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4121 tmp = 0;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4122 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4123 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4124 debug_printf("ssi: adding buddy %s from local list to server list\n", ((struct buddy*)curbud->data)->name);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4125 sns[tmp] = ((char *)((struct buddy*)curbud->data)->name);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4126 tmp++;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4127 }
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4128 aim_ssi_addbuddies(sess, fr->conn, ((struct group*)cur->data)->name, sns, tmp);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4129 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4130 }
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4131 cur = g_slist_next(cur);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4132 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4133
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4134 /* Permit list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4135 if (gc->permit) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4136 tmp = 0;
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4137 for (cur=gc->permit; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4138 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4139 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4140 if (tmp) {
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4141 sns = malloc(tmp*sizeof(char*));
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4142 tmp = 0;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4143 for (cur=gc->permit; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4144 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002)) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4145 debug_printf("ssi: adding permit %s from local list to server list\n", cur->data);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4146 sns[tmp] = cur->data;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4147 tmp++;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4148 }
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4149 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_PERMIT);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4150 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4151 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4152 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4153
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4154 /* Deny list */
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4155 if (gc->deny) {
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4156 tmp = 0;
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4157 for (cur=gc->deny; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4158 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003))
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4159 tmp++;
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4160 if (tmp) {
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4161 sns = malloc(tmp*sizeof(char*));
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4162 tmp = 0;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4163 for (cur=gc->deny; cur; cur=cur->next)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4164 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003)) {
3017
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4165 debug_printf("ssi: adding deny %s from local list to server list\n", cur->data);
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4166 sns[tmp] = cur->data;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4167 tmp++;
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4168 }
f0e8770d786d [gaim-migrate @ 3030]
Rob Flynn <gaim@robflynn.com>
parents: 3016
diff changeset
4169 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_DENY);
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4170 free(sns);
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4171 }
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4172 }
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4173
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4174 /* Presence settings (idle time visibility) */
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4175 if ((tmp = aim_ssi_getpresence(sess->ssi.items)) != 0xFFFFFFFF)
3109
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4176 if (report_idle && !(tmp & 0x400))
51f49dcbd14b [gaim-migrate @ 3123]
Sean Egan <seanegan@gmail.com>
parents: 3106
diff changeset
4177 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400);
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4178
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4179 /* Check for maximum number of buddies */
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4180 for (cur=gc->groups, tmp=0; cur; cur=g_slist_next(cur)) {
3214
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
4181 struct group* gr = (struct group*)cur->data;
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
4182 tmp = tmp + g_slist_length(gr->members);
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
4183 }
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4184 if (tmp > odata->rights.maxbuddies) {
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4185 char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d."
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4186 " Until you are below the limit, some buddies will not show up as online."),
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4187 odata->rights.maxbuddies, tmp);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
4188 do_error_dialog("Maximum buddy list length exceeded.", dialog_msg, GAIM_WARNING);
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4189 g_free(dialog_msg);
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4190 }
3214
f1ac8b51ec6b [gaim-migrate @ 3231]
Sean Egan <seanegan@gmail.com>
parents: 3212
diff changeset
4191
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4192 } /* end if (gc) */
3092
beb5d0e592d9 [gaim-migrate @ 3106]
Sean Egan <seanegan@gmail.com>
parents: 3089
diff changeset
4193
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
4194 return 1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4195 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4196
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4197 static GList *oscar_chat_info(struct gaim_connection *gc) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4198 GList *m = NULL;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4199 struct proto_chat_entry *pce;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4200
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4201 pce = g_new0(struct proto_chat_entry, 1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4202 pce->label = _("Join what group:");
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4203 m = g_list_append(m, pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4204
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4205 pce = g_new0(struct proto_chat_entry, 1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4206 pce->label = _("Exchange:");
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4207 pce->is_int = TRUE;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4208 pce->min = 4;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4209 pce->max = 20;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4210 m = g_list_append(m, pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4211
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4212 return m;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4213 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4214
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4215 static void oscar_join_chat(struct gaim_connection *g, GList *data) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4216 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4217 aim_conn_t *cur;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4218 char *name;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4219 int *exchange;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4220
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4221 if (!data || !data->next)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4222 return;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4223
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4224 name = data->data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4225 exchange = data->next->data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4226
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4227 debug_printf("Attempting to join chat room %s.\n", name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4228 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4229 debug_printf("chatnav exists, creating room\n");
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
4230 aim_chatnav_createroom(odata->sess, cur, name, *exchange);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4231 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4232 /* this gets tricky */
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
4233 struct create_room *cr = g_new0(struct create_room, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4234 debug_printf("chatnav does not exist, opening chatnav\n");
2822
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
4235 cr->exchange = *exchange;
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
4236 cr->name = g_strdup(name);
744df95bf123 [gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2821
diff changeset
4237 odata->create_rooms = g_slist_append(odata->create_rooms, cr);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
4238 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4239 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4240 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4241
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4242 static void oscar_chat_invite(struct gaim_connection *g, int id, const char *message, const char *name) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4243 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4244 struct chat_connection *ccon = find_oscar_chat(g, id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4245
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4246 if (!ccon)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4247 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4248
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4249 aim_chat_invite(odata->sess, odata->conn, name, message ? message : "",
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4250 ccon->exchange, ccon->name, 0x0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4251 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4252
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4253 static void oscar_chat_leave(struct gaim_connection *g, int id) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4254 struct oscar_data *odata = g ? (struct oscar_data *)g->proto_data : NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4255 GSList *bcs = g->buddy_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4256 struct conversation *b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4257 struct chat_connection *c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4258 int count = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4259
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4260 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4261 count++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4262 b = (struct conversation *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4263 if (id == b->id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4264 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4265 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4266 b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4267 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4268
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4269 if (!b)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4270 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4271
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4272 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
4273
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4274 c = find_oscar_chat(g, b->id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4275 if (c != NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4276 if (odata)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4277 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4278 if (c->inpa > 0)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
4279 gaim_input_remove(c->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4280 if (g && odata->sess)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4281 aim_conn_kill(odata->sess, &c->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4282 g_free(c->name);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4283 g_free(c->show);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4284 g_free(c);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4285 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4286 /* 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
4287 serv_got_chat_left(g, b->id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4288 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4289
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4290 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
4291 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4292 GSList *bcs = g->buddy_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4293 struct conversation *b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4294 struct chat_connection *c = NULL;
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4295 char *buf, *buf2;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4296 int i, j;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4297
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4298 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4299 b = (struct conversation *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4300 if (id == b->id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4301 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4302 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4303 b = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4304 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4305 if (!b)
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4306 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4307
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4308 bcs = odata->oscar_chats;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4309 while (bcs) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4310 c = (struct chat_connection *)bcs->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4311 if (b == c->cnv)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4312 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4313 bcs = bcs->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4314 c = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4315 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4316 if (!c)
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4317 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4318
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4319 buf = g_malloc(strlen(message) * 4 + 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4320 for (i = 0, j = 0; i < strlen(message); i++) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4321 if (message[i] == '\n') {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4322 buf[j++] = '<';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4323 buf[j++] = 'B';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4324 buf[j++] = 'R';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4325 buf[j++] = '>';
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4326 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4327 buf[j++] = message[i];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4328 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4329 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4330 buf[j] = '\0';
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4331
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4332 if (strlen(buf) > c->maxlen)
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4333 return -E2BIG;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4334
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4335 buf2 = strip_html(buf);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4336 if (strlen(buf2) > c->maxvis) {
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4337 g_free(buf2);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4338 return -E2BIG;
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4339 }
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4340 g_free(buf2);
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4341
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4342 aim_chat_send_im(odata->sess, c->conn, 0, buf, strlen(buf));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4343 g_free(buf);
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
4344 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4345 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4346
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4347 static char **oscar_list_icon(int uc) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4348 if (uc == 0)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4349 return (char **)icon_online_xpm;
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4350 if (uc & 0xffff0000) {
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4351 uc >>= 16;
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4352 if (uc & AIM_ICQ_STATE_INVISIBLE)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4353 return icon_offline_xpm;
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4354 if (uc & AIM_ICQ_STATE_CHAT)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4355 return icon_ffc_xpm;
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4356 if (uc & AIM_ICQ_STATE_DND)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4357 return icon_dnd_xpm;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4358 if (uc & AIM_ICQ_STATE_OUT)
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4359 return icon_na_xpm;
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4360 if (uc & AIM_ICQ_STATE_BUSY)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4361 return icon_occ_xpm;
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4362 if (uc & AIM_ICQ_STATE_AWAY)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4363 return icon_away_xpm;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4364 return icon_online_xpm;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4365 }
3101
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4366 if (uc & UC_UNAVAILABLE)
8b0d58f74d3f [gaim-migrate @ 3115]
Sean Egan <seanegan@gmail.com>
parents: 3092
diff changeset
4367 return (char **)away_icon_xpm;
3079
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
4368 if (uc & UC_WIRELESS)
955f52bbcf8a [gaim-migrate @ 3093]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
4369 return (char **)wireless_icon_xpm;
2689
870450d36999 [gaim-migrate @ 2702]
Adam Fritzler <mid@auk.cx>
parents: 2681
diff changeset
4370 if (uc & UC_AB)
2679
94aa499ecd39 [gaim-migrate @ 2692]
Adam Fritzler <mid@auk.cx>
parents: 2675
diff changeset
4371 return (char **)ab_xpm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4372 if (uc & UC_AOL)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4373 return (char **)aol_icon_xpm;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4374 if (uc & UC_ADMIN)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4375 return (char **)admin_icon_xpm;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4376 if (uc & UC_UNCONFIRMED)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4377 return (char **)dt_icon_xpm;
2297
a0f6ead876ca [gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2288
diff changeset
4378 if (uc & UC_NORMAL)
a0f6ead876ca [gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2288
diff changeset
4379 return (char **)free_icon_xpm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4380 return NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4381 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4382
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4383 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4384 * This is called after the raw data for a file has been transferred (whether
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4385 * we are sending or receiving), but there are other files remaining.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4386 */
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
4387 void oscar_file_transfer_nextfile(struct gaim_connection *gc,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4388 struct file_transfer *xfer) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4389 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4390 aim_conn_t *conn = oft->conn;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4391 aim_session_t *sess = aim_conn_getsess(conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4392
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4393 oft->filesdone++;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4394 oft->watcher = gaim_input_add(conn->fd, GAIM_INPUT_READ,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4395 oscar_callback, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4396
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4397 /* If this is an incoming sendfile transfer, we send an OK
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4398 * message to the sender; if this is an outgoing sendfile, we
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4399 * will get an OK from the receiver that will be handled in
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4400 * oscar_sendfile_out_done(), so we don't need to do anything
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4401 * yet.
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4402 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4403
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4404 if (oft->type == OFT_SENDFILE_IN)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4405 aim_oft_end(sess, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4406 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4407
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4408 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4409 * This is called after the raw data for a file has been transferred (whether
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4410 * we are sending or receiving), and it is the last file in the set, so we
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4411 * can tear down the connection.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4412 */
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
4413 void oscar_file_transfer_done(struct gaim_connection *gc,
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4414 struct file_transfer *xfer) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4415 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4416 aim_conn_t *conn = oft->conn;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4417 aim_session_t *sess = aim_conn_getsess(conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4418
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4419 oft->filesdone++;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4420 if (oft->type == OFT_SENDFILE_IN) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4421 aim_oft_end(sess, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4422 oscar_file_transfer_disconnect(sess, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4423 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4424 else if (oft->type == OFT_SENDFILE_OUT) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4425 /* Wait for response before closing connection. */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4426 oft->watcher = gaim_input_add(conn->fd, GAIM_INPUT_READ,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4427 oscar_callback, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4428 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4429 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4430
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4431 /*
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4432 * This is called when there is raw data ready to be sent or received; all the
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4433 * protocol details have been taken care of.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4434 */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4435 static int oscar_file_transfer_do(aim_session_t *sess, aim_frame_t *fr, ...) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4436 struct gaim_connection *gc = sess->aux_data;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4437 va_list ap;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4438 aim_conn_t *conn;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4439 struct oscar_file_transfer *oft;
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
4440 struct aim_fileheader_t *fh;
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4441 int err;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4442
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4443 va_start(ap, fr);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4444 conn = va_arg(ap, aim_conn_t *);
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
4445 fh = va_arg(ap, struct aim_fileheader_t *);
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
4446 va_end(ap);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4447
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4448 oft = find_oft_by_conn(gc, conn);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4449
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4450 /* Don't use the regular input handler for the raw data. */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4451 gaim_input_remove(oft->watcher);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4452 oft->watcher = 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4453
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4454 if (oft->type == OFT_SENDFILE_IN) {
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4455 /* AAA convert fh->name from UCS-2 to UTF-8 if (fh->nencode == 0x0002) */
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4456 err = transfer_in_do(oft->xfer, conn->fd, fh->name, fh->size);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4457 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4458 else {
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
4459 err = transfer_out_do(oft->xfer, conn->fd, fh->nrecvd);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4460 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4461
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4462 if (err) {
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4463 /* There was an error; cancel the transfer. */
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4464 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4465 aim_conn_t *bosconn = od->conn;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4466 aim_canceltransfer(sess, bosconn, oft->cookie,
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4467 oft->sn, AIM_CAPS_SENDFILE);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4468 oscar_file_transfer_disconnect(sess, oft->conn);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4469 }
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4470
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4471 return 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4472 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
4473
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4474 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
4475 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4476 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4477 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4478 aim_conn_t *newconn, *listenerconn;
2235
5d8b6100a9cc [gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
4479 struct conversation *cnv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4480 struct direct_im *dim;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4481 char buf[256];
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4482 char *sn;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4483
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4484 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4485 newconn = va_arg(ap, aim_conn_t *);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4486 listenerconn = va_arg(ap, aim_conn_t *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4487 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4488
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4489 aim_conn_close(listenerconn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4490 aim_conn_kill(sess, &listenerconn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4491
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4492 sn = g_strdup(aim_directim_getsn(newconn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4493
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4494 debug_printf("DirectIM: initiate success to %s\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4495 dim = find_direct_im(od, sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4496
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4497 if (!(cnv = find_conversation(sn)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4498 cnv = new_conversation(sn);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
4499 gaim_input_remove(dim->watcher);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4500 dim->conn = newconn;
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
4501 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4502 oscar_callback, dim->conn);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4503 dim->connected = TRUE;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4504 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4505 g_free(sn);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2833
diff changeset
4506 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4507
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4508 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
4509 gaim_directim_incoming, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4510 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
4511 gaim_directim_typing, 0);
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3031
diff changeset
4512 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER,
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4513 gaim_update_ui, 0);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4514 return 1;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4515 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4516
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4517 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
4518 va_list ap;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4519 char *sn;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4520 double percent;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4521 struct gaim_connection *gc = sess->aux_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4522 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4523 struct conversation *c;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4524 struct direct_im *dim;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4525
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4526 va_start(ap, fr);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4527 sn = va_arg(ap, char *);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4528 percent = va_arg(ap, double);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4529 va_end(ap);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4530
2994
60018f862a51 [gaim-migrate @ 3007]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
4531 if (!(dim = find_direct_im(od, sn)))
60018f862a51 [gaim-migrate @ 3007]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
4532 return 1;
3059
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
4533 if (dim->watcher) {
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
4534 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
4535 dim->watcher = 0;
966c4e460ebb [gaim-migrate @ 3073]
Sean Egan <seanegan@gmail.com>
parents: 3048
diff changeset
4536 }
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
4537 while (gtk_events_pending())
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
4538 gtk_main_iteration();
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
4539
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4540 if ((c = find_conversation(sn)))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4541 update_progress(c, percent);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4542 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4543 oscar_callback, dim->conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4544
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4545 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4546 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4547
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4548 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
4549 va_list ap;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4550 char *msg, *sn;
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4551 int len, encoding;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4552 struct gaim_connection *gc = sess->aux_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4553
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4554 va_start(ap, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4555 sn = va_arg(ap, char *);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4556 msg = va_arg(ap, char *);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4557 len = va_arg(ap, int);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4558 encoding = va_arg(ap, int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4559 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4560
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4561 debug_printf("Got DirectIM message from %s\n", sn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4562
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4563 /* AAA - I imagine Paco-Paco will want to do some voodoo with the encoding here */
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4564 serv_got_im(gc, sn, msg, 0, time(NULL), len);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4565
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4566 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4567 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4568
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4569 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
4570 va_list ap;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4571 char *sn;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4572 int typing;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4573 struct gaim_connection *gc = sess->aux_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4574
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4575 va_start(ap, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4576 sn = va_arg(ap, char *);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4577 typing = va_arg(ap, int);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4578 va_end(ap);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4579
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4580 if (typing) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4581 /* 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
4582 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn);
3768
f53370197bb9 [gaim-migrate @ 3907]
Sean Egan <seanegan@gmail.com>
parents: 3752
diff changeset
4583 serv_got_typing(gc,sn,0, TYPING);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4584 } else
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
4585 serv_got_typing_stopped(gc,sn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4586 return 1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4587 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4588
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4589 struct ask_do_dir_im {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4590 char *who;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4591 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4592 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4593
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
4594 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4595 g_free(data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4596 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4597
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
4598 static void oscar_direct_im(struct ask_do_dir_im *data) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4599 struct gaim_connection *gc = data->gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4600 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4601 struct direct_im *dim;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4602
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4603 dim = find_direct_im(od, data->who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4604 if (dim) {
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4605 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4606 od->direct_ims = g_slist_remove(od->direct_ims, dim);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4607 gaim_input_remove(dim->watcher);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4608 g_free(dim);
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4609 debug_printf("Gave up on old direct IM, trying again\n");
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4610 } else {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
4611 do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR);
3008
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4612 return;
03d98a2e8e49 [gaim-migrate @ 3021]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
4613 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4614 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4615 dim = g_new0(struct direct_im, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4616 dim->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4617 g_snprintf(dim->name, sizeof dim->name, "%s", data->who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4618
2717
03bf072c6238 [gaim-migrate @ 2730]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2713
diff changeset
4619 dim->conn = aim_directim_initiate(od->sess, data->who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4620 if (dim->conn != NULL) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4621 od->direct_ims = g_slist_append(od->direct_ims, dim);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
4622 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4623 oscar_callback, dim->conn);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4624 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
4625 gaim_directim_initiate, 0);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4626 } else {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
4627 do_error_dialog(_("Unable to open Direct IM"), NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4628 g_free(dim);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4629 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4630 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4631
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4632 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
4633 char buf[BUF_LONG];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4634 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
4635 data->who = who;
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4636 data->gc = gc;
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
4637 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s."), who);
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3725
diff changeset
4638 do_ask_dialog(buf, _("Because this reveals your IP address, it may be considered a privacy risk. Do you wish to continue?"), data, _("Connect"), oscar_direct_im, _("Cancel"), oscar_cancel_direct_im);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4639 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4640
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
4641 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
4642 struct oscar_data *od = gc->proto_data;
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
4643 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who)));
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4644 if (od->icq) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4645 struct buddy *budlight = find_buddy(gc, who);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4646 if (budlight)
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4647 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT))
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4648 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4649 aim_send_im_ch2_geticqmessage(od->sess, who, (budlight->uc & 0xffff0000) >> 16);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4650 else {
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4651 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4652 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><I>Remote client does not support sending status messages.</I><BR>"), who, state_msg);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4653 g_show_info_text(gc, who, 2, dialog_msg, NULL);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4654 free(state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4655 free(dialog_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4656 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4657 else {
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4658 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
4659 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><I>User has no status message.</I><BR>"), who, state_msg);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4660 g_show_info_text(gc, who, 2, dialog_msg, NULL);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4661 free(state_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4662 free(dialog_msg);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4663 }
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4664 else
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
4665 do_error_dialog("Could not find contact in local list, therefore unable to request status message.\n", NULL, GAIM_ERROR);
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4666 } else
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4667 oscar_get_info(gc, who);
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
4668 }
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
4669
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4670 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) {
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4671 GList *m = NULL;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4672 struct proto_buddy_menu *pbm;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4673 char *n = g_strdup(normalize(gc->username));
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4674 struct oscar_data *odata = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4675
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4676 pbm = g_new0(struct proto_buddy_menu, 1);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4677 pbm->label = _("Get Info");
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4678 pbm->callback = oscar_get_info;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4679 pbm->gc = gc;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4680 m = g_list_append(m, pbm);
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4681
3212
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4682 if (odata->icq) {
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4683 pbm = g_new0(struct proto_buddy_menu, 1);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4684 pbm->label = _("Get Status Msg");
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4685 pbm->callback = oscar_get_away_msg;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4686 pbm->gc = gc;
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4687 m = g_list_append(m, pbm);
56746b0868db [gaim-migrate @ 3229]
Sean Egan <seanegan@gmail.com>
parents: 3210
diff changeset
4688 } else {
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4689 pbm = g_new0(struct proto_buddy_menu, 1);
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4690 pbm->label = _("Get Away Msg");
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4691 pbm->callback = oscar_get_away_msg;
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4692 pbm->gc = gc;
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4693 m = g_list_append(m, pbm);
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4694
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4695 if (strcmp(n, normalize(who))) {
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4696 pbm = g_new0(struct proto_buddy_menu, 1);
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4697 pbm->label = _("Direct IM");
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4698 pbm->callback = oscar_ask_direct_im;
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4699 pbm->gc = gc;
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4700 m = g_list_append(m, pbm);
3752
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4701
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4702 pbm = g_new0(struct proto_buddy_menu, 1);
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4703 pbm->label = _("Send File");
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4704 pbm->callback = oscar_ask_send_file;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4705 pbm->gc = gc;
b32474e522fa [gaim-migrate @ 3890]
Luke Schierer <lschiere@pidgin.im>
parents: 3730
diff changeset
4706 m = g_list_append(m, pbm);
2833
cdbe6e2f0ff2 [gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2822
diff changeset
4707 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4708 }
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
4709
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
4710 pbm = g_new0(struct proto_buddy_menu, 1);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
4711 pbm->label = _("Get Capabilities");
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
4712 pbm->callback = oscar_get_caps;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
4713 pbm->gc = gc;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
4714 m = g_list_append(m, pbm);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2918
diff changeset
4715
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4716 g_free(n);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4717
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
4718 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4719 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4720
3456
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4721 static GList *oscar_edit_buddy_menu(struct gaim_connection *gc, char *who)
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4722 {
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4723 GList *m = NULL;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4724 struct proto_buddy_menu *pbm;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4725 struct oscar_data *odata = gc->proto_data;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4726
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4727 if (odata->icq) {
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4728 pbm = g_new0(struct proto_buddy_menu, 1);
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4729 pbm->label = _("Get Info");
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4730 pbm->callback = oscar_get_info;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4731 pbm->gc = gc;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4732 m = g_list_append(m, pbm);
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4733 }
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4734
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4735 return m;
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4736 }
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
4737
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4738 static void oscar_set_permit_deny(struct gaim_connection *gc) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4739 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4740 if (od->icq) {
3783
62f1fd706de6 [gaim-migrate @ 3923]
Sean Egan <seanegan@gmail.com>
parents: 3782
diff changeset
4741 GSList *list, *g;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4742 char buf[MAXMSGLEN];
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4743 int at;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4744
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4745 switch(gc->permdeny) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4746 case 1:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4747 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4748 break;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4749 case 2:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4750 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4751 break;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4752 case 3:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4753 list = gc->permit;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4754 at = 0;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4755 while (list) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4756 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4757 list = list->next;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4758 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4759 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4760 break;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4761 case 4:
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4762 list = gc->deny;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4763 at = 0;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4764 while (list) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4765 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4766 list = list->next;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4767 }
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4768 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4769 break;
3782
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4770 case 5:
3783
62f1fd706de6 [gaim-migrate @ 3923]
Sean Egan <seanegan@gmail.com>
parents: 3782
diff changeset
4771 g = gc->groups;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4772 at = 0;
3782
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4773 while (g) {
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4774 list = ((struct group *)g->data)->members;
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4775 while (list) {
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4776 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", ((struct buddy *)list->data)->name);
3782
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4777 list = list->next;
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4778 }
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4779 g = g->next;
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4780 }
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4781 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4782 break;
a3aca202aa04 [gaim-migrate @ 3922]
Sean Egan <seanegan@gmail.com>
parents: 3771
diff changeset
4783 default:
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4784 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4785 }
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4786 signoff_blocked(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4787 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4788 if (od->sess->ssi.received_data)
3210
5e90ecb578c5 [gaim-migrate @ 3227]
Sean Egan <seanegan@gmail.com>
parents: 3186
diff changeset
4789 aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4790 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4791 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4792
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4793 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
4794 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4795 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4796 if (gc->permdeny != 3) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4797 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4798 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4799 debug_printf("ssi: About to add a permit\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4800 if (od->sess->ssi.received_data)
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4801 aim_ssi_addpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_PERMIT);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4802 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4803 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4804
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4805 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
4806 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4807 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4808 if (gc->permdeny != 4) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4809 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4810 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4811 debug_printf("ssi: About to add a deny\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4812 if (od->sess->ssi.received_data)
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4813 aim_ssi_addpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_DENY);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4814 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4815 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4816
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4817 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
4818 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4819 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4820 if (gc->permdeny != 3) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4821 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4822 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4823 debug_printf("ssi: About to delete a permit\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4824 if (od->sess->ssi.received_data)
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4825 aim_ssi_delpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_PERMIT);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4826 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4827 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4828
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4829 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
4830 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4831 if (od->icq) {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4832 if (gc->permdeny != 4) return;
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4833 oscar_set_permit_deny(gc);
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4834 } else {
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4835 debug_printf("ssi: About to delete a deny\n");
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4836 if (od->sess->ssi.received_data)
3595
1e60a05c7482 [gaim-migrate @ 3697]
Mark Doliner <mark@kingant.net>
parents: 3579
diff changeset
4837 aim_ssi_delpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_DENY);
2995
e27517a5c28e [gaim-migrate @ 3008]
Sean Egan <seanegan@gmail.com>
parents: 2994
diff changeset
4838 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4839 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4840
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4841 static GList *oscar_away_states(struct gaim_connection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4842 {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4843 struct oscar_data *od = gc->proto_data;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4844 GList *m = NULL;
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4845
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4846 if (!od->icq)
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4847 return g_list_append(m, GAIM_AWAY_CUSTOM);
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4848
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4849 m = g_list_append(m, "Online");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4850 m = g_list_append(m, "Away");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4851 m = g_list_append(m, "Do Not Disturb");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4852 m = g_list_append(m, "Not Available");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4853 m = g_list_append(m, "Occupied");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4854 m = g_list_append(m, "Free For Chat");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4855 m = g_list_append(m, "Invisible");
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4856
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2432
diff changeset
4857 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4858 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4859
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4860 static void oscar_change_email(struct gaim_connection *gc, char *email)
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4861 {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4862 struct oscar_data *od = gc->proto_data;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4863 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
4864
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4865 if (conn) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4866 aim_admin_setemail(od->sess, conn, email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4867 } else {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4868 od->setemail = TRUE;
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4869 od->email = g_strdup(email);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4870 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4871 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4872 }
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4873
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4874 static void oscar_format_screenname(struct gaim_connection *gc, char *nick) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4875 struct oscar_data *od = gc->proto_data;
3031
eafd12638829 [gaim-migrate @ 3044]
Sean Egan <seanegan@gmail.com>
parents: 3017
diff changeset
4876 if (!strcmp(normalize(nick), normalize(gc->username))) {
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4877 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4878 od->setnick = TRUE;
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4879 od->newsn = g_strdup(nick);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4880 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4881 } else {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4882 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
4883 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4884 } else {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
4885 do_error_dialog("The new formatting is invalid.",
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3348
diff changeset
4886 "Screenname formatting can change only capitalization and whitespace.", GAIM_ERROR);
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4887 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4888 }
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4889
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4890 static void oscar_do_action(struct gaim_connection *gc, char *act)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4891 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4892 struct oscar_data *od = gc->proto_data;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4893 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
4894
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4895 if (!strcmp(act, "Set User Info")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4896 show_set_info(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4897 } else if (!strcmp(act, "Change Password")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4898 show_change_passwd(gc);
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4899 } else if (!strcmp(act, "Format Screenname")) {
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4900 do_prompt_dialog("New screenname formatting:",
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4901 gc->displayname, gc, oscar_format_screenname, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4902 } else if (!strcmp(act, "Confirm Account")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4903 if (!conn) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4904 od->conf = TRUE;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
4905 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4906 } else
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
4907 aim_admin_reqconfirm(od->sess, conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4908 } else if (!strcmp(act, "Display Current Registered Address")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4909 if (!conn) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4910 od->reqemail = TRUE;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
4911 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4912 } else
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
4913 aim_admin_getinfo(od->sess, conn, 0x11);
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4914 } else if (!strcmp(act, "Change Current Registered Address")) {
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4915 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
4916 } else if (!strcmp(act, "Search for Buddy by Email")) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4917 show_find_email(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4918 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4919 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4920
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4921 static GList *oscar_actions()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4922 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4923 GList *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4924
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4925 m = g_list_append(m, "Set User Info");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4926 m = g_list_append(m, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4927 m = g_list_append(m, "Change Password");
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2947
diff changeset
4928 m = g_list_append(m, "Format Screenname");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4929 m = g_list_append(m, "Confirm Account");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4930 m = g_list_append(m, "Display Current Registered Address");
2768
8a918df1a5ed [gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2762
diff changeset
4931 m = g_list_append(m, "Change Current Registered Address");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4932 m = g_list_append(m, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4933 m = g_list_append(m, "Search for Buddy by Email");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4934
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4935 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4936 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4937
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
4938 static void oscar_change_passwd(struct gaim_connection *gc, const char *old, const char *new)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4939 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4940 struct oscar_data *od = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4941 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4942 od->chpass = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4943 od->oldp = g_strdup(old);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4944 od->newp = g_strdup(new);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
4945 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4946 } else {
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2698
diff changeset
4947 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
4948 new, old);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4949 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4950 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4951
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4952 static void oscar_convo_closed(struct gaim_connection *gc, char *who)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4953 {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4954 struct oscar_data *od = gc->proto_data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4955 struct direct_im *dim = find_direct_im(od, who);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4956
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4957 if (!dim)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4958 return;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4959
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4960 od->direct_ims = g_slist_remove(od->direct_ims, dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4961 gaim_input_remove(dim->watcher);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4962 aim_conn_kill(od->sess, &dim->conn);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4963 g_free(dim);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4964 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
4965
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4966 static fu32_t check_encoding(const char *utf8)
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4967 {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4968 int i = 0;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4969 fu32_t encodingflag = 0;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4970
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4971 /* Determine how we can send this message. Per the
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4972 * warnings elsewhere in this file, these little
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4973 * checks determine the simplest encoding we can use
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4974 * for a given message send using it. */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4975 while (utf8[i]) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4976 if ((unsigned char)utf8[i] > 0x7f) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4977 /* not ASCII! */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4978 encodingflag = AIM_IMFLAGS_ISO_8859_1;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4979 break;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4980 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4981 i++;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4982 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4983 while (utf8[i]) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4984 /* ISO-8859-1 is 0x00-0xbf in the first byte
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4985 * followed by 0xc0-0xc3 in the second */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4986 if ((unsigned char)utf8[i] < 0x80) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4987 i++;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4988 continue;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4989 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 &&
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4990 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4991 i += 2;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4992 continue;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4993 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4994 encodingflag = AIM_IMFLAGS_UNICODE;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4995 break;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4996 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4997
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4998 return encodingflag;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
4999 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5000
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5001 static fu32_t parse_encoding(const char *enc)
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5002 {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5003 char *charset;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5004
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5005 /* If anything goes wrong, fall back on ASCII and print a message */
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5006 charset = strstr(enc, "charset=");
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5007 if (charset == NULL) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5008 debug_printf("No charset specified for info, assuming ASCII\n");
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5009 return 0;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5010 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5011 charset += 8;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5012 if (!strcmp(charset, "\"us-ascii\"")) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5013 return 0;
4166
481c51159627 [gaim-migrate @ 4395]
Mark Doliner <mark@kingant.net>
parents: 4159
diff changeset
5014 } else if (!strcmp(charset, "\"iso-8859-1\"")) {
481c51159627 [gaim-migrate @ 4395]
Mark Doliner <mark@kingant.net>
parents: 4159
diff changeset
5015 return AIM_IMFLAGS_ISO_8859_1;
4151
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5016 } else if (!strcmp(charset, "\"unicode-2-0\"")) {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5017 return AIM_IMFLAGS_UNICODE;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5018 } else {
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5019 debug_printf("Unrecognized character set '%s', using ASCII\n", charset);
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5020 return 0;
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5021 }
1a5dcfa1823e [gaim-migrate @ 4377]
Mark Doliner <mark@kingant.net>
parents: 4121
diff changeset
5022 }
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3034
diff changeset
5023
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5024 static struct prpl *my_protocol = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5025
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
5026 G_MODULE_EXPORT void oscar_init(struct prpl *ret) {
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5027 struct proto_user_opt *puo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5028 ret->protocol = PROTO_OSCAR;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents: 3666
diff changeset
5029 ret->options = OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE;
3858
b5d7232c3e76 [gaim-migrate @ 4010]
Luke Schierer <lschiere@pidgin.im>
parents: 3850
diff changeset
5030 ret->name = g_strdup("AIM/ICQ");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5031 ret->list_icon = oscar_list_icon;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5032 ret->away_states = oscar_away_states;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5033 ret->actions = oscar_actions;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5034 ret->do_action = oscar_do_action;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5035 ret->buddy_menu = oscar_buddy_menu;
3456
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
5036 ret->edit_buddy_menu = oscar_edit_buddy_menu;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5037 ret->login = oscar_login;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5038 ret->close = oscar_close;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5039 ret->send_im = oscar_send_im;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2991
diff changeset
5040 ret->send_typing = oscar_send_typing;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5041 ret->set_info = oscar_set_info;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5042 ret->get_info = oscar_get_info;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5043 ret->set_away = oscar_set_away;
2791
8f6365332a05 [gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2789
diff changeset
5044 ret->get_away = oscar_get_away;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5045 ret->set_dir = oscar_set_dir;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5046 ret->get_dir = NULL; /* Oscar really doesn't have this */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5047 ret->dir_search = oscar_dir_search;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5048 ret->set_idle = oscar_set_idle;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5049 ret->change_passwd = oscar_change_passwd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5050 ret->add_buddy = oscar_add_buddy;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5051 ret->add_buddies = oscar_add_buddies;
3140
aa18e79365b7 [gaim-migrate @ 3155]
Rob Flynn <gaim@robflynn.com>
parents: 3139
diff changeset
5052 ret->group_buddy = oscar_move_buddy;
3348
dd34e0b40fed [gaim-migrate @ 3367]
Jim Seymour <jseymour>
parents: 3316
diff changeset
5053 ret->rename_group = oscar_rename_group;
3771
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
5054 ret->file_transfer_cancel = oscar_file_transfer_cancel;
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
5055 ret->file_transfer_in = oscar_file_transfer_in;
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
5056 ret->file_transfer_out = oscar_file_transfer_out;
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
5057 ret->file_transfer_data_chunk = oscar_file_transfer_data_chunk;
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
5058 ret->file_transfer_nextfile = oscar_file_transfer_nextfile;
765769211688 [gaim-migrate @ 3910]
Rob Flynn <gaim@robflynn.com>
parents: 3768
diff changeset
5059 ret->file_transfer_done = oscar_file_transfer_done;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5060 ret->remove_buddy = oscar_remove_buddy;
2991
9d11dbb33b6f [gaim-migrate @ 3004]
Rob Flynn <gaim@robflynn.com>
parents: 2989
diff changeset
5061 ret->remove_buddies = oscar_remove_buddies;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5062 ret->add_permit = oscar_add_permit;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5063 ret->add_deny = oscar_add_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5064 ret->rem_permit = oscar_rem_permit;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5065 ret->rem_deny = oscar_rem_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5066 ret->set_permit_deny = oscar_set_permit_deny;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5067 ret->warn = oscar_warn;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2197
diff changeset
5068 ret->chat_info = oscar_chat_info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5069 ret->join_chat = oscar_join_chat;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5070 ret->chat_invite = oscar_chat_invite;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5071 ret->chat_leave = oscar_chat_leave;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5072 ret->chat_whisper = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5073 ret->chat_send = oscar_chat_send;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5074 ret->keepalive = oscar_keepalive;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2235
diff changeset
5075 ret->convo_closed = oscar_convo_closed;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5076
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5077 puo = g_new0(struct proto_user_opt, 1);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5078 puo->label = g_strdup("Auth Host:");
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5079 puo->def = g_strdup("login.oscar.aol.com");
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5080 puo->pos = USEROPT_AUTH;
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5081 ret->user_opts = g_list_append(ret->user_opts, puo);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5082
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5083 puo = g_new0(struct proto_user_opt, 1);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5084 puo->label = g_strdup("Auth Port:");
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5085 puo->def = g_strdup("5190");
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5086 puo->pos = USEROPT_AUTHPORT;
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5087 ret->user_opts = g_list_append(ret->user_opts, puo);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5088
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5089 my_protocol = ret;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5090 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5091
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5092 #ifndef STATIC
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5093
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3600
diff changeset
5094 G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5095 {
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5096 oscar_init(prpl);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3498
diff changeset
5097 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5098 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5099
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5100 #endif