annotate src/oscar.c @ 1979:e43c267b1a8a

[gaim-migrate @ 1989] important oscar fixes. i hadn't considered these. other minor fixes. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 09 Jun 2001 21:19:00 +0000
parents 7b3f1eb1ef7d
children 26ff22691f5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
23 #ifdef HAVE_CONFIG_H
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
24 #include "../config.h"
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
25 #endif
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
26
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <netdb.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <unistd.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <errno.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <netinet/in.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #include <arpa/inet.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <sys/socket.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #include <sys/stat.h>
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
40 #include "multi.h"
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
41 #include "prpl.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 #include "gaim.h"
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
43 #include "aim.h"
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
44 #include "proxy.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
46 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
47 #include <gdk-pixbuf/gdk-pixbuf.h>
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
48 #include <gdk-pixbuf/gdk-pixbuf-loader.h>
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
49 #endif
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
50
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1810
diff changeset
51 /*#include "pixmaps/cancel.xpm"*/
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
52 #include "pixmaps/admin_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
53 #include "pixmaps/aol_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
54 #include "pixmaps/away_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
55 #include "pixmaps/dt_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
56 #include "pixmaps/free_icon.xpm"
526
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
57
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
58 /* constants to identify proto_opts */
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
59 #define USEROPT_AUTH 0
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
60 #define USEROPT_AUTHPORT 1
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
61
1837
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
62 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
63
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
64 static int gaim_caps = AIM_CAPS_CHAT |
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
65 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
66 AIM_CAPS_BUDDYICON |
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
67 #endif
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
68 AIM_CAPS_GETFILE |
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
69 AIM_CAPS_IMIMAGE;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
70
1807
ba8f463744c0 [gaim-migrate @ 1817]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1806
diff changeset
71 static GtkWidget *join_chat_spin = NULL;
ba8f463744c0 [gaim-migrate @ 1817]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1806
diff changeset
72 static GtkWidget *join_chat_entry = NULL;
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
73
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
74 struct oscar_data {
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
75 struct aim_session_t *sess;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
76 struct aim_conn_t *conn;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
77
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
78 guint cnpa;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
79 guint paspa;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
80
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
81 int create_exchange;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
82 char *create_name;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
83
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
84 gboolean conf;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
85 gboolean reqemail;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
86 gboolean chpass;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
87 char *oldp;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
88 char *newp;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
89
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
90 GSList *oscar_chats;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
91 GSList *direct_ims;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
92 GSList *getfiles;
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
93 GSList *hasicons;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
94 };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
95
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
96 struct chat_connection {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
97 char *name;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
98 char *show; /* AOL did something funny to us */
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
99 int exchange;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
100 int fd; /* this is redundant since we have the conn below */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
101 struct aim_conn_t *conn;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
102 int inpa;
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
103 int id;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
104 struct gaim_connection *gc; /* i hate this. */
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
105 gpointer priv; /* don't ask. */
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
106 };
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
107
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
108 struct direct_im {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
109 struct gaim_connection *gc;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
110 char name[80];
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
111 struct conversation *cnv;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
112 int watcher;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
113 struct aim_conn_t *conn;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
114 };
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
115
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
116 struct ask_direct {
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
117 struct gaim_connection *gc;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
118 char *sn;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
119 struct aim_directim_priv *priv;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
120 };
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
121
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
122 struct ask_getfile {
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
123 struct gaim_connection *gc;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
124 char *sn;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
125 char *cookie;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
126 char *ip;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
127 };
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
128
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
129 struct getfile_transfer {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
130 struct gaim_connection *gc;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
131 char *receiver;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
132 char *filename;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
133 struct aim_conn_t *conn;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
134 struct aim_fileheader_t *fh;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
135 int gip;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
136 int gop;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
137 FILE *listing;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
138 FILE *file;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
139 GtkWidget *window;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
140 GtkWidget *meter;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
141 GtkWidget *label;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
142 long pos;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
143 long size;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
144 };
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
145
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
146 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
147 struct icon_req {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
148 char *user;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
149 time_t timestamp;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
150 unsigned long length;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
151 gpointer data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
152 gboolean request;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
153 GdkPixbufAnimation *anim;
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
154 GdkPixbuf *unanim;
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
155 struct conversation *cnv;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
156 GtkWidget *pix;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
157 int curframe;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
158 int timer;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
159 };
1905
17ae421bb214 [gaim-migrate @ 1915]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1903
diff changeset
160 #endif
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
161
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
162 static gpointer memdup(gconstpointer mem, guint size)
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
163 {
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
164 gpointer new_mem;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
165
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
166 if (mem) {
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
167 new_mem = malloc(size);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
168 memcpy(new_mem, mem, size);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
169 return new_mem;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
170 } else
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
171 return NULL;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
172 }
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
173
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
174 static struct direct_im *find_direct_im(struct oscar_data *od, char *who) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
175 GSList *d = od->direct_ims;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
176 char *n = g_strdup(normalize(who));
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
177 struct direct_im *m = NULL;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
178
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
179 while (d) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
180 m = (struct direct_im *)d->data;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
181 if (!strcmp(n, normalize(m->name)))
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
182 break;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
183 m = NULL;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
184 d = d->next;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
185 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
186
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
187 g_free(n);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
188 return m;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
189 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
190
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1810
diff changeset
191 /*
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
192 static struct getfile_transfer *find_getfile_transfer(struct oscar_data *od, struct aim_conn_t *conn) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
193 GSList *g = od->getfiles;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
194 struct getfile_transfer *n = NULL;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
195
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
196 while (g) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
197 n = (struct getfile_transfer *)g->data;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
198 if (n->conn == conn)
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
199 return n;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
200 n = NULL;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
201 g = g->next;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
202 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
203
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
204 return n;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
205 }
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1810
diff changeset
206 */
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
207
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
208 static char *extract_name(char *name) {
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
209 char *tmp;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
210 int i, j;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
211 char *x = strchr(name, '-');
1859
b1d62fe22d74 [gaim-migrate @ 1869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1858
diff changeset
212 if (!x) return NULL;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
213 x = strchr(++x, '-');
1859
b1d62fe22d74 [gaim-migrate @ 1869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1858
diff changeset
214 if (!x) return NULL;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
215 tmp = g_strdup(++x);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
216
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
217 for (i = 0, j = 0; x[i]; i++) {
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
218 if (x[i] != '%')
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
219 tmp[j++] = x[i];
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
220 else {
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
221 char hex[3];
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
222 hex[0] = x[++i];
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
223 hex[1] = x[++i];
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
224 hex[2] = 0;
1859
b1d62fe22d74 [gaim-migrate @ 1869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1858
diff changeset
225 sscanf(hex, "%x", (int *)&tmp[j++]);
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
226 }
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
227 }
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
228
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
229 tmp[j] = 0;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
230 return tmp;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
231 }
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
232
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
233 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
234 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
235 struct chat_connection *c = NULL;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
236 if (gc->protocol != PROTO_OSCAR) return NULL;
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
237
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
238 while (g) {
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
239 c = (struct chat_connection *)g->data;
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
240 if (c->id == id)
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
241 break;
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
242 g = g->next;
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
243 c = NULL;
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
244 }
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
245
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
246 return c;
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
247 }
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
248
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
249 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc,
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
250 struct aim_conn_t *conn) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
251 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
833
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
252 struct chat_connection *c = NULL;
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
253
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
254 while (g) {
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
255 c = (struct chat_connection *)g->data;
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
256 if (c->conn == conn)
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
257 break;
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
258 g = g->next;
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
259 c = NULL;
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
260 }
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
261
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
262 return c;
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
263 }
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
264
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
265 static struct gaim_connection *find_gaim_conn_by_oscar_conn(struct aim_conn_t *conn) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
266 GSList *g = connections;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
267 struct gaim_connection *c = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
268 struct aim_conn_t *s;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
269 while (g) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
270 c = (struct gaim_connection *)g->data;
965
50f2977537d8 [gaim-migrate @ 975]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 964
diff changeset
271 if (c->protocol != PROTO_OSCAR) {
50f2977537d8 [gaim-migrate @ 975]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 964
diff changeset
272 c = NULL;
50f2977537d8 [gaim-migrate @ 975]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 964
diff changeset
273 g = g->next;
50f2977537d8 [gaim-migrate @ 975]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 964
diff changeset
274 continue;
50f2977537d8 [gaim-migrate @ 975]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 964
diff changeset
275 }
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
276 s = ((struct oscar_data *)c->proto_data)->sess->connlist;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
277 while (s) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
278 if (conn == s)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
279 break;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
280 s = s->next;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
281 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
282 if (s) break;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
283 g = g->next;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
284 c = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
285 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
286
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
287 return c;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
288 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
289
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
290 static int gaim_parse_auth_resp (struct aim_session_t *, struct command_rx_struct *, ...);
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
291 static int gaim_parse_login (struct aim_session_t *, struct command_rx_struct *, ...);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
292 static int gaim_server_ready (struct aim_session_t *, struct command_rx_struct *, ...);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
293 static int gaim_handle_redirect (struct aim_session_t *, struct command_rx_struct *, ...);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
294 static int gaim_info_change (struct aim_session_t *, struct command_rx_struct *, ...);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
295 static int gaim_account_confirm (struct aim_session_t *, struct command_rx_struct *, ...);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
296 static int gaim_parse_oncoming (struct aim_session_t *, struct command_rx_struct *, ...);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
297 static int gaim_parse_offgoing (struct aim_session_t *, struct command_rx_struct *, ...);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
298 static int gaim_parse_incoming_im(struct aim_session_t *, struct command_rx_struct *, ...);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
299 static int gaim_parse_misses (struct aim_session_t *, struct command_rx_struct *, ...);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
300 static int gaim_parse_user_info (struct aim_session_t *, struct command_rx_struct *, ...);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
301 static int gaim_parse_motd (struct aim_session_t *, struct command_rx_struct *, ...);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
302 static int gaim_chatnav_info (struct aim_session_t *, struct command_rx_struct *, ...);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
303 static int gaim_chat_join (struct aim_session_t *, struct command_rx_struct *, ...);
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
304 static int gaim_chat_leave (struct aim_session_t *, struct command_rx_struct *, ...);
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
305 static int gaim_chat_info_update (struct aim_session_t *, struct command_rx_struct *, ...);
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
306 static int gaim_chat_incoming_msg(struct aim_session_t *, struct command_rx_struct *, ...);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
307 static int gaim_parse_msgack (struct aim_session_t *, struct command_rx_struct *, ...);
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
308 static int gaim_parse_ratechange (struct aim_session_t *, struct command_rx_struct *, ...);
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
309 static int gaim_parse_evilnotify (struct aim_session_t *, struct command_rx_struct *, ...);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
310 static int gaim_parse_searcherror(struct aim_session_t *, struct command_rx_struct *, ...);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
311 static int gaim_parse_searchreply(struct aim_session_t *, struct command_rx_struct *, ...);
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
312 static int gaim_bosrights (struct aim_session_t *, struct command_rx_struct *, ...);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
313 static int gaim_rateresp (struct aim_session_t *, struct command_rx_struct *, ...);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
314 static int gaim_reportinterval (struct aim_session_t *, struct command_rx_struct *, ...);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
315 static int gaim_parse_msgerr (struct aim_session_t *, struct command_rx_struct *, ...);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
316 static int gaim_parse_buddyrights(struct aim_session_t *, struct command_rx_struct *, ...);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
317 static int gaim_parse_locerr (struct aim_session_t *, struct command_rx_struct *, ...);
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
318 static int gaim_parse_genericerr (struct aim_session_t *, struct command_rx_struct *, ...);
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
319 static int gaim_memrequest (struct aim_session_t *, struct command_rx_struct *, ...);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
320
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
321 static int gaim_directim_initiate (struct aim_session_t *, struct command_rx_struct *, ...);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
322 static int gaim_directim_incoming (struct aim_session_t *, struct command_rx_struct *, ...);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
323 static int gaim_directim_disconnect(struct aim_session_t *, struct command_rx_struct *, ...);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
324 static int gaim_directim_typing (struct aim_session_t *, struct command_rx_struct *, ...);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
325
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
326 static char *msgerrreason[] = {
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
327 "Invalid error",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
328 "Invalid SNAC",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
329 "Rate to host",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
330 "Rate to client",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
331 "Not logged in",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
332 "Service unavailable",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
333 "Service not defined",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
334 "Obsolete SNAC",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
335 "Not supported by host",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
336 "Not supported by client",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
337 "Refused by client",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
338 "Reply too big",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
339 "Responses lost",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
340 "Request denied",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
341 "Busted SNAC payload",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
342 "Insufficient rights",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
343 "In local permit/deny",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
344 "Too evil (sender)",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
345 "Too evil (receiver)",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
346 "User temporarily unavailable",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
347 "No match",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
348 "List overflow",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
349 "Request ambiguous",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
350 "Queue full",
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
351 "Not while on AOL"
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
352 };
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
353 static int msgerrreasonlen = 25;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
354
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
355 static void oscar_callback(gpointer data, gint source,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
356 GdkInputCondition condition) {
288
6e609d42f767 [gaim-migrate @ 298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 283
diff changeset
357 struct aim_conn_t *conn = (struct aim_conn_t *)data;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
358 struct gaim_connection *gc = find_gaim_conn_by_oscar_conn(conn);
1974
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
359 struct oscar_data *odata;
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
360
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
361 if (!gc) {
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
362 /* gc is null. we return, else we seg SIGSEG on next line. */
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
363 debug_printf("oscar callback for closed connection (1).\n");
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
364 return;
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
365 }
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
366
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
367 odata = (struct oscar_data *)gc->proto_data;
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
368
1149
22bf2c3ec2e3 [gaim-migrate @ 1159]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1148
diff changeset
369 if (!g_slist_find(connections, gc)) {
1974
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
370 /* oh boy. this is probably bad. i guess the only thing we
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
371 * can really do is return? */
db1b719c66cf [gaim-migrate @ 1984]
Rob Flynn <gaim@robflynn.com>
parents: 1973
diff changeset
372 debug_printf("oscar callback for closed connection (2).\n");
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
373 return;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
374 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
375
259
e159ba2486fc [gaim-migrate @ 269]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
376 if (condition & GDK_INPUT_EXCEPTION) {
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
377 hide_login_progress(gc, _("Disconnected."));
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
378 signoff(gc);
259
e159ba2486fc [gaim-migrate @ 269]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
379 return;
e159ba2486fc [gaim-migrate @ 269]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
380 }
e159ba2486fc [gaim-migrate @ 269]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
381 if (condition & GDK_INPUT_READ) {
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
382 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
383 debug_printf("got information on rendezvous\n");
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
384 if (aim_handlerendconnect(odata->sess, conn) < 0) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
385 debug_printf(_("connection error (rend)\n"));
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
386 }
259
e159ba2486fc [gaim-migrate @ 269]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
387 } else {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
388 if (aim_get_command(odata->sess, conn) >= 0) {
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
389 aim_rxdispatch(odata->sess);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
390 } else {
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
391 if ((conn->type == AIM_CONN_TYPE_BOS) ||
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
392 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
393 debug_printf(_("major connection error\n"));
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
394 hide_login_progress(gc, _("Disconnected."));
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
395 signoff(gc);
747
eec93c5929b9 [gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 746
diff changeset
396 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
397 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
833
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
398 char buf[BUF_LONG];
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
399 debug_printf("disconnected from chat room %s\n", c->name);
833
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
400 c->conn = NULL;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
401 if (c->inpa > 0)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
402 gdk_input_remove(c->inpa);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
403 c->inpa = 0;
833
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
404 c->fd = -1;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
405 aim_conn_kill(odata->sess, &conn);
833
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
406 sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
8d8ef8c3afe2 [gaim-migrate @ 843]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
407 do_error_dialog(buf, _("Chat Error!"));
828
4c71c0e7f04e [gaim-migrate @ 838]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 812
diff changeset
408 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
409 if (odata->cnpa > 0)
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
410 gdk_input_remove(odata->cnpa);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
411 odata->cnpa = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
412 debug_printf("removing chatnav input watcher\n");
1576
992871bf2649 [gaim-migrate @ 1586]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1537
diff changeset
413 if (odata->create_exchange) {
992871bf2649 [gaim-migrate @ 1586]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1537
diff changeset
414 odata->create_exchange = 0;
992871bf2649 [gaim-migrate @ 1586]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1537
diff changeset
415 g_free(odata->create_name);
992871bf2649 [gaim-migrate @ 1586]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1537
diff changeset
416 odata->create_name = NULL;
992871bf2649 [gaim-migrate @ 1586]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1537
diff changeset
417 do_error_dialog(_("Chat is currently unavailable"),
992871bf2649 [gaim-migrate @ 1586]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1537
diff changeset
418 _("Gaim - Chat"));
992871bf2649 [gaim-migrate @ 1586]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1537
diff changeset
419 }
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
420 aim_conn_kill(odata->sess, &conn);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
421 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
422 if (odata->paspa > 0)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
423 gdk_input_remove(odata->paspa);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
424 odata->paspa = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
425 debug_printf("removing authconn input watcher\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
426 aim_conn_kill(odata->sess, &conn);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
427 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
428 debug_printf("No handler for rendezvous disconnect (%d).\n",
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
429 source);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
430 aim_conn_kill(odata->sess, &conn);
695
d3db515e9a6e [gaim-migrate @ 705]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 694
diff changeset
431 } else {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
432 debug_printf("holy crap! generic connection error! %d\n",
794
80274f969a09 [gaim-migrate @ 804]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 788
diff changeset
433 conn->type);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
434 aim_conn_kill(odata->sess, &conn);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
435 }
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
436 }
259
e159ba2486fc [gaim-migrate @ 269]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
437 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
438 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
439 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
440
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
441 static void oscar_debug(struct aim_session_t *sess, int level, const char *format, va_list va) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
442 char *s = g_strdup_vprintf(format, va);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
443 char buf[256];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
444 char *t;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
445 struct gaim_connection *gc = sess->aux_data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
446
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
447 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
448 t = g_strconcat(buf, s, NULL);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
449 debug_printf(t);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
450 if (t[strlen(t)-1] != '\n')
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
451 debug_printf("\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
452 g_free(t);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
453 g_free(s);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
454 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
455
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
456 static void oscar_login_connect(gpointer data, gint source, GdkInputCondition cond)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
457 {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
458 struct gaim_connection *gc = data;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
459 struct oscar_data *odata;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
460 struct aim_session_t *sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
461 struct aim_conn_t *conn;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
462
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
463 if (!g_slist_find(connections, gc))
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
464 return;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
465
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
466 odata = gc->proto_data;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
467 sess = odata->sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
468 conn = aim_getconn_type(sess, AIM_CONN_TYPE_AUTH);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
469
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
470 if (source < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
471 hide_login_progress(gc, _("Couldn't connect to host"));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
472 signoff(gc);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
473 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
474 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
475
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
476 if (conn->fd != source)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
477 conn->fd = source;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
478
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
479 aim_request_login(sess, conn, gc->username);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
480
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
481 gc->inpa = gdk_input_add(conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
482 oscar_callback, conn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
483
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
484 debug_printf(_("Password sent, waiting for response\n"));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
485 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
486
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
487 static void oscar_login(struct aim_user *user) {
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
488 struct aim_session_t *sess;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
489 struct aim_conn_t *conn;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
490 char buf[256];
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1086
diff changeset
491 struct gaim_connection *gc = new_gaim_conn(user);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
492 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
1148
0a14a9a844cb [gaim-migrate @ 1158]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1147
diff changeset
493 odata->create_exchange = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
494
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
495 debug_printf(_("Logging in %s\n"), user->username);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
496
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
497 sess = g_new0(struct aim_session_t, 1);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
498
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
499 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
500 aim_setdebuggingcb(sess, oscar_debug);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
501
279
501e09c51cbc [gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 277
diff changeset
502 /* we need an immediate queue because we don't use a while-loop to
501e09c51cbc [gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 277
diff changeset
503 * see if things need to be sent. */
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
504 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
505 odata->sess = sess;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
506 sess->aux_data = gc;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
507
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
508 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
509 if (conn == NULL) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
510 debug_printf(_("internal connection error\n"));
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
511 hide_login_progress(gc, _("Unable to login to AIM"));
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
512 signoff(gc);
980
82c5865f7cfe [gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 975
diff changeset
513 return;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
514 }
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
515
980
82c5865f7cfe [gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 975
diff changeset
516 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
517 set_login_progress(gc, 2, buf);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
518
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
519 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
520 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
521
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
522 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ?
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
523 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
524 user->proto_opt[USEROPT_AUTHPORT][0] ?
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
525 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
526 oscar_login_connect, gc);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
527 if (!user->gc || (conn->fd < 0)) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
528 hide_login_progress(gc, _("Couldn't connect to host"));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
529 signoff(gc);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
530 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
531 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
532 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
533
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
534 static void oscar_close(struct gaim_connection *gc) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
535 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
536 if (gc->protocol != PROTO_OSCAR) return;
1015
c3579d03a0c1 [gaim-migrate @ 1025]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
537
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
538 while (odata->oscar_chats) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
539 struct chat_connection *n = odata->oscar_chats->data;
1667
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1656
diff changeset
540 if (n->inpa > 0)
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1656
diff changeset
541 gdk_input_remove(n->inpa);
1015
c3579d03a0c1 [gaim-migrate @ 1025]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
542 g_free(n->name);
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
543 g_free(n->show);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
544 odata->oscar_chats = g_slist_remove(odata->oscar_chats, n);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
545 g_free(n);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
546 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
547 while (odata->direct_ims) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
548 struct direct_im *n = odata->direct_ims->data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
549 if (n->watcher > 0)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
550 gdk_input_remove(n->watcher);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
551 odata->direct_ims = g_slist_remove(odata->direct_ims, n);
1015
c3579d03a0c1 [gaim-migrate @ 1025]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
552 g_free(n);
c3579d03a0c1 [gaim-migrate @ 1025]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
553 }
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
554 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
555 while (odata->hasicons) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
556 struct icon_req *n = odata->hasicons->data;
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
557 if (n->anim)
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
558 gdk_pixbuf_animation_unref(n->anim);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
559 if (n->unanim)
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
560 gdk_pixbuf_unref(n->unanim);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
561 if (n->timer)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
562 gtk_timeout_remove(n->timer);
1973
1bd70305b227 [gaim-migrate @ 1983]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1959
diff changeset
563 if (n->cnv && n->pix)
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
564 gtk_container_remove(GTK_CONTAINER(n->cnv->bbox), n->pix);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
565 g_free(n->user);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
566 if (n->data)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
567 g_free(n->data);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
568 odata->hasicons = g_slist_remove(odata->hasicons, n);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
569 g_free(n);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
570 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
571 #endif
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
572 if (gc->inpa > 0)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
573 gdk_input_remove(gc->inpa);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
574 if (odata->cnpa > 0)
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
575 gdk_input_remove(odata->cnpa);
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
576 if (odata->paspa > 0)
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
577 gdk_input_remove(odata->paspa);
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
578 aim_session_kill(odata->sess);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
579 g_free(odata->sess);
1633
f47f75819e8c [gaim-migrate @ 1643]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1629
diff changeset
580 odata->sess = NULL;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
581 g_free(gc->proto_data);
1633
f47f75819e8c [gaim-migrate @ 1643]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1629
diff changeset
582 gc->proto_data = NULL;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
583 debug_printf(_("Signed off.\n"));
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
584 }
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
585
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
586 static void oscar_bos_connect(gpointer data, gint source, GdkInputCondition cond) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
587 struct gaim_connection *gc = data;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
588 struct oscar_data *odata;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
589 struct aim_session_t *sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
590 struct aim_conn_t *bosconn;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
591
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
592 if (!g_slist_find(connections, gc))
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
593 return;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
594
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
595 odata = gc->proto_data;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
596 sess = odata->sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
597 bosconn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
598
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
599 if (source < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
600 if (bosconn->priv)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
601 g_free(bosconn->priv);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
602 bosconn->priv = NULL;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
603 hide_login_progress(gc, _("Could Not Connect"));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
604 signoff(gc);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
605 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
606 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
607
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
608 if (bosconn->fd != source)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
609 bosconn->fd = source;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
610
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
611 aim_auth_sendcookie(sess, bosconn, bosconn->priv);
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
612 free(bosconn->priv);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
613 bosconn->priv = NULL;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
614 gc->inpa = gdk_input_add(bosconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
615 oscar_callback, bosconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
616 set_login_progress(gc, 4, _("Connection established, cookie sent"));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
617 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
618
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
619 int gaim_parse_auth_resp(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
620 struct command_rx_struct *command, ...) {
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
621 va_list ap;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
622 struct aim_conn_t *bosconn = NULL;
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
623 char *sn = NULL, *bosip = NULL, *errurl = NULL, *email = NULL;
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
624 unsigned char *cookie = NULL;
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
625 int errorcode = 0, regstatus = 0;
1247
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
626 int latestbuild = 0, latestbetabuild = 0;
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
627 char *latestrelease = NULL, *latestbeta = NULL;
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
628 char *latestreleaseurl = NULL, *latestbetaurl = NULL;
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
629 char *latestreleaseinfo = NULL, *latestbetainfo = NULL;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
630 int i; char *host; int port = FAIM_LOGIN_PORT;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
631 struct aim_user *user;
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
632
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
633 struct gaim_connection *gc = sess->aux_data;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
634 user = gc->user;
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
635
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
636 va_start(ap, command);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
637 sn = va_arg(ap, char *);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
638 errorcode = va_arg(ap, int);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
639 errurl = va_arg(ap, char *);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
640 regstatus = va_arg(ap, int);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
641 email = va_arg(ap, char *);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
642 bosip = va_arg(ap, char *);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
643 cookie = va_arg(ap, unsigned char *);
1247
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
644
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
645 latestrelease = va_arg(ap, char *);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
646 latestbuild = va_arg(ap, int);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
647 latestreleaseurl = va_arg(ap, char *);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
648 latestreleaseinfo = va_arg(ap, char *);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
649
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
650 latestbeta = va_arg(ap, char *);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
651 latestbetabuild = va_arg(ap, int);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
652 latestbetaurl = va_arg(ap, char *);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
653 latestbetainfo = va_arg(ap, char *);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
654
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
655 va_end(ap);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
656
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
657 debug_printf("inside auth_resp (Screen name: %s)\n", sn);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
658
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
659 if (errorcode || !bosip || !cookie) {
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
660 switch (errorcode) {
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
661 case 0x18:
392
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 388
diff changeset
662 /* connecting too frequently */
1038
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
663 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."));
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
664 plugin_event(event_error, (void *)983, 0, 0, 0);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
665 break;
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
666 case 0x05:
392
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 388
diff changeset
667 /* Incorrect nick/password */
1038
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
668 hide_login_progress(gc, _("Incorrect nickname or password."));
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
669 plugin_event(event_error, (void *)980, 0, 0, 0);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
670 break;
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
671 case 0x1c:
392
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 388
diff changeset
672 /* client too old */
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
673 hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE));
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
674 plugin_event(event_error, (void *)989, 0, 0, 0);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
675 break;
1038
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
676 default:
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
677 hide_login_progress(gc, _("Authentication Failed"));
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
678 break;
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
679 }
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
680 debug_printf("Login Error Code 0x%04x\n", errorcode);
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
681 debug_printf("Error URL: %s\n", errurl);
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
682 aim_conn_kill(sess, &command->conn);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
683 signoff(gc);
1796
5728118a8d4c [gaim-migrate @ 1806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
684 return -1;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
685 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
686
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
687
1247
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
688 debug_printf("Reg status: %2d\n", regstatus);
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
689 if (email) {
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
690 debug_printf("Email: %s\n", email);
946
acd4d81f2afc [gaim-migrate @ 956]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 930
diff changeset
691 } else {
1245
2ac6ccb94229 [gaim-migrate @ 1255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1233
diff changeset
692 debug_printf("Email is NULL\n");
946
acd4d81f2afc [gaim-migrate @ 956]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 930
diff changeset
693 }
1247
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
694 debug_printf("BOSIP: %s\n", bosip);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
695 if (latestbeta)
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
696 debug_printf("Latest WinAIM beta version %s, build %d, at %s (%s)\n",
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
697 latestbeta, latestbetabuild, latestbetaurl, latestbetainfo);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
698 if (latestrelease)
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
699 debug_printf("Latest WinAIM released version %s, build %d, at %s (%s)\n",
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
700 latestrelease, latestbuild, latestreleaseurl, latestreleaseinfo);
f50146ce818e [gaim-migrate @ 1257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1246
diff changeset
701 debug_printf("Closing auth connection...\n");
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
702 gdk_input_remove(gc->inpa);
338
9d258a0aa560 [gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 335
diff changeset
703 aim_conn_kill(sess, &command->conn);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
704
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
705 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
706 if (bosconn == NULL) {
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
707 hide_login_progress(gc, _("Internal Error"));
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
708 signoff(gc);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
709 return -1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
710 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
711
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
712 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
713 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0007, gaim_rateresp, 0); /* rate info */
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
714 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
715 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, gaim_server_ready, 0);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
716 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATEINFO, NULL, 0);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
717 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
718 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_STS, AIM_CB_STS_SETREPORTINTERVAL, gaim_reportinterval, 0);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
719 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
720 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
721 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
722 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
723 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
724 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
725 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0);
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
726 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
727 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
728 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
729 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
730 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
731 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
732 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0);
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
733 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0);
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
734 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0);
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
735 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0);
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
736 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
737
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
738 ((struct oscar_data *)gc->proto_data)->conn = bosconn;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
739 for (i = 0; i < (int)strlen(bosip); i++) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
740 if (bosip[i] == ':') {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
741 port = atoi(&(bosip[i+1]));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
742 break;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
743 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
744 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
745 host = g_strndup(bosip, i);
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
746 bosconn->priv = memdup(cookie, AIM_COOKIELEN);
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1871
diff changeset
747 bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
748 g_free(host);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
749 if (!user->gc || (bosconn->fd < 0)) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
750 if (bosconn->priv)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
751 g_free(bosconn->priv);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
752 bosconn->priv = NULL;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
753 hide_login_progress(gc, _("Could Not Connect"));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
754 signoff(gc);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
755 return -1;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
756 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
757 return 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
758 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
759
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
760 struct pieceofcrap {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
761 struct gaim_connection *gc;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
762 unsigned long offset;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
763 unsigned long len;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
764 char *modname;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
765 int fd;
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
766 struct aim_conn_t *conn;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
767 unsigned int inpa;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
768 };
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
769
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
770 static void damn_you(gpointer data, gint source, GdkInputCondition c)
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
771 {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
772 struct pieceofcrap *pos = data;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
773 struct oscar_data *od = pos->gc->proto_data;
1747
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
774 char in = '\0';
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
775 int x = 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
776 char m[17];
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
777
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
778 while (read(pos->fd, &in, 1) == 1) {
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
779 if (in == '\n')
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
780 x++;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
781 else if (in != '\r')
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
782 x = 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
783 if (x == 2)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
784 break;
1747
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
785 in = '\0';
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
786 }
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
787 if (in != '\n') {
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
788 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM."
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
789 " You may be disconnected shortly.", "Login Error");
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
790 gdk_input_remove(pos->inpa);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
791 close(pos->fd);
1747
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
792 g_free(pos);
0763e0d4addd [gaim-migrate @ 1757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
793 return;
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
794 }
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
795 read(pos->fd, m, 16);
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
796 m[16] = '\0';
1830
086213e7fb73 [gaim-migrate @ 1840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1827
diff changeset
797 debug_printf("Sending hash: ");
086213e7fb73 [gaim-migrate @ 1840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1827
diff changeset
798 for (x = 0; x < 16; x++)
086213e7fb73 [gaim-migrate @ 1840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1827
diff changeset
799 debug_printf("%02x ", (unsigned char)m[x]);
086213e7fb73 [gaim-migrate @ 1840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1827
diff changeset
800 debug_printf("\n");
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
801 gdk_input_remove(pos->inpa);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
802 close(pos->fd);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
803 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
804 g_free(pos);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
805 }
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
806
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
807 static void straight_to_hell(gpointer data, gint source, GdkInputCondition cond) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
808 struct pieceofcrap *pos = data;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
809 char buf[BUF_LONG];
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
810
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
811 if (source < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
812 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM."
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
813 " You may be disconnected shortly.", "Login Error");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
814 if (pos->modname)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
815 g_free(pos->modname);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
816 g_free(pos);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
817 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
818 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
819
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
820 if (pos->fd != source)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
821 pos->fd = source;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
822
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
823 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
824 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
825 pos->offset, pos->len, pos->modname ? pos->modname : "");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
826 write(pos->fd, buf, strlen(buf));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
827 if (pos->modname)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
828 g_free(pos->modname);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
829 pos->inpa = gdk_input_add(pos->fd, GDK_INPUT_READ, damn_you, pos);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
830 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
831 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
832
1839
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
833 /* size of icbmui.ocm, the largest module in AIM 3.5 */
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
834 #define AIM_MAX_FILE_SIZE 98304
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
835
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
836 int gaim_memrequest(struct aim_session_t *sess,
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
837 struct command_rx_struct *command, ...) {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
838 va_list ap;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
839 struct pieceofcrap *pos;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
840 unsigned long offset, len;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
841 char *modname;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
842 int fd;
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
843
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
844 va_start(ap, command);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
845 offset = va_arg(ap, unsigned long);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
846 len = va_arg(ap, unsigned long);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
847 modname = va_arg(ap, char *);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
848 va_end(ap);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
849
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
850 debug_printf("offset: %d, len: %d, file: %s\n", offset, len, modname ? modname : "aim.exe");
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
851 if (len == 0) {
1839
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
852 debug_printf("len is 0, hashing NULL\n");
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
853 aim_sendmemblock(sess, command->conn, offset, len, NULL,
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
854 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1810
diff changeset
855 return 1;
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
856 }
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
857 /* uncomment this when you're convinced it's right. remember, it's been wrong before.
1839
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
858 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
859 char *buf;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
860 int i = 8;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
861 if (modname)
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
862 i += strlen(modname);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
863 buf = g_malloc(i);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
864 i = 0;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
865 if (modname) {
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
866 memcpy(buf, modname, strlen(modname));
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
867 i += strlen(modname);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
868 }
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
869 buf[i++] = offset & 0xff;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
870 buf[i++] = (offset >> 8) & 0xff;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
871 buf[i++] = (offset >> 16) & 0xff;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
872 buf[i++] = (offset >> 24) & 0xff;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
873 buf[i++] = len & 0xff;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
874 buf[i++] = (len >> 8) & 0xff;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
875 buf[i++] = (len >> 16) & 0xff;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
876 buf[i++] = (len >> 24) & 0xff;
1839
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
877 debug_printf("len + offset is invalid, hashing request\n");
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
878 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
879 g_free(buf);
1839
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
880 return 1;
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1838
diff changeset
881 }
1852
15a415b5f08c [gaim-migrate @ 1862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1839
diff changeset
882 */
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
883
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
884 pos = g_new0(struct pieceofcrap, 1);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
885 pos->gc = sess->aux_data;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
886 pos->conn = command->conn;
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
887
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
888 pos->offset = offset;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
889 pos->len = len;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
890 pos->modname = modname ? g_strdup(modname) : NULL;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
891
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1871
diff changeset
892 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
893 if (fd < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
894 if (pos->modname)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
895 g_free(pos->modname);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
896 g_free(pos);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
897 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM."
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
898 " You may be disconnected shortly.", "Login Error");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
899 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
900 pos->fd = fd;
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
901
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
902 return 1;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
903 }
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
904
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
905 void some_name(char *buf)
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
906 {
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
907 int x[4];
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
908 x[0] = htonl(0x45576172);
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
909 x[1] = htonl(0x6d656e68);
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
910 x[2] = htonl(0x6f76656e);
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
911 x[3] = 0;
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1810
diff changeset
912 g_snprintf(buf, 16, "%s", (char *)x);
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
913 }
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1667
diff changeset
914
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
915 int gaim_parse_login(struct aim_session_t *sess,
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
916 struct command_rx_struct *command, ...) {
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
917 #if 0
1629
51e8f61ce2c6 [gaim-migrate @ 1639]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1627
diff changeset
918 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
919 #else
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
920 struct client_info_s info = AIM_CLIENTINFO_KNOWNGOOD;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
921 #endif
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 838
diff changeset
922 char *key;
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
923 va_list ap;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
924 struct gaim_connection *gc = sess->aux_data;
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
925
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
926 va_start(ap, command);
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
927 key = va_arg(ap, char *);
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
928 va_end(ap);
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
929
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
930 aim_send_login(sess, command->conn, gc->username, gc->password, &info, key);
747
eec93c5929b9 [gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 746
diff changeset
931 return 1;
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
932 }
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 736
diff changeset
933
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
934 int gaim_server_ready(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
935 struct command_rx_struct *command, ...) {
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
936 static int id = 1;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
937 struct gaim_connection *gc = sess->aux_data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
938 struct oscar_data *od = gc->proto_data;
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
939 struct chat_connection *chatcon;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
940 switch (command->conn->type) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
941 case AIM_CONN_TYPE_AUTH:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
942 aim_auth_setversions(sess, command->conn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
943 aim_bos_reqrate(sess, command->conn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
944 debug_printf("done with AUTH ServerReady\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
945 if (od->chpass) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
946 debug_printf("changing password\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
947 aim_auth_changepasswd(sess, command->conn, od->newp, od->oldp);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
948 g_free(od->oldp);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
949 g_free(od->newp);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
950 od->chpass = FALSE;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
951 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
952 if (od->conf) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
953 debug_printf("confirming account\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
954 aim_auth_reqconfirm(sess, command->conn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
955 od->conf = FALSE;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
956 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
957 if (od->reqemail) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
958 debug_printf("requesting email\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
959 aim_auth_getinfo(sess, command->conn, 0x0011);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
960 od->reqemail = FALSE;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
961 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
962 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
963 case AIM_CONN_TYPE_BOS:
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
964 aim_setversions(sess, command->conn);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
965 aim_bos_reqrate(sess, command->conn); /* request rate info */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
966 debug_printf("done with BOS ServerReady\n");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
967 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
968 case AIM_CONN_TYPE_CHATNAV:
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
969 debug_printf("chatnav: got server ready\n");
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
970 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
971 aim_bos_reqrate(sess, command->conn);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
972 aim_bos_ackrateresp(sess, command->conn);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
973 aim_chatnav_clientready(sess, command->conn);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
974 aim_chatnav_reqrights(sess, command->conn);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
975 break;
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
976 case AIM_CONN_TYPE_CHAT:
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
977 debug_printf("chat: got server ready\n");
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
978 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0);
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
979 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0);
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
980 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0);
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
981 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0);
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
982 aim_bos_reqrate(sess, command->conn);
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
983 aim_bos_ackrateresp(sess, command->conn);
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
984 aim_chat_clientready(sess, command->conn);
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
985 chatcon = find_oscar_chat_by_conn(gc, command->conn);
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
986 chatcon->id = id;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
987 serv_got_joined_chat(gc, id++, chatcon->show);
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
988 break;
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
989 case AIM_CONN_TYPE_RENDEZVOUS:
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
990 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
991 default: /* huh? */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
992 debug_printf("server ready: got unexpected connection type %04x\n", command->conn->type);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
993 break;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
994 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
995 return 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
996 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
997
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
998 static void oscar_chatnav_connect(gpointer data, gint source, GdkInputCondition cond)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
999 {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1000 struct gaim_connection *gc = data;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1001 struct oscar_data *odata;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1002 struct aim_session_t *sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1003 struct aim_conn_t *tstconn;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1004
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1005 if (!g_slist_find(connections, gc))
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1006 return;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1007
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1008 odata = gc->proto_data;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1009 sess = odata->sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1010 tstconn = aim_getconn_type(sess, AIM_CONN_TYPE_CHATNAV);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1011
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1012 if (source < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1013 if (tstconn->priv)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1014 g_free(tstconn->priv);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1015 tstconn->priv = NULL;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1016 aim_conn_kill(sess, &tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1017 debug_printf("unable to connect to chatnav server\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1018 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1019 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1020
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1021 if (tstconn->fd != source)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1022 tstconn->fd = source;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1023
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1024 aim_auth_sendcookie(sess, tstconn, tstconn->priv);
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1025 free(tstconn->priv);
1871
4836d30127df [gaim-migrate @ 1881]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1868
diff changeset
1026 tstconn->priv = NULL;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1027 odata->cnpa = gdk_input_add(tstconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1028 oscar_callback, tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1029 debug_printf("chatnav: connected\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1030 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1031
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1032 static void oscar_auth_connect(gpointer data, gint source, GdkInputCondition cond)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1033 {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1034 struct gaim_connection *gc = data;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1035 struct oscar_data *odata;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1036 struct aim_session_t *sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1037 struct aim_conn_t *tstconn;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1038
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1039 if (!g_slist_find(connections, gc))
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1040 return;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1041
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1042 odata = gc->proto_data;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1043 sess = odata->sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1044 tstconn = aim_getconn_type(sess, AIM_CONN_TYPE_AUTH);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1045
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1046 if (source < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1047 if (tstconn->priv)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1048 g_free(tstconn->priv);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1049 tstconn->priv = NULL;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1050 aim_conn_kill(sess, &tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1051 debug_printf("unable to connect to authorizer\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1052 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1053 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1054
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1055 if (tstconn->fd != source)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1056 tstconn->fd = source;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1057
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1058 aim_auth_sendcookie(sess, tstconn, tstconn->priv);
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1059 free(tstconn->priv);
1871
4836d30127df [gaim-migrate @ 1881]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1868
diff changeset
1060 tstconn->priv = NULL;
1977
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1974
diff changeset
1061 odata->paspa = gdk_input_add(tstconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1062 oscar_callback, tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1063 debug_printf("chatnav: connected\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1064 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1065
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1066 static void oscar_chat_connect(gpointer data, gint source, GdkInputCondition cond)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1067 {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1068 struct chat_connection *ccon = data;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1069 struct gaim_connection *gc = ccon->gc;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1070 struct oscar_data *odata;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1071 struct aim_session_t *sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1072 struct aim_conn_t *tstconn;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1073
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1074 if (!g_slist_find(connections, gc)) {
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1075 g_free(ccon->priv);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1076 g_free(ccon->show);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1077 g_free(ccon->name);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1078 g_free(ccon);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1079 return;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1080 }
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1081
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1082 odata = gc->proto_data;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1083 sess = odata->sess;
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1084 tstconn = ccon->conn;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1085
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1086 if (source < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1087 aim_conn_kill(sess, &tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1088 g_free(ccon->priv);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1089 g_free(ccon->show);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1090 g_free(ccon->name);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1091 g_free(ccon);
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1092 return;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1093 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1094
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1095 if (ccon->fd != source)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1096 ccon->fd = tstconn->fd = source;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1097
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1098 ccon->inpa = gdk_input_add(tstconn->fd,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1099 GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1100 oscar_callback, tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1101 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1102 aim_chat_attachname(tstconn, ccon->name);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1103 aim_auth_sendcookie(sess, tstconn, ccon->priv);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1104 g_free(ccon->priv);
1871
4836d30127df [gaim-migrate @ 1881]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1868
diff changeset
1105 ccon->priv = NULL;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1106 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1107 int gaim_handle_redirect(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1108 struct command_rx_struct *command, ...) {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1109 va_list ap;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1110 int serviceid;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1111 char *ip;
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 838
diff changeset
1112 unsigned char *cookie;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1113 struct gaim_connection *gc = sess->aux_data;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1114 struct aim_conn_t *tstconn;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1115 int i;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1116 char *host; int port = FAIM_LOGIN_PORT, fd;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1117
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1118 va_start(ap, command);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1119 serviceid = va_arg(ap, int);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1120 ip = va_arg(ap, char *);
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 838
diff changeset
1121 cookie = va_arg(ap, unsigned char *);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1122
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1123 for (i = 0; i < (int)strlen(ip); i++) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1124 if (ip[i] == ':') {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1125 port = atoi(&(ip[i+1]));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1126 break;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1127 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1128 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1129 host = g_strndup(ip, i);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1130
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1131 switch(serviceid) {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1132 case 0x7: /* Authorizer */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
1133 debug_printf("Reconnecting with authorizor...\n");
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1134 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1135 if (tstconn == NULL) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
1136 debug_printf("unable to reconnect with authorizer\n");
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1137 g_free(host);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1138 return 1;
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1139 }
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1140 aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, gaim_server_ready, 0);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1141 aim_conn_addhandler(sess, tstconn, 0x0001, 0x0007, gaim_rateresp, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1142 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1143 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1144 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1145
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1146 tstconn->priv = memdup(cookie, AIM_COOKIELEN);
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1871
diff changeset
1147 fd = proxy_connect(host, port, oscar_auth_connect, gc);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1148 if (fd < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1149 if (tstconn->priv)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1150 g_free(tstconn->priv);
1871
4836d30127df [gaim-migrate @ 1881]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1868
diff changeset
1151 tstconn->priv = NULL;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1152 aim_conn_kill(sess, &tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1153 debug_printf("unable to reconnect with authorizer\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1154 g_free(host);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1155 return 1;
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1156 }
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1157 tstconn->fd = fd;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1158 break;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1159 case 0xd: /* ChatNav */
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1160 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1161 if (tstconn == NULL) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1162 debug_printf("unable to connect to chatnav server\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1163 g_free(host);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1164 return 1;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1165 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1166 aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, gaim_server_ready, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1167
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1168 tstconn->priv = memdup(cookie, AIM_COOKIELEN);
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1871
diff changeset
1169 fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1170 if (fd < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1171 if (tstconn->priv)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1172 g_free(tstconn->priv);
1871
4836d30127df [gaim-migrate @ 1881]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1868
diff changeset
1173 tstconn->priv = NULL;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1174 aim_conn_kill(sess, &tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1175 debug_printf("unable to connect to chatnav server\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1176 g_free(host);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1177 return 1;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1178 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1179 tstconn->fd = fd;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1180 break;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1181 case 0xe: /* Chat */
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1182 {
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1183 char *roomname = va_arg(ap, char *);
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
1184 int exchange = va_arg(ap, int);
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
1185 struct chat_connection *ccon;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1186 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1187 if (tstconn == NULL) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
1188 debug_printf("unable to connect to chat server\n");
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1189 g_free(host);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1190 return 1;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1191 }
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1192
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1193 aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, gaim_server_ready, 0);
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
1194 ccon = g_new0(struct chat_connection, 1);
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
1195 ccon->conn = tstconn;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1196 ccon->gc = gc;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1197 ccon->fd = -1;
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
1198 ccon->name = g_strdup(roomname);
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
1199 ccon->exchange = exchange;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
1200 ccon->show = extract_name(roomname);
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
1201
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
1202 ccon->priv = memdup(cookie, AIM_COOKIELEN);
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1871
diff changeset
1203 fd = proxy_connect(host, port, oscar_chat_connect, ccon);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1204 if (fd < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1205 aim_conn_kill(sess, &tstconn);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1206 debug_printf("unable to connect to chat server\n");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1207 g_free(host);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1208 g_free(ccon->priv);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1209 g_free(ccon->show);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1210 g_free(ccon->name);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1211 g_free(ccon);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1212 return 1;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1213 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1214 ccon->fd = tstconn->fd = fd;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1215 debug_printf("Connected to chat room %s exchange %d\n", roomname, exchange);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1216 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1217 break;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1218 default: /* huh? */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
1219 debug_printf("got redirect for unknown service 0x%04x\n", serviceid);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1220 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1221 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1222
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1223 va_end(ap);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1224
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1225 g_free(host);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1226 return 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1227 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1228
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1229 int gaim_parse_oncoming(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1230 struct command_rx_struct *command, ...) {
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1231 struct aim_userinfo_s *info;
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1232 time_t time_idle;
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1233 int type = 0;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1234 struct gaim_connection *gc = sess->aux_data;
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1235
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1236 va_list ap;
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1237 va_start(ap, command);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1238 info = va_arg(ap, struct aim_userinfo_s *);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1239 va_end(ap);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1240
900
e18815f5a4e9 [gaim-migrate @ 910]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 891
diff changeset
1241 if (info->flags & AIM_FLAG_UNCONFIRMED)
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1242 type |= UC_UNCONFIRMED;
900
e18815f5a4e9 [gaim-migrate @ 910]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 891
diff changeset
1243 else if (info->flags & AIM_FLAG_ADMINISTRATOR)
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
1244 type |= UC_ADMIN;
900
e18815f5a4e9 [gaim-migrate @ 910]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 891
diff changeset
1245 else if (info->flags & AIM_FLAG_AOL)
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1246 type |= UC_AOL;
900
e18815f5a4e9 [gaim-migrate @ 910]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 891
diff changeset
1247 else if (info->flags & AIM_FLAG_FREE)
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1248 type |= UC_NORMAL;
900
e18815f5a4e9 [gaim-migrate @ 910]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 891
diff changeset
1249 if (info->flags & AIM_FLAG_AWAY)
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1250 type |= UC_UNAVAILABLE;
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1251
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1252 if (info->idletime) {
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1253 time(&time_idle);
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1254 time_idle -= info->idletime*60;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1255 } else
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1256 time_idle = 0;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1257
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
1258 serv_got_update(gc, info->sn, 1, info->warnlevel/10, info->onlinesince,
513
eaddaa0dbbcb [gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 512
diff changeset
1259 time_idle, type, info->capabilities);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1260
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1261 return 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1262 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1263
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1264 int gaim_parse_offgoing(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1265 struct command_rx_struct *command, ...) {
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
1266 struct aim_userinfo_s *info;
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1267 va_list ap;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1268 struct gaim_connection *gc = sess->aux_data;
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1269
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1270 va_start(ap, command);
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
1271 info = va_arg(ap, struct aim_userinfo_s *);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1272 va_end(ap);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1273
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
1274 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
1275
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1276 return 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1277 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1278
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1279 static void cancel_direct_im(gpointer w, struct ask_direct *d) {
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1280 debug_printf("Freeing DirectIM prompts.\n");
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1281
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1282 g_free(d->sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1283 g_free(d);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1284 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1285
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1286 static void delete_direct_im(gpointer w, struct direct_im *d) {
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1287 struct oscar_data *od = (struct oscar_data *)d->gc->proto_data;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1288
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1289 od->direct_ims = g_slist_remove(od->direct_ims, d);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1290 gdk_input_remove(d->watcher);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1291 aim_conn_kill(od->sess, &d->conn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1292 g_free(d);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1293 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1294
1305
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1295 static void oscar_directim_callback(gpointer data, gint source, GdkInputCondition condition) {
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1296 struct direct_im *dim = data;
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1297 struct gaim_connection *gc = dim->gc;
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1298 struct oscar_data *od = gc->proto_data;
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1299 char buf[256];
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1300
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1301 if (source < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1302 od->direct_ims = g_slist_remove(od->direct_ims, dim);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1303 g_free(dim);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1304 return;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1305 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1306
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1307 if (dim->conn->fd != source)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1308 dim->conn->fd = source;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1309
1305
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1310 if (!(dim->cnv = find_conversation(dim->name))) dim->cnv = new_conversation(dim->name);
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
1311 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name);
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1751
diff changeset
1312 write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL));
1305
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1313
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1314 gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy",
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1315 GTK_SIGNAL_FUNC(delete_direct_im), dim);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1316
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1317 dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1318 oscar_callback, dim->conn);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1319 }
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1320
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1321 static int accept_direct_im(gpointer w, struct ask_direct *d) {
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1322 struct gaim_connection *gc = d->gc;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1323 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1324 struct direct_im *dim;
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1325 char *host; int port = FAIM_LOGIN_PORT;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1326 int i;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1327
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1328 debug_printf("Accepted DirectIM.\n");
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1329
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1330 dim = find_direct_im(od, d->sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1331 if (dim) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1332 cancel_direct_im(w, d); /* 40 */
1092
a930439f29b1 [gaim-migrate @ 1102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
1333 return TRUE;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1334 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1335 dim = g_new0(struct direct_im, 1);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1336 dim->gc = d->gc;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1337 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1338
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1339 if ((dim->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL)) == NULL) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1340 g_free(dim);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1341 cancel_direct_im(w, d);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1342 return TRUE;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1343 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1344 dim->conn->subtype = AIM_CONN_SUBTYPE_OFT_DIRECTIM;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1345 dim->conn->priv = d->priv;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1346 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1347 gaim_directim_incoming, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1348 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMDISCONNECT,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1349 gaim_directim_disconnect, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1350 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING,
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1351 gaim_directim_typing, 0);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1352
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1353 for (i = 0; i < (int)strlen(d->priv->ip); i++) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1354 if (d->priv->ip[i] == ':') {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1355 port = atoi(&(d->priv->ip[i+1]));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1356 break;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1357 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1358 }
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1359 host = g_strndup(d->priv->ip, i);
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1871
diff changeset
1360 dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1361 g_free(host);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1362 if (dim->conn->fd < 0) {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
1363 aim_conn_kill(od->sess, &dim->conn);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1364 g_free(dim);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1365 cancel_direct_im(w, d);
1092
a930439f29b1 [gaim-migrate @ 1102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
1366 return TRUE;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1367 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1368
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1369 od->direct_ims = g_slist_append(od->direct_ims, dim);
1305
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1370
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1371 cancel_direct_im(w, d);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1372
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1373 return TRUE;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1374 }
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1375
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1376 /*
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1377 static void cancel_getfile(gpointer w, struct ask_getfile *g) {
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1378 g_free(g->ip);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1379 g_free(g->cookie);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1380 g_free(g->sn);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1381 g_free(g);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1382 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1383
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1384 static void cancel_getfile_file(GtkObject *obj, struct ask_getfile *g) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1385 GtkWidget *w = gtk_object_get_user_data(obj);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1386 gtk_widget_destroy(w);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1387 cancel_getfile(w, g);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1388 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1389
1246
42ca87108cd1 [gaim-migrate @ 1256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1245
diff changeset
1390 static void cancel_getfile_cancel(GtkObject *obj, struct ask_getfile *g) {
42ca87108cd1 [gaim-migrate @ 1256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1245
diff changeset
1391 GtkWidget *w = gtk_object_get_user_data(obj);
42ca87108cd1 [gaim-migrate @ 1256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1245
diff changeset
1392 gtk_widget_destroy(w);
42ca87108cd1 [gaim-migrate @ 1256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1245
diff changeset
1393 }
42ca87108cd1 [gaim-migrate @ 1256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1245
diff changeset
1394
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1395 static void interrupt_getfile(GtkObject *obj, struct getfile_transfer *gt) {
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1396 struct gaim_connection *gc = gt->gc;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1397 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1398
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1399 gtk_widget_destroy(gt->window);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1400 gdk_input_remove(gt->gip);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1401 if (gt->gop > 0)
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1402 gdk_input_remove(gt->gop);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1403 aim_conn_kill(od->sess, &gt->conn);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1404 od->getfiles = g_slist_remove(od->getfiles, gt);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1405 g_free(gt->receiver);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1406 g_free(gt->filename);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1407 fclose(gt->listing);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1408 g_free(gt);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1409 }
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1410
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1411 static int gaim_getfile_filereq(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1412 struct gaim_connection *gc = sess->aux_data;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1413 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1414 struct getfile_transfer *gt;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1415 char buf[2048];
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1416 GtkWidget *label;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1417 GtkWidget *button;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1418
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1419 va_list ap;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1420 struct aim_conn_t *oftconn;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1421 struct aim_fileheader_t *fh;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1422 char *cookie;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1423
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1424 va_start(ap, command);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1425 oftconn = va_arg(ap, struct aim_conn_t *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1426 fh = va_arg(ap, struct aim_fileheader_t *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1427 cookie = va_arg(ap, char *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1428 va_end(ap);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1429
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1430 gt = find_getfile_transfer(od, oftconn);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1431
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1432 if (gt->window)
1233
728a90516211 [gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1231
diff changeset
1433 return 1;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1434
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1435 gt->window = gtk_dialog_new();
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1436 gtk_window_set_title(GTK_WINDOW(gt->window), _("Gaim - File Transfer"));
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1437 gtk_widget_realize(gt->window);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1438 aol_icon(gt->window->window);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1439
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1440 g_snprintf(buf, sizeof buf, _("Sending %s to %s"), fh->name, gt->receiver);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1441 label = gtk_label_new(buf);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1442 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gt->window)->vbox), label, FALSE, FALSE, 5);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1443 gtk_widget_show(label);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1444
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1445 gt->meter = gtk_progress_bar_new();
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1446 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gt->window)->action_area), gt->meter, FALSE, FALSE, 5);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1447 gtk_widget_show(gt->meter);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1448
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1449 gt->label = gtk_label_new("0 %");
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1450 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gt->window)->action_area), gt->label, FALSE, FALSE, 5);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1451 gtk_widget_show(gt->label);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1452
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1453 button = picture_button(gt->window, _("Cancel"), cancel_xpm);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1454 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gt->window)->action_area), button, FALSE, FALSE, 5);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1455 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(interrupt_getfile), gt);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1456
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1457 gtk_widget_show(gt->window);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1458
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1459 return 1;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1460 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1461
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1462 static void getfile_send_callback(gpointer data, gint source, GdkInputCondition condition) {
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1463 struct getfile_transfer *gt = (struct getfile_transfer *)data;
1188
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1464 int result;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1465
1188
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1466 result = aim_getfile_send_chunk(gt->conn, gt->file, gt->fh, -1, 1024);
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1467 gt->pos += result;
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1468 if (result == 0) {
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1469 gdk_input_remove(gt->gop); gt->gop = 0;
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1470 } else if (result == -1) {
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1471 do_error_dialog(_("Error in transfer"), "Gaim");
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1472 gdk_input_remove(gt->gop); gt->gop = 0;
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1473 interrupt_getfile(NULL, gt);
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1474 }
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1475 }
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1476
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1477 static int gaim_getfile_filesend(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1478 struct gaim_connection *gc = sess->aux_data;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1479 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1480 struct getfile_transfer *gt;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1481
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1482 va_list ap;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1483 struct aim_conn_t *oftconn;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1484 struct aim_fileheader_t *fh;
1233
728a90516211 [gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1231
diff changeset
1485 char *cookie;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1486
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1487 va_start(ap, command);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1488 oftconn = va_arg(ap, struct aim_conn_t *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1489 fh = va_arg(ap, struct aim_fileheader_t *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1490 cookie = va_arg(ap, char *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1491 va_end(ap);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1492
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1493 gt = find_getfile_transfer(od, oftconn);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1494
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1495 if (gt->gop > 0) {
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1496 debug_printf("already have output watcher?\n");
1233
728a90516211 [gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1231
diff changeset
1497 return 1;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1498 }
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1499
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1500 if ((gt->file = fopen(gt->filename, "r")) == NULL) {
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1501 interrupt_getfile(NULL, gt);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1502 return 1;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1503 }
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1504 gt->pos = 0;
1188
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1505 gt->fh = g_memdup(fh, sizeof(struct aim_fileheader_t));
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1506 fseek(gt->file, 0, SEEK_SET);
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1507
1188
004d472be8a3 [gaim-migrate @ 1198]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1186
diff changeset
1508 gt->gop = gdk_input_add(gt->conn->fd, GDK_INPUT_WRITE, getfile_send_callback, gt);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1509
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1510 return 1;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1511 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1512
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1513 static int gaim_getfile_complete(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1514 struct gaim_connection *gc = sess->aux_data;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1515 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1516 struct getfile_transfer *gt;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1517
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1518 va_list ap;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1519 struct aim_conn_t *conn;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1520 struct aim_fileheader_t *fh;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1521
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1522 va_start(ap, command);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1523 conn = va_arg(ap, struct aim_conn_t *);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1524 fh = va_arg(ap, struct aim_fileheader_t *);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1525 va_end(ap);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1526
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1527 gt = find_getfile_transfer(od, conn);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1528
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1529 gtk_widget_destroy(gt->window);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1530 gt->window = NULL;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1531 do_error_dialog(_("Transfer complete."), "Gaim");
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1532
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1533 return 1;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1534 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1535
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1536 static int gaim_getfile_disconnect(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1537 struct gaim_connection *gc = sess->aux_data;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1538 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1539 struct getfile_transfer *gt;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1540
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1541 va_list ap;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1542 struct aim_conn_t *conn;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1543 char *sn;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1544
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1545 va_start(ap, command);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1546 conn = va_arg(ap, struct aim_conn_t *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1547 sn = va_arg(ap, char *);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1548 va_end(ap);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1549
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1550 gt = find_getfile_transfer(od, conn);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1551 od->getfiles = g_slist_remove(od->getfiles, gt);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1552 gdk_input_remove(gt->gip);
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1553 if (gt->gop > 0)
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1554 gdk_input_remove(gt->gop);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1555 g_free(gt->receiver);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1556 g_free(gt->filename);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1557 aim_conn_kill(sess, &conn);
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1558 fclose(gt->listing);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1559 g_free(gt);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1560
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1561 debug_printf("getfile disconnect\n");
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1562
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1563 return 1;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1564 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1565
1305
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1566 static void oscar_getfile_callback(gpointer data, gint source, GdkInputCondition condition) {
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1567 struct getfile_transfer *gf = data;
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1568 struct gaim_connection *gc = gf->gc;
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1569 struct oscar_data *od = gc->proto_data;
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1570
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1571 gdk_input_remove(gf->gip);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1572 gf->gip = gdk_input_add(source, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, gf->conn);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1573
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1574 aim_conn_addhandler(od->sess, gf->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEFILEREQ, gaim_getfile_filereq, 0);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1575 aim_conn_addhandler(od->sess, gf->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEFILESEND, gaim_getfile_filesend, 0);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1576 aim_conn_addhandler(od->sess, gf->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILECOMPLETE, gaim_getfile_complete, 0);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1577 aim_conn_addhandler(od->sess, gf->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEDISCONNECT, gaim_getfile_disconnect, 0);
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1578 }
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1579
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1580 static void do_getfile(GtkObject *obj, struct ask_getfile *g) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1581 GtkWidget *w = gtk_object_get_user_data(obj);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1582 char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(w));
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1583 struct gaim_connection *gc = g->gc;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1584 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1585 struct getfile_transfer *gf;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1586 struct stat st;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1587 struct tm *ft;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1588 char tmppath[256];
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1589 FILE *file;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1590 static int current = 0;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1591 struct aim_conn_t *newconn;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1592
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1593 if (file_is_dir(filename, w))
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1594 return;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1595
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1596 if (stat(filename, &st) != 0) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1597 gtk_widget_destroy(w);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1598 do_error_dialog(_("Error examining file"), _("GetFile Error"));
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1599 cancel_getfile(w, g);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1600 return;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1601 }
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1602
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1603 g_snprintf(tmppath, sizeof tmppath, "/%s/gaim%d%d", g_get_tmp_dir(), getpid(), current++);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1604 if ((file = fopen(tmppath, "w+")) == NULL) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1605 gtk_widget_destroy(w);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1606 do_error_dialog(_("Could not open temporary file, aborting"), _("GetFile Error"));
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1607 cancel_getfile(w, g);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1608 return;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1609 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1610
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1611 gf = g_new0(struct getfile_transfer, 1);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1612 gf->gc = gc;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1613 gf->filename = g_strdup(filename);
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1614 gf->listing = file;
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1615 gf->receiver = g_strdup(g->sn);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1616 gf->size = st.st_size;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1617
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1618 ft = localtime(&st.st_ctime);
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1619 fprintf(file, "%2d/%2d/%4d %2d:%2d %8ld ",
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1620 ft->tm_mon + 1, ft->tm_mday, ft->tm_year + 1900,
1233
728a90516211 [gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1231
diff changeset
1621 ft->tm_hour + 1, ft->tm_min + 1, (long)st.st_size);
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1622 fprintf(file, "%s\r\n", g_basename(filename));
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1623 rewind(file);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1624
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1625 aim_oft_registerlisting(od->sess, file, "");
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1626 if ((newconn = aim_accepttransfer(od->sess, od->conn, g->sn, g->cookie, g->ip, file, AIM_CAPS_GETFILE)) == NULL) {
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1627 od->sess->flags ^= AIM_SESS_FLAGS_NONBLOCKCONNECT;
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1628 do_error_dialog(_("Error connecting for transfer"), _("GetFile Error"));
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1629 g_free(gf->filename);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1630 fclose(file);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1631 g_free(gf);
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1632 gtk_widget_destroy(w);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1633 return;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1634 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1635
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1636 gtk_widget_destroy(w);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1637
1161
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1638 od->getfiles = g_slist_append(od->getfiles, gf);
984cbc219724 [gaim-migrate @ 1171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1156
diff changeset
1639 gf->conn = newconn;
1305
374b6482f904 [gaim-migrate @ 1315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1302
diff changeset
1640 gf->gip = gdk_input_add(newconn->fd, GDK_INPUT_WRITE, oscar_getfile_callback, gf);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1641 }
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1642
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1643 static int accept_getfile(gpointer w, struct ask_getfile *g) {
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1644 GtkWidget *window;
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1645 window = gtk_file_selection_new(_("Gaim - Send File..."));
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1646 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(window));
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1647 gtk_object_set_user_data(GTK_OBJECT(window), window);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1648 gtk_signal_connect(GTK_OBJECT(window), "destroy",
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1649 GTK_SIGNAL_FUNC(cancel_getfile_file), g);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1650 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), window);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1651 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked",
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1652 GTK_SIGNAL_FUNC(do_getfile), g);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1653 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), window);
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1654 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), "clicked",
1246
42ca87108cd1 [gaim-migrate @ 1256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1245
diff changeset
1655 GTK_SIGNAL_FUNC(cancel_getfile_cancel), g);
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1656 gtk_widget_show(window);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1657
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1658 return TRUE;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1659 }
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1660 */
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1661
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
1662 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1663 static gboolean redraw_anim(gpointer data)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1664 {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1665 int delay;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1666 struct icon_req *ir = data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1667 GList *frames;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1668 GdkPixbufFrame *frame;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1669 GdkPixbuf *buf;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1670 GdkPixmap *pm; GdkBitmap *bm;
1932
be30d74bd3a8 [gaim-migrate @ 1942]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1931
diff changeset
1671 GdkPixmap *src;
be30d74bd3a8 [gaim-migrate @ 1942]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1931
diff changeset
1672 GdkGC *gc;
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1673
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1674 if (!ir->cnv || !g_list_find(conversations, ir->cnv)) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1675 debug_printf("I think this is a bug.\n");
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1676 return FALSE;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1677 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1678
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1679 frames = gdk_pixbuf_animation_get_frames(ir->anim);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1680 frame = g_list_nth_data(frames, ir->curframe);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1681 buf = gdk_pixbuf_frame_get_pixbuf(frame);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1682 switch (gdk_pixbuf_frame_get_action(frame)) {
1932
be30d74bd3a8 [gaim-migrate @ 1942]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1931
diff changeset
1683 case GDK_PIXBUF_FRAME_RETAIN:
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1684 gdk_pixbuf_render_pixmap_and_mask(buf, &src, NULL, 0);
1932
be30d74bd3a8 [gaim-migrate @ 1942]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1931
diff changeset
1685 gtk_pixmap_get(GTK_PIXMAP(ir->pix), &pm, &bm);
be30d74bd3a8 [gaim-migrate @ 1942]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1931
diff changeset
1686 gc = gdk_gc_new(pm);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1687 gdk_draw_pixmap(pm, gc, src, 0, 0,
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1688 gdk_pixbuf_frame_get_x_offset(frame),
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1689 gdk_pixbuf_frame_get_y_offset(frame),
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1690 -1, -1);
1931
e86f357ec23d [gaim-migrate @ 1941]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1922
diff changeset
1691 gdk_pixmap_unref(src);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1692 gtk_widget_queue_draw(ir->pix);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1693 gdk_gc_unref(gc);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1694 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1695 case GDK_PIXBUF_FRAME_DISPOSE:
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1696 gdk_pixbuf_render_pixmap_and_mask(buf, &pm, &bm, 0);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1697 gtk_pixmap_set(GTK_PIXMAP(ir->pix), pm, bm);
1932
be30d74bd3a8 [gaim-migrate @ 1942]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1931
diff changeset
1698 gdk_pixmap_unref(pm);
1934
e875b1cb2470 [gaim-migrate @ 1944]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1933
diff changeset
1699 if (bm)
e875b1cb2470 [gaim-migrate @ 1944]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1933
diff changeset
1700 gdk_bitmap_unref(bm);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1701 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1702 case GDK_PIXBUF_FRAME_REVERT:
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1703 frame = frames->data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1704 buf = gdk_pixbuf_frame_get_pixbuf(frame);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1705 gdk_pixbuf_render_pixmap_and_mask(buf, &pm, &bm, 0);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1706 gtk_pixmap_set(GTK_PIXMAP(ir->pix), pm, bm);
1932
be30d74bd3a8 [gaim-migrate @ 1942]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1931
diff changeset
1707 gdk_pixmap_unref(pm);
1934
e875b1cb2470 [gaim-migrate @ 1944]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1933
diff changeset
1708 if (bm)
e875b1cb2470 [gaim-migrate @ 1944]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1933
diff changeset
1709 gdk_bitmap_unref(bm);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1710 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1711 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1712 ir->curframe = (ir->curframe + 1) % g_list_length(frames);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1713 delay = gdk_pixbuf_frame_get_delay_time(frame);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1714 ir->timer = gtk_timeout_add(delay * 10, redraw_anim, ir);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1715 return FALSE;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1716 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1717 #endif
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1718
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1719 int gaim_parse_incoming_im(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1720 struct command_rx_struct *command, ...) {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1721 int channel;
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1722 struct aim_userinfo_s *userinfo;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1723 va_list ap;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1724 struct gaim_connection *gc = sess->aux_data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1725
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1726 va_start(ap, command);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1727 channel = va_arg(ap, int);
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1728 userinfo = va_arg(ap, struct aim_userinfo_s *);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1729
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1730 /* channel 1: standard message */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1731 if (channel == 1) {
744
f53e8f48628d [gaim-migrate @ 754]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 741
diff changeset
1732 char *tmp = g_malloc(BUF_LONG);
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1733 struct aim_incomingim_ch1_args *args;
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1734
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1735 args = va_arg(ap, struct aim_incomingim_ch1_args *);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1736 va_end(ap);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1737
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
1738 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1739 if (args->icbmflags & AIM_IMFLAGS_HASICON) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1740 struct oscar_data *od = gc->proto_data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1741 struct icon_req *ir;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1742 GSList *h = od->hasicons;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1743 char *who = normalize(userinfo->sn);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1744 debug_printf("%s has an icon\n", userinfo->sn);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1745 while (h) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1746 ir = h->data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1747 if (!strcmp(ir->user, who))
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1748 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1749 h = h->next;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1750 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1751 if (!h) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1752 ir = g_new0(struct icon_req, 1);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1753 ir->user = g_strdup(who);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1754 od->hasicons = g_slist_append(od->hasicons, ir);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1755 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1756 if (args->iconstamp > ir->timestamp)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1757 ir->request = TRUE;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1758 ir->timestamp = args->iconstamp;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1759 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1760 #endif
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1761
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1762 g_snprintf(tmp, BUF_LONG, "%s", args->msg);
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1763 serv_got_im(gc, userinfo->sn, tmp, args->icbmflags & AIM_IMFLAGS_AWAY, time(NULL));
744
f53e8f48628d [gaim-migrate @ 754]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 741
diff changeset
1764 g_free(tmp);
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 250
diff changeset
1765 } else if (channel == 2) {
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1766 struct aim_incomingim_ch2_args *args;
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1767 args = va_arg(ap, struct aim_incomingim_ch2_args *);
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1768 va_end(ap);
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1769 if (args->reqclass & AIM_CAPS_CHAT) {
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1770 serv_got_chat_invite(gc,
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1771 args->info.chat.roominfo.name,
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1772 args->info.chat.roominfo.exchange,
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 250
diff changeset
1773 userinfo->sn,
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1774 args->info.chat.msg);
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1775 } else if (args->reqclass & AIM_CAPS_SENDFILE) {
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1776 } else if (args->reqclass & AIM_CAPS_GETFILE) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1777 /*
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1778 char *ip, *cookie;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1779 struct ask_getfile *g = g_new0(struct ask_getfile, 1);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1780 char buf[256];
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1781
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1782 userinfo = va_arg(ap, struct aim_userinfo_s *);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1783 ip = va_arg(ap, char *);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1784 cookie = va_arg(ap, char *);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1785 va_end(ap);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1786
1156
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1787 debug_printf("%s received getfile request from %s (%s), cookie = %s\n",
b6b2d26a4e2f [gaim-migrate @ 1166]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
1788 gc->username, userinfo->sn, ip, cookie);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1789
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1790 g->gc = gc;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1791 g->sn = g_strdup(userinfo->sn);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1792 g->cookie = g_strdup(cookie);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1793 g->ip = g_strdup(ip);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1794 g_snprintf(buf, sizeof buf, "%s has just asked to get a file from %s.",
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1795 userinfo->sn, gc->username);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1796 do_ask_dialog(buf, g, accept_getfile, cancel_getfile);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
1797 */
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1798 } else if (args->reqclass & AIM_CAPS_VOICE) {
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1799 } else if (args->reqclass & AIM_CAPS_BUDDYICON) {
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
1800 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1801 struct oscar_data *od = gc->proto_data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1802 GSList *h = od->hasicons;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1803 struct icon_req *ir = NULL;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1804 char *who;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1805 struct conversation *c;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1806
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1807 GdkPixbufLoader *load;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1808 GList *frames;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1809 GdkPixbuf *buf;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1810 GdkPixmap *pm;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1811 GdkBitmap *bm;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1812
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1813 who = normalize(userinfo->sn);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1814
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1815 while (h) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1816 ir = h->data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1817 if (!strcmp(who, ir->user))
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1818 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1819 h = h->next;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1820
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1821 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1822
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1823 if (!h || ((c = find_conversation(userinfo->sn)) == NULL) || (c->gc != gc)) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1824 debug_printf("got buddy icon for %s but didn't want it\n", userinfo->sn);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1825 return 1;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1826 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1827
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1828 if (ir->pix && ir->cnv)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1829 gtk_container_remove(GTK_CONTAINER(ir->cnv->bbox), ir->pix);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1830 ir->pix = NULL;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1831 ir->cnv = NULL;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1832 if (ir->data)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1833 g_free(ir->data);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1834 if (ir->anim)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1835 gdk_pixbuf_animation_unref(ir->anim);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1836 ir->anim = NULL;
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1837 if (ir->unanim)
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1838 gdk_pixbuf_unref(ir->unanim);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1839 ir->unanim = NULL;
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1840 if (ir->timer)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1841 gtk_timeout_remove(ir->timer);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1842 ir->timer = 0;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1843
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1844 ir->length = args->info.icon.length;
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1845
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1846 if (!ir->length)
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1847 return 1;
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1848
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1849 ir->data = g_memdup(args->info.icon.icon, args->info.icon.length);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1850
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1851 load = gdk_pixbuf_loader_new();
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1852 gdk_pixbuf_loader_write(load, ir->data, ir->length);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1853 ir->anim = gdk_pixbuf_loader_get_animation(load);
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1854
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1855 if (ir->anim) {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1856 frames = gdk_pixbuf_animation_get_frames(ir->anim);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1857 buf = gdk_pixbuf_frame_get_pixbuf(frames->data);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1858 gdk_pixbuf_render_pixmap_and_mask(buf, &pm, &bm, 0);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1859
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1860 if (gdk_pixbuf_animation_get_num_frames(ir->anim) > 1) {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1861 int delay = gdk_pixbuf_frame_get_delay_time(frames->data);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1862 ir->curframe = 1;
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1863 ir->timer = gtk_timeout_add(delay * 10, redraw_anim, ir);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1864 }
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1865 } else {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1866 ir->unanim = gdk_pixbuf_loader_get_pixbuf(load);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1867 if (!ir->unanim) {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1868 gdk_pixbuf_loader_close(load);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1869 return 1;
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1870 }
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1871 gdk_pixbuf_render_pixmap_and_mask(ir->unanim, &pm, &bm, 0);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1872 }
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1873
1973
1bd70305b227 [gaim-migrate @ 1983]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1959
diff changeset
1874 ir->cnv = c;
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1875 ir->pix = gtk_pixmap_new(pm, bm);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1876 gtk_box_pack_start(GTK_BOX(c->bbox), ir->pix, FALSE, FALSE, 5);
1922
07ceb54dc96a [gaim-migrate @ 1932]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1910
diff changeset
1877 if (ir->anim && (gdk_pixbuf_animation_get_num_frames(ir->anim) > 1))
07ceb54dc96a [gaim-migrate @ 1932]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1910
diff changeset
1878 gtk_widget_set_usize(ir->pix, gdk_pixbuf_animation_get_width(ir->anim),
07ceb54dc96a [gaim-migrate @ 1932]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1910
diff changeset
1879 gdk_pixbuf_animation_get_height(ir->anim));
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1880 gtk_widget_show(ir->pix);
1931
e86f357ec23d [gaim-migrate @ 1941]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1922
diff changeset
1881 gdk_pixmap_unref(pm);
1933
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
1882 if (bm)
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
1883 gdk_bitmap_unref(bm);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1884
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1885 gdk_pixbuf_loader_close(load);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
1886
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
1887 #endif
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1888 } else if (args->reqclass & AIM_CAPS_IMIMAGE) {
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1889 struct ask_direct *d = g_new0(struct ask_direct, 1);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1890 char buf[256];
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1891
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1892 debug_printf("%s received direct im request from %s (%s)\n",
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1893 gc->username, userinfo->sn, args->info.directim->ip);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1894
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1895 d->gc = gc;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1896 d->sn = g_strdup(userinfo->sn);
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1897 d->priv = args->info.directim;
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1898 g_snprintf(buf, sizeof buf, "%s has just asked to directly connect to %s.",
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1899 userinfo->sn, gc->username);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
1900 do_ask_dialog(buf, d, accept_direct_im, cancel_direct_im);
283
0f14e6d8a51b [gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 282
diff changeset
1901 } else {
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
1902 debug_printf("Unknown reqclass %d\n", args->reqclass);
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 250
diff changeset
1903 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1904 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1905
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1906 return 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1907 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1908
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1909 int gaim_parse_misses(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1910 struct command_rx_struct *command, ...) {
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1911 va_list ap;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1912 u_short chan, nummissed, reason;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1913 struct aim_userinfo_s *userinfo;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1914 char buf[1024];
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1915
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1916 va_start(ap, command);
838
7714587cd1f9 [gaim-migrate @ 848]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 836
diff changeset
1917 chan = (u_short)va_arg(ap, u_int);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1918 userinfo = va_arg(ap, struct aim_userinfo_s *);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1919 nummissed = (u_short)va_arg(ap, u_int);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1920 reason = (u_short)va_arg(ap, u_int);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1921 va_end(ap);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1922
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1923 switch(reason) {
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1924 case 1:
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1925 /* message too large */
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1926 sprintf(buf, _("You missed a message from %s because it was too large."), userinfo->sn);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1927 do_error_dialog(buf, _("Gaim - Error"));
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1928 plugin_event(event_error, (void *)961, 0, 0, 0);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1929 break;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1930 default:
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1931 sprintf(buf, _("You missed a message from %s for unknown reasons."), userinfo->sn);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1932 do_error_dialog(buf, _("Gaim - Error"));
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1933 plugin_event(event_error, (void *)970, 0, 0, 0);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1934 break;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1935 }
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1936
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1937 return 1;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1938 }
709
957957d0dc2c [gaim-migrate @ 719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 704
diff changeset
1939
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1940 int gaim_parse_genericerr(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1941 va_list ap;
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1942 unsigned short reason;
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1943
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1944 va_start(ap, command);
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1945 reason = va_arg(ap, int);
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1946 va_end(ap);
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1947
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1948 debug_printf("snac threw error (reason 0x%04x: %s\n", reason,
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1949 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1950
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1951 return 1;
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1952 }
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
1953
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1954 int gaim_parse_msgerr(struct aim_session_t *sess,
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1955 struct command_rx_struct *command, ...) {
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1956 va_list ap;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1957 char *destn;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1958 u_short reason;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1959 char buf[1024];
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1960
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1961 va_start(ap, command);
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
1962 reason = (u_short)va_arg(ap, u_int);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1963 destn = va_arg(ap, char *);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1964 va_end(ap);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1965
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1966 sprintf(buf, _("Your message to %s did not get sent: %s"), destn,
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1967 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1968 do_error_dialog(buf, _("Gaim - Error"));
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1969
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1970 return 1;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1971 }
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1972
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1973 int gaim_parse_locerr(struct aim_session_t *sess,
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1974 struct command_rx_struct *command, ...) {
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1975 va_list ap;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1976 char *destn;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1977 u_short reason;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1978 char buf[1024];
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1979
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1980 va_start(ap, command);
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
1981 reason = (u_short)va_arg(ap, u_int);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1982 destn = va_arg(ap, char *);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1983 va_end(ap);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1984
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1985 sprintf(buf, _("User information for %s unavailable: %s"), destn,
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1986 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
1987 do_error_dialog(buf, _("Gaim - Error"));
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
1988
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1989 return 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1990 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
1991
1537
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1992 static char *images(int flags) {
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1993 static char buf[1024];
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1994 g_snprintf(buf, sizeof(buf), "%s%s%s%s",
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1995 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "",
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1996 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "",
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1997 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "",
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1998 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "");
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
1999 return buf;
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
2000 }
2157d91c2eb9 [gaim-migrate @ 1547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1535
diff changeset
2001
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2002 int gaim_parse_user_info(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2003 struct command_rx_struct *command, ...) {
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2004 struct aim_userinfo_s *info;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2005 char *prof_enc = NULL, *prof = NULL;
249
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
2006 u_short infotype;
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
2007 char buf[BUF_LONG];
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2008 struct gaim_connection *gc = sess->aux_data;
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
2009 va_list ap;
1837
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2010 char *asc;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2011
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2012 va_start(ap, command);
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2013 info = va_arg(ap, struct aim_userinfo_s *);
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2014 prof_enc = va_arg(ap, char *);
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2015 prof = va_arg(ap, char *);
464
4966003f2c9b [gaim-migrate @ 474]
Rob Flynn <gaim@robflynn.com>
parents: 446
diff changeset
2016 infotype = (u_short)va_arg(ap, u_int);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2017 va_end(ap);
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
2018
1838
bee2239f5952 [gaim-migrate @ 1848]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1837
diff changeset
2019 if (info->membersince)
1931
e86f357ec23d [gaim-migrate @ 1941]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1922
diff changeset
2020 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n",
1838
bee2239f5952 [gaim-migrate @ 1848]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1837
diff changeset
2021 asctime(localtime(&info->membersince)));
bee2239f5952 [gaim-migrate @ 1848]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1837
diff changeset
2022 else
bee2239f5952 [gaim-migrate @ 1848]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1837
diff changeset
2023 asc = g_strdup("");
1837
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2024
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2025 g_snprintf(buf, sizeof buf,
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2026 _("Username : <B>%s</B> %s <BR>\n"
1838
bee2239f5952 [gaim-migrate @ 1848]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1837
diff changeset
2027 "%s"
1837
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2028 "Warning Level : <B>%d %%</B><BR>\n"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2029 "Online Since : <B>%s</B><BR>\n"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2030 "Idle Minutes : <B>%d</B>\n<BR>\n<HR><BR>\n"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2031 "%s"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2032 "<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2033 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2034 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2035 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>"
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2036 "<IMG SRC=\"admin_icon.gif\"> : Administrator"),
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2037 info->sn, images(info->flags),
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2038 asc,
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2039 info->warnlevel/10,
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2040 asctime(localtime(&info->onlinesince)),
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2041 info->idletime,
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2042 (prof && strlen(prof)) ?
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2043 (infotype == AIM_GETINFO_GENERALINFO ?
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2044 prof :
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2045 away_subs(prof, gc->username))
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2046 :
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2047 (infotype == AIM_GETINFO_GENERALINFO ?
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2048 _("<i>No Information Provided</i>") :
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2049 _("<i>User has no away message</i>")));
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2050
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
2051 g_show_info_text(away_subs(buf, gc->username));
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
2052
1837
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2053 g_free(asc);
31f7780b72b8 [gaim-migrate @ 1847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1830
diff changeset
2054
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2055 return 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2056 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2057
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2058 int gaim_parse_motd(struct aim_session_t *sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2059 struct command_rx_struct *command, ...) {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2060 char *msg;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2061 u_short id;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2062 va_list ap;
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
2063 char buildbuf[150];
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2064
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2065 va_start(ap, command);
464
4966003f2c9b [gaim-migrate @ 474]
Rob Flynn <gaim@robflynn.com>
parents: 446
diff changeset
2066 id = (u_short)va_arg(ap, u_int);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2067 msg = va_arg(ap, char *);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2068 va_end(ap);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2069
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
2070 aim_getbuildstring(buildbuf, sizeof(buildbuf));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
2071
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2072 debug_printf("MOTD: %s (%d)\n", msg, id);
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1643
diff changeset
2073 debug_printf("Gaim %s / Libfaim %s\n", VERSION, buildbuf);
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2074 if (id != 4)
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2075 do_error_dialog(_("Your connection may be lost."),
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2076 _("AOL error"));
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2077
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2078 return 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2079 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
2080
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
2081 int gaim_chatnav_info(struct aim_session_t *sess,
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
2082 struct command_rx_struct *command, ...) {
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
2083 va_list ap;
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
2084 u_short type;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2085 struct gaim_connection *gc = sess->aux_data;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2086 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
2087
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
2088 va_start(ap, command);
464
4966003f2c9b [gaim-migrate @ 474]
Rob Flynn <gaim@robflynn.com>
parents: 446
diff changeset
2089 type = (u_short)va_arg(ap, u_int);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2090
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2091 switch(type) {
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2092 case 0x0002: {
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2093 int maxrooms;
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2094 struct aim_chat_exchangeinfo *exchanges;
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2095 int exchangecount, i = 0;
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2096
466
b5c2359d633e [gaim-migrate @ 476]
Rob Flynn <gaim@robflynn.com>
parents: 464
diff changeset
2097 maxrooms = (u_char)va_arg(ap, u_int);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2098 exchangecount = va_arg(ap, int);
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2099 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2100 va_end(ap);
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2101
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2102 debug_printf("chat info: Chat Rights:\n");
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2103 debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2104 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount);
1148
0a14a9a844cb [gaim-migrate @ 1158]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1147
diff changeset
2105 while (i < exchangecount)
0a14a9a844cb [gaim-migrate @ 1158]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1147
diff changeset
2106 debug_printf("chat info: \t\t%d\n", exchanges[i++].number);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2107 if (odata->create_exchange) {
1149
22bf2c3ec2e3 [gaim-migrate @ 1159]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1148
diff changeset
2108 debug_printf("creating room %s\n", odata->create_name);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2109 aim_chatnav_createroom(sess, command->conn, odata->create_name,
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2110 odata->create_exchange);
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2111 odata->create_exchange = 0;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2112 g_free(odata->create_name);
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2113 odata->create_name = NULL;
904
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2114 }
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2115 }
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2116 break;
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2117 case 0x0008: {
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2118 char *fqcn, *name, *ck;
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2119 u_short instance, flags, maxmsglen, maxoccupancy, unknown, exchange;
904
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2120 unsigned char createperms;
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2121 unsigned long createtime;
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2122
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2123 fqcn = va_arg(ap, char *);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2124 instance = (u_short)va_arg(ap, u_int);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2125 exchange = (u_short)va_arg(ap, u_int);
904
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2126 flags = (u_short)va_arg(ap, u_int);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2127 createtime = va_arg(ap, unsigned long);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2128 maxmsglen = (u_short)va_arg(ap, u_int);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2129 maxoccupancy = (u_short)va_arg(ap, u_int);
906
7b976e5e1c3a [gaim-migrate @ 916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
2130 createperms = (unsigned char)va_arg(ap, int);
904
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2131 unknown = (u_short)va_arg(ap, u_int);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2132 name = va_arg(ap, char *);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2133 ck = va_arg(ap, char *);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2134 va_end(ap);
e1a7fc4482b9 [gaim-migrate @ 914]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 900
diff changeset
2135
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2136 debug_printf("created room: %s %d %d %d %lu %d %d %d %d %s %s\n",
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2137 fqcn,
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2138 exchange, instance, flags,
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2139 createtime,
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2140 maxmsglen, maxoccupancy, createperms, unknown,
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2141 name, ck);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1188
diff changeset
2142 aim_chat_join(odata->sess, odata->conn, exchange, ck);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2143 }
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2144 break;
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2145 default:
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2146 va_end(ap);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2147 debug_printf("chatnav info: unknown type (%04x)\n", type);
302
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2148 break;
61894ab8c47e [gaim-migrate @ 312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 288
diff changeset
2149 }
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
2150 return 1;
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
2151 }
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2152
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2153 int gaim_chat_join(struct aim_session_t *sess,
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2154 struct command_rx_struct *command, ...) {
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2155 va_list ap;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2156 int count, i = 0;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2157 struct aim_userinfo_s *info;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2158 struct gaim_connection *g = sess->aux_data;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2159
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
2160 GSList *bcs = g->buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 466
diff changeset
2161 struct conversation *b = NULL;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2162 struct chat_connection *c = NULL;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2163
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2164 va_start(ap, command);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2165 count = va_arg(ap, int);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2166 info = va_arg(ap, struct aim_userinfo_s *);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2167 va_end(ap);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2168
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2169 c = find_oscar_chat_by_conn(g, command->conn);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2170 if (!c)
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2171 return 1;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2172
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2173 while (bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 466
diff changeset
2174 b = (struct conversation *)bcs->data;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2175 if (!strcasecmp(b->name, c->show))
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2176 break;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2177 bcs = bcs->next;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2178 b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2179 }
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2180 if (!b)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2181 return 1;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2182
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2183 while (i < count)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2184 add_chat_buddy(b, info[i++].sn);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2185
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2186 return 1;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2187 }
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2188
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2189 int gaim_chat_leave(struct aim_session_t *sess,
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2190 struct command_rx_struct *command, ...) {
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2191 va_list ap;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2192 int count, i = 0;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2193 struct aim_userinfo_s *info;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2194 struct gaim_connection *g = sess->aux_data;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2195
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
2196 GSList *bcs = g->buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 466
diff changeset
2197 struct conversation *b = NULL;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2198 struct chat_connection *c = NULL;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2199
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2200 va_start(ap, command);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2201 count = va_arg(ap, int);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2202 info = va_arg(ap, struct aim_userinfo_s *);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2203 va_end(ap);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2204
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2205 c = find_oscar_chat_by_conn(g, command->conn);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2206 if (!c)
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2207 return 1;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2208
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2209 while (bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 466
diff changeset
2210 b = (struct conversation *)bcs->data;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2211 if (!strcasecmp(b->name, c->show))
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2212 break;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2213 bcs = bcs->next;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2214 b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2215 }
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2216 if (!b)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2217 return 1;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2218
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2219 while (i < count)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2220 remove_chat_buddy(b, info[i++].sn);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2221
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2222 return 1;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2223 }
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2224
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2225 int gaim_chat_info_update(struct aim_session_t *sess,
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2226 struct command_rx_struct *command, ...) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2227 debug_printf("inside chat_info_update\n");
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2228 return 1;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2229 }
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2230
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2231 int gaim_chat_incoming_msg(struct aim_session_t *sess,
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2232 struct command_rx_struct *command, ...) {
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2233 va_list ap;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2234 struct aim_userinfo_s *info;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2235 char *msg;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2236 struct gaim_connection *gc = sess->aux_data;
1643
d7e380618fd5 [gaim-migrate @ 1653]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1635
diff changeset
2237 char *tmp;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2238
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
2239 GSList *bcs = gc->buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 466
diff changeset
2240 struct conversation *b = NULL;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2241
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2242 va_start(ap, command);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2243 info = va_arg(ap, struct aim_userinfo_s *);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2244 msg = va_arg(ap, char *);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2245
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2246 while(bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 466
diff changeset
2247 b = (struct conversation *)bcs->data;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2248 tmp = extract_name(command->conn->priv);
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2249 if (!strcasecmp(b->name, tmp)) {
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2250 g_free(tmp);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2251 break;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2252 }
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2253 g_free(tmp);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2254 bcs = bcs->next;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2255 b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2256 }
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2257 if (!b)
270
cfa39d39dec6 [gaim-migrate @ 280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 267
diff changeset
2258 return 0;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2259
1643
d7e380618fd5 [gaim-migrate @ 1653]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1635
diff changeset
2260 tmp = g_malloc(BUF_LONG);
d7e380618fd5 [gaim-migrate @ 1653]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1635
diff changeset
2261 g_snprintf(tmp, BUF_LONG, "%s", msg);
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1751
diff changeset
2262 serv_got_chat_in(gc, b->id, info->sn, 0, tmp, time((time_t)NULL));
1643
d7e380618fd5 [gaim-migrate @ 1653]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1635
diff changeset
2263 g_free(tmp);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
2264
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2265 return 1;
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
2266 }
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2267
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2268 /*
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2269 * Recieved in response to an IM sent with the AIM_IMFLAGS_ACK option.
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2270 */
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2271 int gaim_parse_msgack(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2272 va_list ap;
505
3bd51b3f07c3 [gaim-migrate @ 515]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 503
diff changeset
2273 u_short type;
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2274 char *sn = NULL;
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2275
505
3bd51b3f07c3 [gaim-migrate @ 515]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 503
diff changeset
2276 va_start(ap, command);
3bd51b3f07c3 [gaim-migrate @ 515]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 503
diff changeset
2277 type = (u_short)va_arg(ap, u_int);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2278 sn = va_arg(ap, char *);
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2279 va_end(ap);
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2280
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2281 debug_printf("Sent message to %s.\n", sn);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2282
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2283 return 1;
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2284 }
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2285
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2286 int gaim_parse_ratechange(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1288
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2287 static char *codes[5] = {"invalid",
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2288 "change",
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2289 "warning",
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2290 "limit",
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2291 "limit cleared"};
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2292 va_list ap;
1288
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2293 int code;
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2294 unsigned long rateclass, windowsize, clear, alert, limit, disconnect;
1288
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2295 unsigned long currentavg, maxavg;
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2296
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2297 va_start(ap, command);
1288
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2298 code = va_arg(ap, int);
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2299 rateclass= va_arg(ap, int);
1288
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2300 windowsize = va_arg(ap, unsigned long);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2301 clear = va_arg(ap, unsigned long);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2302 alert = va_arg(ap, unsigned long);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2303 limit = va_arg(ap, unsigned long);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2304 disconnect = va_arg(ap, unsigned long);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2305 currentavg = va_arg(ap, unsigned long);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2306 maxavg = va_arg(ap, unsigned long);
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2307 va_end(ap);
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2308
1288
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2309 debug_printf("rate %s (paramid 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, "
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2310 "clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n",
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2311 (code < 5) ? codes[code] : codes[0],
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2312 rateclass,
1288
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2313 currentavg, maxavg,
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2314 alert, clear,
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2315 limit, disconnect,
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2316 windowsize);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2317
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2318 if (code == AIM_RATE_CODE_CHANGE) {
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2319 if (currentavg >= clear)
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2320 aim_conn_setlatency(command->conn, 0);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2321 } else if (code == AIM_RATE_CODE_WARNING) {
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2322 aim_conn_setlatency(command->conn, windowsize/4);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2323 } else if (code == AIM_RATE_CODE_LIMIT) {
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2324 aim_conn_setlatency(command->conn, windowsize/2);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2325 } else if (code == AIM_RATE_CODE_CLEARLIMIT) {
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2326 aim_conn_setlatency(command->conn, 0);
d8eaf65ca9c3 [gaim-migrate @ 1298]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2327 }
503
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2328
6e318907bcce [gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2329 return 1;
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 838
diff changeset
2330 }
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 505
diff changeset
2331
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2332 int gaim_parse_evilnotify(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2333 va_list ap;
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2334 int newevil;
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2335 struct aim_userinfo_s *userinfo;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2336 struct gaim_connection *gc = sess->aux_data;
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2337
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2338 va_start(ap, command);
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2339 newevil = va_arg(ap, int);
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2340 userinfo = va_arg(ap, struct aim_userinfo_s *);
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2341 va_end(ap);
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2342
1302
4c5c2fcb83cd [gaim-migrate @ 1312]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1288
diff changeset
2343 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, newevil / 10);
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2344
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2345 return 1;
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2346 }
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 747
diff changeset
2347
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2348 int gaim_rateresp(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2349 struct gaim_connection *gc = sess->aux_data;
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2350 switch (command->conn->type) {
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2351 case AIM_CONN_TYPE_BOS:
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2352 aim_bos_ackrateresp(sess, command->conn);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2353 aim_bos_reqpersonalinfo(sess, command->conn);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2354 aim_bos_reqlocaterights(sess, command->conn);
1051
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
2355 aim_bos_setprofile(sess, command->conn, gc->user->user_info, NULL, gaim_caps);
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2356 aim_bos_reqbuddyrights(sess, command->conn);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2357
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1086
diff changeset
2358 account_online(gc);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
2359 serv_finish_login(gc);
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2360
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
2361 if (bud_list_cache_exists(gc))
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 946
diff changeset
2362 do_import(NULL, gc);
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2363
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2364 debug_printf("buddy list loaded\n");
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2365
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2366 aim_addicbmparam(sess, command->conn);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2367 aim_bos_reqicbmparaminfo(sess, command->conn);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2368
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2369 aim_bos_reqrights(sess, command->conn);
900
e18815f5a4e9 [gaim-migrate @ 910]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 891
diff changeset
2370 aim_bos_setgroupperm(sess, command->conn, AIM_FLAG_ALLUSERS);
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2371 aim_bos_setprivacyflags(sess, command->conn, AIM_PRIVFLAGS_ALLOWIDLE |
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2372 AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2373
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2374 break;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2375 case AIM_CONN_TYPE_AUTH:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2376 aim_bos_ackrateresp(sess, command->conn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2377 aim_auth_clientready(sess, command->conn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2378 debug_printf("connected to auth (admin)\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2379 break;
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2380 default:
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2381 debug_printf("got rate response for unhandled connection type %04x\n",
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2382 command->conn->type);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2383 break;
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2384 }
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2385
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2386 return 1;
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2387 }
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2388
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2389 int gaim_reportinterval(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2390 if (command->data) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2391 debug_printf("minimum report interval: %d (seconds?)\n", aimutil_get16(command->data+10));
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2392 } else
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2393 debug_printf("NULL minimum report interval!\n");
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2394 return 1;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2395 }
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2396
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2397 int gaim_parse_buddyrights(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2398 va_list ap;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2399 u_short maxbuddies, maxwatchers;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2400
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2401 va_start(ap, command);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2402 maxbuddies = (u_short)va_arg(ap, u_int);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2403 maxwatchers = (u_short)va_arg(ap, u_int);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2404 va_end(ap);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2405
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2406 debug_printf("buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2407
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2408 return 1;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2409 }
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2410
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2411 int gaim_bosrights(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2412 u_short maxpermits, maxdenies;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2413 va_list ap;
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2414
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2415 va_start(ap, command);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2416 maxpermits = (u_short)va_arg(ap, u_int);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2417 maxdenies = (u_short)va_arg(ap, u_int);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2418 va_end(ap);
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2419
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2420 debug_printf("BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies);
836
15d005f8baaf [gaim-migrate @ 846]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 834
diff changeset
2421
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2422 aim_bos_clientready(sess, command->conn);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2423
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2424 aim_bos_reqservice(sess, command->conn, AIM_CONN_TYPE_CHATNAV);
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2425
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2426 return 1;
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2427 }
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 828
diff changeset
2428
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2429 int gaim_parse_searchreply(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2430 va_list ap;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2431 char *address, *SNs;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2432 int i, num;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2433 char *buf;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2434 int at = 0, len;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2435
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2436 va_start(ap, command);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2437 address = va_arg(ap, char *);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2438 num = va_arg(ap, int);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2439 SNs = va_arg(ap, char *);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2440 va_end(ap);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2441
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2442 len = num * (MAXSNLEN + 1) + 1024;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2443 buf = g_malloc(len);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2444 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2445 for (i = 0; i < num; i++)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2446 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2447 g_show_info_text(buf);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2448 g_free(buf);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2449
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2450 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2451 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2452
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2453 int gaim_parse_searcherror(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2454 va_list ap;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2455 char *address;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2456 char buf[BUF_LONG];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2457
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2458 va_start(ap, command);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2459 address = va_arg(ap, char *);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2460 va_end(ap);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2461
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2462 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2463 do_error_dialog(buf, _("Error"));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2464
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2465 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2466 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2467
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2468 int gaim_account_confirm(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2469 int status;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2470 va_list ap;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2471 char msg[256];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2472 struct gaim_connection *gc = sess->aux_data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2473
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2474 va_start(ap, command);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2475 status = va_arg(ap, int); /* status code of confirmation request */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2476 va_end(ap);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2477
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2478 debug_printf("account confirmation returned status 0x%04x (%s)\n", status,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2479 status ? "email sent" : "unknown");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2480 if (status) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2481 g_snprintf(msg, sizeof(msg), "You should receive an email asking to confirm %s.",
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2482 gc->username);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2483 do_error_dialog(msg, "Confirm");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2484 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2485
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2486 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2487 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2488
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2489 int gaim_info_change(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2490 unsigned short change = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2491 int perms, type, length, str;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2492 char *val;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2493 va_list ap;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2494 char buf[BUF_LONG];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2495 struct gaim_connection *gc = sess->aux_data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2496
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2497 va_start(ap, command);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2498 perms = va_arg(ap, int);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2499 type = va_arg(ap, int);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2500 length = va_arg(ap, int);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2501 val = va_arg(ap, char *);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2502 str = va_arg(ap, int);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2503 va_end(ap);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2504
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2505 if (aimutil_get16(command->data+2) == 0x0005)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2506 change = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2507
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2508 debug_printf("info%s: perms = %d, type = %x, length = %d, val = %s\n",
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2509 change ? " change" : "", perms, type, length, str ? val : "(not string)");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2510
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2511 if ((type == 0x0011) && str) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2512 g_snprintf(buf, sizeof(buf), "The email address for %s is %s", gc->username, val);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2513 do_error_dialog(buf, "Email");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2514 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2515
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2516 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2517 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2518
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2519 static void oscar_keepalive(struct gaim_connection *gc) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2520 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2521 aim_flap_nop(odata->sess, odata->conn);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2522 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2523
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2524 static char *oscar_name() {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2525 return "Oscar";
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2526 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2527
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2528 static void oscar_send_im(struct gaim_connection *gc, char *name, char *message, int away) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2529 struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2530 struct direct_im *dim = find_direct_im(odata, name);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2531 if (dim) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2532 aim_send_im_direct(odata->sess, dim->conn, message);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2533 } else {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2534 if (away)
1899
a2624692260b [gaim-migrate @ 1909]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1887
diff changeset
2535 aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2536 else {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2537 int flags = AIM_IMFLAGS_ACK;
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
2538 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2539 GSList *h = odata->hasicons;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2540 struct icon_req *ir;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2541 char *who = normalize(name);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2542 while (h) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2543 ir = h->data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2544 if (ir->request && !strcmp(who, ir->user))
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2545 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2546 h = h->next;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2547 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2548 if (h) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2549 ir->request = FALSE;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2550 flags |= AIM_IMFLAGS_BUDDYREQ;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2551 debug_printf("sending buddy icon request with message\n");
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2552 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2553 #endif
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2554 aim_send_im(odata->sess, odata->conn, name, flags, message);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
2555 }
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2556 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2557 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2558
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2559 static void oscar_get_info(struct gaim_connection *g, char *name) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2560 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2561 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2562 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2563
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2564 static void oscar_get_away_msg(struct gaim_connection *g, char *name) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2565 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2566 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2567 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2568
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2569 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2570 char *maiden, char *city, char *state, char *country, int web) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2571 /* FIXME : some of these things are wrong, but i'm lazy */
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2572 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2573 aim_setdirectoryinfo(odata->sess, odata->conn, first, middle, last,
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2574 maiden, NULL, NULL, city, state, NULL, 0, web);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2575 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2576
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2577
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2578 static void oscar_set_idle(struct gaim_connection *g, int time) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2579 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2580 aim_bos_setidle(odata->sess, odata->conn, time);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2581 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2582
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2583 static void oscar_set_info(struct gaim_connection *g, char *info) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2584 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2585 char inforeal[1025], away[1025];
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2586 g_snprintf(inforeal, sizeof(inforeal), "%s", info);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2587 if (g->away)
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2588 g_snprintf(away, sizeof(away), "%s", g->away);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2589 if (strlen(info) > 1024)
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2590 do_error_dialog("Maximum info length (1024) exceeded, truncating", "Info Too Long");
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2591 aim_bos_setprofile(odata->sess, odata->conn, inforeal, g->away ? away : NULL, gaim_caps);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2592 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2593
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1384
diff changeset
2594 static void oscar_set_away(struct gaim_connection *g, char *state, char *message) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2595 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2596 char info[1025], away[1025];
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2597 g_snprintf(info, sizeof(info), "%s", g->user->user_info);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2598 if (message)
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2599 g_snprintf(away, sizeof(away), "%s", message);
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2600 aim_bos_setprofile(odata->sess, odata->conn, info, away, gaim_caps);
1404
96e93119268d [gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
2601 if (g->away)
96e93119268d [gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
2602 g_free (g->away);
96e93119268d [gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
2603 g->away = NULL;
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2604 if (message) {
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2605 if (strlen(message) > 1024)
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2606 do_error_dialog("Maximum away length (1024) exceeded, truncating",
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2607 "Info Too Long");
1404
96e93119268d [gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
2608 g->away = g_strdup (message);
1979
e43c267b1a8a [gaim-migrate @ 1989]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1977
diff changeset
2609 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2610 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2611
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2612 static void oscar_warn(struct gaim_connection *g, char *name, int anon) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2613 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2614 aim_send_warning(odata->sess, odata->conn, name, anon);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2615 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2616
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2617 static void oscar_dir_search(struct gaim_connection *g, char *first, char *middle, char *last,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2618 char *maiden, char *city, char *state, char *country, char *email) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2619 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2620 if (strlen(email))
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2621 aim_usersearch_address(odata->sess, odata->conn, email);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2622 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2623
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2624 static void oscar_add_buddy(struct gaim_connection *g, char *name) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2625 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2626 aim_add_buddy(odata->sess, odata->conn, name);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2627 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2628
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2629 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2630 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2631 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2632 int n = 0;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2633 while (buddies) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2634 if (n > MSG_LEN - 18) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2635 aim_bos_setbuddylist(odata->sess, odata->conn, buf);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2636 n = 0;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2637 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2638 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2639 buddies = buddies->next;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2640 }
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2641 aim_bos_setbuddylist(odata->sess, odata->conn, buf);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2642 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2643
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2644 static void oscar_remove_buddy(struct gaim_connection *g, char *name) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2645 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2646 aim_remove_buddy(odata->sess, odata->conn, name);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2647 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2648
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2649 static void oscar_join_chat(struct gaim_connection *g, int exchange, char *name) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2650 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2651 struct aim_conn_t *cur = NULL;
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2652 if (!name) {
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2653 if (!join_chat_entry || !join_chat_spin)
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2654 return;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2655 name = gtk_entry_get_text(GTK_ENTRY(join_chat_entry));
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2656 exchange = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(join_chat_spin));
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2657 if (!name || !strlen(name))
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2658 return;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2659 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2660 debug_printf("Attempting to join chat room %s.\n", name);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2661 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2662 debug_printf("chatnav exists, creating room\n");
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2663 aim_chatnav_createroom(odata->sess, cur, name, exchange);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2664 } else {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2665 /* this gets tricky */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2666 debug_printf("chatnav does not exist, opening chatnav\n");
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2667 odata->create_exchange = exchange;
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2668 odata->create_name = g_strdup(name);
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2669 aim_bos_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV);
891
fa2feef25e1e [gaim-migrate @ 901]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 857
diff changeset
2670 }
fa2feef25e1e [gaim-migrate @ 901]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 857
diff changeset
2671 }
fa2feef25e1e [gaim-migrate @ 901]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 857
diff changeset
2672
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2673 static void des_jc()
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2674 {
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2675 join_chat_entry = NULL;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2676 join_chat_spin = NULL;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2677 }
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2678
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2679 static void oscar_draw_join_chat(struct gaim_connection *gc, GtkWidget *fbox) {
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2680 GtkWidget *label;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2681 GtkWidget *rowbox;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2682 GtkObject *adjust;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2683
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2684 rowbox = gtk_hbox_new(FALSE, 5);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2685 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2686 gtk_widget_show(rowbox);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2687
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2688 label = gtk_label_new(_("Join what group:"));
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2689 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
1810
ad7759c19545 [gaim-migrate @ 1820]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1807
diff changeset
2690 gtk_signal_connect(GTK_OBJECT(label), "destroy", GTK_SIGNAL_FUNC(des_jc), NULL);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2691 gtk_widget_show(label);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2692
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2693 join_chat_entry = gtk_entry_new();
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2694 gtk_box_pack_start(GTK_BOX(rowbox), join_chat_entry, TRUE, TRUE, 0);
1827
bb115612a2ed [gaim-migrate @ 1837]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1819
diff changeset
2695 gtk_widget_grab_focus(join_chat_entry);
1819
47e064712091 [gaim-migrate @ 1829]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
2696 gtk_signal_connect(GTK_OBJECT(join_chat_entry), "activate", GTK_SIGNAL_FUNC(do_join_chat), NULL);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2697 gtk_widget_show(join_chat_entry);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2698
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2699 rowbox = gtk_hbox_new(FALSE, 5);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2700 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2701 gtk_widget_show(rowbox);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2702
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2703 label = gtk_label_new(_("Exchange:"));
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2704 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2705 gtk_widget_show(label);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2706
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2707 adjust = gtk_adjustment_new(4, 4, 20, 1, 10, 10);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2708 join_chat_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2709 gtk_widget_set_usize(join_chat_spin, 50, -1);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2710 gtk_box_pack_start(GTK_BOX(rowbox), join_chat_spin, FALSE, FALSE, 0);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2711 gtk_widget_show(join_chat_spin);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2712 }
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
2713
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2714 static void oscar_chat_invite(struct gaim_connection *g, int id, char *message, char *name) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2715 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2716 GSList *bcs = g->buddy_chats;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2717 struct conversation *b = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2718
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2719 while (bcs) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2720 b = (struct conversation *)bcs->data;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2721 if (id == b->id)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2722 break;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2723 bcs = bcs->next;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2724 b = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2725 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2726
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2727 if (!b)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2728 return;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2729
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2730 aim_chat_invite(odata->sess, odata->conn, name,
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2731 message ? message : "", 0x4, b->name, 0x0);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2732 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2733
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2734 static void oscar_chat_leave(struct gaim_connection *g, int id) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2735 struct oscar_data *odata = g ? (struct oscar_data *)g->proto_data : NULL;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2736 GSList *bcs = g->buddy_chats;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2737 struct conversation *b = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2738 struct chat_connection *c = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2739 int count = 0;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2740
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2741 while (bcs) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2742 count++;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2743 b = (struct conversation *)bcs->data;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2744 if (id == b->id)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2745 break;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2746 bcs = bcs->next;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2747 b = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2748 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2749
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2750 if (!b)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2751 return;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2752
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
2753 debug_printf("Attempting to leave room %s (currently in %d rooms)\n", b->name, count);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2754
1186
c00fc3adfd66 [gaim-migrate @ 1196]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1161
diff changeset
2755 c = find_oscar_chat(g, b->id);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2756 if (c != NULL) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2757 if (odata)
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2758 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c);
1667
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1656
diff changeset
2759 if (c->inpa > 0)
b5635d882116 [gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1656
diff changeset
2760 gdk_input_remove(c->inpa);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2761 if (g && odata->sess)
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2762 aim_conn_kill(odata->sess, &c->conn);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2763 g_free(c->name);
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2764 g_free(c->show);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2765 g_free(c);
891
fa2feef25e1e [gaim-migrate @ 901]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 857
diff changeset
2766 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2767 /* we do this because with Oscar it doesn't tell us we left */
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2768 serv_got_chat_left(g, b->id);
891
fa2feef25e1e [gaim-migrate @ 901]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 857
diff changeset
2769 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2770
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2771 static void oscar_chat_send(struct gaim_connection *g, int id, char *message) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
2772 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2773 GSList *bcs = g->buddy_chats;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2774 struct conversation *b = NULL;
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2775 struct chat_connection *c = NULL;
1887
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2776 char *buf;
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2777 int i, j;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2778
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2779 while (bcs) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2780 b = (struct conversation *)bcs->data;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2781 if (id == b->id)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2782 break;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2783 bcs = bcs->next;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2784 b = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2785 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2786 if (!b)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2787 return;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2788
1858
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2789 bcs = odata->oscar_chats;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2790 while (bcs) {
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2791 c = (struct chat_connection *)bcs->data;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2792 if (!strcmp(b->name, c->show))
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2793 break;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2794 bcs = bcs->next;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2795 c = NULL;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2796 }
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2797 if (!c)
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2798 return;
487d98cdbe28 [gaim-migrate @ 1868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1852
diff changeset
2799
1887
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2800 buf = g_malloc(strlen(message) * 4 + 1);
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2801 for (i = 0, j = 0; i < strlen(message); i++) {
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2802 if (message[i] == '\n') {
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2803 buf[j++] = '<';
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2804 buf[j++] = 'B';
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2805 buf[j++] = 'R';
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2806 buf[j++] = '>';
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2807 } else {
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2808 buf[j++] = message[i];
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2809 }
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2810 }
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2811 buf[j] = '\0';
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2812 aim_chat_send_im(odata->sess, c->conn, 0, buf, strlen(buf));
5df1e36f26e1 [gaim-migrate @ 1897]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
2813 g_free(buf);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2814 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2815
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2816 static char **oscar_list_icon(int uc) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2817 if (uc & UC_UNAVAILABLE)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2818 return (char **)away_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2819 if (uc & UC_AOL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2820 return (char **)aol_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2821 if (uc & UC_NORMAL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2822 return (char **)free_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2823 if (uc & UC_ADMIN)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2824 return (char **)admin_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2825 if (uc & UC_UNCONFIRMED)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2826 return (char **)dt_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2827 return NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2828 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
2829
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2830 static void oscar_info(GtkObject *obj, char *who) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2831 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2832 serv_get_info(gc, who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2833 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2834
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2835 static void oscar_away_msg(GtkObject *obj, char *who) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2836 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2837 serv_get_away_msg(gc, who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2838 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2839
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2840 static int gaim_directim_initiate(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2841 va_list ap;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2842 struct gaim_connection *gc = sess->aux_data;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2843 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2844 struct aim_directim_priv *priv;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2845 struct aim_conn_t *newconn;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2846 struct direct_im *dim;
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2847 char buf[256];
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2848
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2849 va_start(ap, command);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2850 newconn = va_arg(ap, struct aim_conn_t *);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2851 va_end(ap);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2852
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2853 priv = (struct aim_directim_priv *)newconn->priv;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2854
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2855 debug_printf("DirectIM: initiate success to %s\n", priv->sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2856 dim = find_direct_im(od, priv->sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2857
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2858 dim->cnv = find_conversation(priv->sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2859 if (!dim->cnv) dim->cnv = new_conversation(priv->sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2860 gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy",
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2861 GTK_SIGNAL_FUNC(delete_direct_im), dim);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2862 gdk_input_remove(dim->watcher);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2863 dim->conn = newconn;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2864 dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2865 oscar_callback, dim->conn);
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
2866 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), priv->sn);
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1751
diff changeset
2867 write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL));
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2868
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2869 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING,
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2870 gaim_directim_incoming, 0);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2871 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMDISCONNECT,
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2872 gaim_directim_disconnect, 0);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2873 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING,
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2874 gaim_directim_typing, 0);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2875
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2876 return 1;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2877 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2878
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2879 static int gaim_directim_incoming(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2880 va_list ap;
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2881 char *msg = NULL;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2882 struct aim_conn_t *conn;
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2883 struct aim_directim_priv *priv;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2884 struct gaim_connection *gc = sess->aux_data;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2885
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2886 va_start(ap, command);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2887 conn = va_arg(ap, struct aim_conn_t *);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2888 msg = va_arg(ap, char *);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2889 va_end(ap);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2890
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2891 if (!(priv = conn->priv)) {
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2892 return -1;
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2893 }
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2894
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2895 debug_printf("Got DirectIM message from %s\n", priv->sn);
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2896
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1751
diff changeset
2897 serv_got_im(gc, priv->sn, msg, 0, time((time_t)NULL));
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2898
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2899 return 1;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2900 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2901
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2902 static int gaim_directim_disconnect(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2903 va_list ap;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2904 struct aim_conn_t *conn;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2905 char *sn;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
2906 struct gaim_connection *gc = sess->aux_data;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2907 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2908 struct direct_im *dim;
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2909 char buf[256];
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2910
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2911 va_start(ap, command);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2912 conn = va_arg(ap, struct aim_conn_t *);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2913 sn = va_arg(ap, char *);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2914 va_end(ap);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2915
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2916 debug_printf("%s disconnected Direct IM.\n", sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2917
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2918 dim = find_direct_im(od, sn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2919 od->direct_ims = g_slist_remove(od->direct_ims, dim);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2920 gdk_input_remove(dim->watcher);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2921 gtk_signal_disconnect_by_data(GTK_OBJECT(dim->cnv->window), dim);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2922
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
2923 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn);
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2924 if (dim->cnv)
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1751
diff changeset
2925 write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL));
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2926
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2927 aim_conn_kill(sess, &conn);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2928
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2929 return 1;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2930 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2931
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2932 static int gaim_directim_typing(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2933 va_list ap;
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2934 struct aim_conn_t *conn;
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2935 struct aim_directim_priv *priv;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2936
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2937 va_start(ap, command);
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2938 conn = va_arg(ap, struct aim_conn_t *);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2939 va_end(ap);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2940
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2941 if (!(priv = conn->priv)) {
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2942 return -1;
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2943 }
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2944
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2945 /* I had to leave this. It's just too funny. It reminds me of my sister. */
1593
ec31e23aadc7 [gaim-migrate @ 1603]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1582
diff changeset
2946 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", priv->sn);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2947
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2948 return 1;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2949 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2950
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2951 struct ask_do_dir_im {
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2952 char *who;
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2953 struct gaim_connection *gc;
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2954 };
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2955
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2956 static void oscar_cancel_direct_im(GtkObject *obj, struct ask_do_dir_im *data) {
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2957 g_free(data);
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2958 }
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2959
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2960 static void oscar_direct_im(GtkObject *obj, struct ask_do_dir_im *data) {
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2961 struct gaim_connection *gc = data->gc;
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2962 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2963 struct direct_im *dim;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2964
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2965 dim = find_direct_im(od, data->who);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2966 if (dim) {
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1060
diff changeset
2967 do_error_dialog("Direct IM request already pending.", "Unable");
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2968 return;
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2969 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2970 dim = g_new0(struct direct_im, 1);
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2971 dim->gc = gc;
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2972 g_snprintf(dim->name, sizeof dim->name, "%s", data->who);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2973
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2974 dim->conn = aim_directim_initiate(od->sess, od->conn, NULL, data->who);
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2975 if (dim->conn != NULL) {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2976 od->direct_ims = g_slist_append(od->direct_ims, dim);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2977 dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2978 oscar_callback, dim->conn);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2979 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE,
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2980 gaim_directim_initiate, 0);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2981 } else {
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2982 do_error_dialog(_("Unable to open Direct IM"), _("Error"));
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2983 g_free(dim);
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1064
diff changeset
2984 }
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2985 }
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
2986
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2987 static void oscar_ask_direct_im(GtkObject *m, gchar *who) {
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2988 char buf[BUF_LONG];
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2989 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1);
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2990 data->who = who;
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2991 data->gc = gtk_object_get_user_data(m);
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2992 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s."
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2993 " Doing this will let them see your IP address, and may be"
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2994 " a security risk. Do you wish to continue?"), who);
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2995 do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im);
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2996 }
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2997
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
2998 static void oscar_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) {
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
2999 GtkWidget *button;
1060
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3000 char *n = g_strdup(normalize(gc->username));
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3001
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3002 button = gtk_menu_item_new_with_label(_("Get Info"));
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3003 gtk_signal_connect(GTK_OBJECT(button), "activate",
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3004 GTK_SIGNAL_FUNC(oscar_info), who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3005 gtk_object_set_user_data(GTK_OBJECT(button), gc);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3006 gtk_menu_append(GTK_MENU(menu), button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3007 gtk_widget_show(button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3008
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3009 button = gtk_menu_item_new_with_label(_("Get Away Msg"));
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3010 gtk_signal_connect(GTK_OBJECT(button), "activate",
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3011 GTK_SIGNAL_FUNC(oscar_away_msg), who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3012 gtk_object_set_user_data(GTK_OBJECT(button), gc);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3013 gtk_menu_append(GTK_MENU(menu), button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3014 gtk_widget_show(button);
1059
6e60c69d4432 [gaim-migrate @ 1069]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
3015
1060
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3016 if (strcmp(n, normalize(who))) {
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3017 button = gtk_menu_item_new_with_label(_("Direct IM"));
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3018 gtk_signal_connect(GTK_OBJECT(button), "activate",
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
3019 GTK_SIGNAL_FUNC(oscar_ask_direct_im), who);
1060
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3020 gtk_object_set_user_data(GTK_OBJECT(button), gc);
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3021 gtk_menu_append(GTK_MENU(menu), button);
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3022 gtk_widget_show(button);
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3023 }
2c4f958c596e [gaim-migrate @ 1070]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1059
diff changeset
3024 g_free(n);
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3025 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
3026
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3027
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3028 /* weeee */
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3029 static void oscar_print_option(GtkEntry *entry, struct aim_user *user)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3030 {
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3031 int entrynum;
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3032
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3033 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3034
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3035 if (entrynum == USEROPT_AUTH) {
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3036 g_snprintf(user->proto_opt[USEROPT_AUTH],
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3037 sizeof(user->proto_opt[USEROPT_AUTH]), "%s", gtk_entry_get_text(entry));
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3038 } else if (entrynum == USEROPT_AUTHPORT) {
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3039 g_snprintf(user->proto_opt[USEROPT_AUTHPORT],
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3040 sizeof(user->proto_opt[USEROPT_AUTHPORT]), "%s", gtk_entry_get_text(entry));
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3041 }
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3042 }
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3043
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3044 static void oscar_user_opts(GtkWidget *book, struct aim_user *user)
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3045 {
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3046 /* so here, we create the new notebook page */
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3047 GtkWidget *vbox;
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3048 GtkWidget *hbox;
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3049 GtkWidget *label;
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3050 GtkWidget *entry;
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3051
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3052 vbox = gtk_vbox_new(FALSE, 5);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3053 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3054 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("Oscar Options"));
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3055 gtk_widget_show(vbox);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3056
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3057 hbox = gtk_hbox_new(FALSE, 5);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3058 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3059 gtk_widget_show(hbox);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3060
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3061 label = gtk_label_new("Auth Host:");
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3062 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3063 gtk_widget_show(label);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3064
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3065 entry = gtk_entry_new();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3066 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3067 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3068 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3069 if (user->proto_opt[USEROPT_AUTH][0]) {
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3070 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3071 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3072 } else
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3073 gtk_entry_set_text(GTK_ENTRY(entry), "login.oscar.aol.com");
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3074 gtk_widget_show(entry);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3075
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3076 hbox = gtk_hbox_new(FALSE, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3077 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3078 gtk_widget_show(hbox);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3079
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3080 label = gtk_label_new("Auth Port:");
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3081 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3082 gtk_widget_show(label);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3083
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3084 entry = gtk_entry_new();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1247
diff changeset
3085 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3086 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTHPORT);
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3087 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user);
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3088 if (user->proto_opt[USEROPT_AUTHPORT][0]) {
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3089 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3090 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3091 } else
1868
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3092 gtk_entry_set_text(GTK_ENTRY(entry), "9898");
a49ed23b3c02 [gaim-migrate @ 1878]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1859
diff changeset
3093
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3094 gtk_widget_show(entry);
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3095 }
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3096
1147
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3097 static void oscar_set_permit_deny(struct gaim_connection *gc) {
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3098 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3099 GSList *list;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3100 char buf[MAXMSGLEN];
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3101 int at;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3102
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3103 switch(gc->permdeny) {
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3104 case 1:
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3105 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3106 break;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3107 case 2:
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3108 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3109 break;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3110 case 3:
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3111 list = gc->permit;
1635
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3112 at = 0;
1147
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3113 while (list) {
1635
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3114 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
1147
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3115 list = list->next;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3116 }
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3117 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3118 break;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3119 case 4:
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3120 list = gc->deny;
1635
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3121 at = 0;
1147
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3122 while (list) {
1635
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3123 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
1147
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3124 list = list->next;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3125 }
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3126 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf);
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3127 break;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3128 default:
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3129 break;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3130 }
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3131 }
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3132
1635
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3133 static void oscar_add_permit(struct gaim_connection *gc, char *who) {
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3134 if (gc->permdeny != 3) return;
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3135 oscar_set_permit_deny(gc);
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3136 }
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3137
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3138 static void oscar_add_deny(struct gaim_connection *gc, char *who) {
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3139 if (gc->permdeny != 4) return;
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3140 oscar_set_permit_deny(gc);
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3141 }
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3142
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3143 static void oscar_rem_permit(struct gaim_connection *gc, char *who) {
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3144 if (gc->permdeny != 3) return;
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3145 oscar_set_permit_deny(gc);
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3146 }
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3147
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3148 static void oscar_rem_deny(struct gaim_connection *gc, char *who) {
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3149 if (gc->permdeny != 4) return;
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3150 oscar_set_permit_deny(gc);
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3151 }
67060e06b234 [gaim-migrate @ 1645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1633
diff changeset
3152
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3153 static void oscar_draw_new_user(GtkWidget *box)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3154 {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3155 GtkWidget *label;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3156
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3157 label = gtk_label_new(_("Unfortunately, currently Oscar only allows new user registration by "
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3158 "going to http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3159 ". Clicking the Register button will open the URL for you."));
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3160 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3161 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3162 gtk_widget_show(label);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3163 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3164
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3165 static void oscar_do_new_user()
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3166 {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3167 open_url(NULL, "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no");
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3168 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3169
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1384
diff changeset
3170 static GList *oscar_away_states()
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1384
diff changeset
3171 {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1384
diff changeset
3172 return g_list_append(NULL, GAIM_AWAY_CUSTOM);
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1384
diff changeset
3173 }
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1384
diff changeset
3174
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3175 static void oscar_do_action(struct gaim_connection *gc, char *act)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3176 {
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3177 struct oscar_data *od = gc->proto_data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3178
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3179 if (!strcmp(act, "Set User Info")) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3180 show_set_info(gc);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3181 } else if (!strcmp(act, "Change Password")) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3182 show_change_passwd(gc);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3183 } else if (!strcmp(act, "Confirm Account")) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3184 if (od->paspa == 0) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3185 od->conf = TRUE;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3186 aim_bos_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3187 } else
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3188 aim_auth_reqconfirm(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3189 } else if (!strcmp(act, "Change Email")) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3190 } else if (!strcmp(act, "Display Current Registered Address")) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3191 if (od->paspa == 0) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3192 od->reqemail = TRUE;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3193 aim_bos_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3194 } else
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3195 aim_auth_getinfo(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), 0x11);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3196 } else if (!strcmp(act, "Search for Buddy by Email")) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3197 show_find_email(gc);
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3198 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3199 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3200
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3201 static GList *oscar_actions()
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3202 {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3203 GList *m = NULL;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3204
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3205 m = g_list_append(m, "Set User Info");
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3206 m = g_list_append(m, NULL);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3207 m = g_list_append(m, "Change Password");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3208 m = g_list_append(m, "Confirm Account");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3209 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3210 m = g_list_append(m, "Change Email");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3211 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3212 m = g_list_append(m, "Display Current Registered Address");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3213 m = g_list_append(m, NULL);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3214 m = g_list_append(m, "Search for Buddy by Email");
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3215
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3216 return m;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3217 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3218
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3219 static void oscar_change_passwd(struct gaim_connection *gc, char *old, char *new)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3220 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3221 struct oscar_data *od = gc->proto_data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3222 if (od->paspa == 0) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3223 od->chpass = TRUE;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3224 od->oldp = g_strdup(old);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3225 od->newp = g_strdup(new);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3226 aim_bos_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3227 } else {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3228 aim_auth_changepasswd(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH),
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3229 new, old);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3230 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3231 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3232
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3233 static void oscar_insert_convo(struct gaim_connection *gc, struct conversation *c)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3234 {
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
3235 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3236 struct oscar_data *od = gc->proto_data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3237 GSList *h = od->hasicons;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3238 struct icon_req *ir = NULL;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3239 char *who = normalize(c->name);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3240
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3241 GdkPixbufLoader *load;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3242 GList *frames;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3243 GdkPixbuf *buf;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3244 GdkPixmap *pm;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3245 GdkBitmap *bm;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3246
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3247 while (h) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3248 ir = h->data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3249 if (!strcmp(who, ir->user))
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3250 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3251 h = h->next;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3252 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3253 if (!h || !ir->data)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3254 return;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3255
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3256 ir->cnv = c;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3257
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3258 load = gdk_pixbuf_loader_new();
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3259 gdk_pixbuf_loader_write(load, ir->data, ir->length);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3260 ir->anim = gdk_pixbuf_loader_get_animation(load);
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3261
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3262 if (ir->anim) {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3263 frames = gdk_pixbuf_animation_get_frames(ir->anim);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3264 buf = gdk_pixbuf_frame_get_pixbuf(frames->data);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3265 gdk_pixbuf_render_pixmap_and_mask(buf, &pm, &bm, 0);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3266
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3267 if (gdk_pixbuf_animation_get_num_frames(ir->anim) > 1) {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3268 int delay = gdk_pixbuf_frame_get_delay_time(frames->data);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3269 ir->curframe = 1;
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3270 ir->timer = gtk_timeout_add(delay * 10, redraw_anim, ir);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3271 }
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3272 } else {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3273 ir->unanim = gdk_pixbuf_loader_get_pixbuf(load);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3274 if (!ir->unanim) {
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3275 gdk_pixbuf_loader_close(load);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3276 return;
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3277 }
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3278 gdk_pixbuf_render_pixmap_and_mask(ir->unanim, &pm, &bm, 0);
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3279 }
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3280
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3281 ir->pix = gtk_pixmap_new(pm, bm);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3282 gtk_box_pack_start(GTK_BOX(c->bbox), ir->pix, FALSE, FALSE, 5);
1922
07ceb54dc96a [gaim-migrate @ 1932]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1910
diff changeset
3283 if (ir->anim && (gdk_pixbuf_animation_get_num_frames(ir->anim) > 1))
07ceb54dc96a [gaim-migrate @ 1932]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1910
diff changeset
3284 gtk_widget_set_usize(ir->pix, gdk_pixbuf_animation_get_width(ir->anim),
07ceb54dc96a [gaim-migrate @ 1932]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1910
diff changeset
3285 gdk_pixbuf_animation_get_height(ir->anim));
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3286 gtk_widget_show(ir->pix);
1931
e86f357ec23d [gaim-migrate @ 1941]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1922
diff changeset
3287 gdk_pixmap_unref(pm);
1934
e875b1cb2470 [gaim-migrate @ 1944]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1933
diff changeset
3288 if (bm)
e875b1cb2470 [gaim-migrate @ 1944]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1933
diff changeset
3289 gdk_bitmap_unref(bm);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3290
1910
1cfc79c126fe [gaim-migrate @ 1920]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1906
diff changeset
3291 gdk_pixbuf_loader_close(load);
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3292 #endif
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3293 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3294
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3295 static void oscar_remove_convo(struct gaim_connection *gc, struct conversation *c)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3296 {
1906
42aa9434800a [gaim-migrate @ 1916]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1905
diff changeset
3297 #if USE_PIXBUF
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3298 struct oscar_data *od = gc->proto_data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3299 GSList *h = od->hasicons;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3300 struct icon_req *ir = NULL;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3301 char *who = normalize(c->name);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3302
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3303 while (h) {
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3304 ir = h->data;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3305 if (!strcmp(who, ir->user))
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3306 break;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3307 h = h->next;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3308 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3309 if (!h || !ir->data)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3310 return;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3311
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3312 gtk_container_remove(GTK_CONTAINER(ir->cnv->bbox), ir->pix);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3313 ir->pix = NULL;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3314 ir->cnv = NULL;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3315
1933
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
3316 if (ir->anim) {
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
3317 gdk_pixbuf_animation_unref(ir->anim);
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
3318 ir->anim = NULL;
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
3319 } else if (ir->unanim) {
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
3320 gdk_pixbuf_unref(ir->unanim);
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
3321 ir->unanim = NULL;
e9f926eaf0c9 [gaim-migrate @ 1943]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1932
diff changeset
3322 }
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3323
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3324 ir->curframe = 0;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3325
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3326 if (ir->timer)
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3327 gtk_timeout_remove(ir->timer);
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3328 ir->timer = 0;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3329 #endif
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3330 }
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3331
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
3332 void oscar_init(struct prpl *ret) {
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3333 ret->protocol = PROTO_OSCAR;
1435
f16e17d42b43 [gaim-migrate @ 1445]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
3334 ret->options = OPT_PROTO_HTML | OPT_PROTO_CORRECT_TIME;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3335 ret->name = oscar_name;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
3336 ret->list_icon = oscar_list_icon;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1384
diff changeset
3337 ret->away_states = oscar_away_states;
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3338 ret->actions = oscar_actions;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3339 ret->do_action = oscar_do_action;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1435
diff changeset
3340 ret->buddy_menu = oscar_buddy_menu;
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1082
diff changeset
3341 ret->user_opts = oscar_user_opts;
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3342 ret->draw_new_user = oscar_draw_new_user;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1315
diff changeset
3343 ret->do_new_user = oscar_do_new_user;
1903
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3344 ret->insert_convo = oscar_insert_convo;
835fcc223341 [gaim-migrate @ 1913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1899
diff changeset
3345 ret->remove_convo = oscar_remove_convo;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3346 ret->login = oscar_login;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3347 ret->close = oscar_close;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3348 ret->send_im = oscar_send_im;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3349 ret->set_info = oscar_set_info;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3350 ret->get_info = oscar_get_info;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3351 ret->set_away = oscar_set_away;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3352 ret->get_away_msg = oscar_get_away_msg;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3353 ret->set_dir = oscar_set_dir;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3354 ret->get_dir = NULL; /* Oscar really doesn't have this */
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3355 ret->dir_search = oscar_dir_search;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3356 ret->set_idle = oscar_set_idle;
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1534
diff changeset
3357 ret->change_passwd = oscar_change_passwd;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3358 ret->add_buddy = oscar_add_buddy;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3359 ret->add_buddies = oscar_add_buddies;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3360 ret->remove_buddy = oscar_remove_buddy;
1147
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3361 ret->add_permit = oscar_add_permit;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3362 ret->add_deny = oscar_add_deny;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3363 ret->rem_permit = oscar_rem_permit;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3364 ret->rem_deny = oscar_rem_deny;
65e0608e19f7 [gaim-migrate @ 1157]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
3365 ret->set_permit_deny = oscar_set_permit_deny;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3366 ret->warn = oscar_warn;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3367 ret->accept_chat = NULL; /* oscar doesn't have accept, it just joins */
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3368 ret->join_chat = oscar_join_chat;
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1796
diff changeset
3369 ret->draw_join_chat = oscar_draw_join_chat;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3370 ret->chat_invite = oscar_chat_invite;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3371 ret->chat_leave = oscar_chat_leave;
1534
d98b92e3d9ff [gaim-migrate @ 1544]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
3372 ret->chat_whisper = NULL;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3373 ret->chat_send = oscar_chat_send;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3374 ret->keepalive = oscar_keepalive;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
3375 }