Mercurial > pidgin.yaz
annotate plugins/msn/msn.c @ 2014:162f749ee5e7
[gaim-migrate @ 2024]
step 1 in moving towards group chat stuff.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 14 Jun 2001 03:40:56 +0000 |
parents | 0c8073b877d2 |
children | 0d11fd498068 |
rev | line source |
---|---|
1514
0dd012166152
[gaim-migrate @ 1524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1 #include "config.h" |
1259 | 2 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
3 #include <stdlib.h> |
1259 | 4 #include <gtk/gtk.h> |
5 #include <string.h> | |
6 #include <stdio.h> | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
7 #include <unistd.h> |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
8 #include <ctype.h> |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
9 #include "gaim.h" |
1259 | 10 #include "prpl.h" |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
11 #include "proxy.h" |
1259 | 12 #include "md5.h" |
13 | |
1284 | 14 #include "pixmaps/msn_online.xpm" |
1285 | 15 #include "pixmaps/msn_away.xpm" |
1259 | 16 |
1567 | 17 #define MSN_BUF_LEN 8192 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
18 #define MIME_HEADER "MIME-Version: 1.0\r\n" \ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
19 "Content-Type: text/plain; charset=UTF-8\r\n" \ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
20 "X-MMS-IM-Format: FN=MS%20Sans%20Serif; EF=; CO=0; PF=0\r\n\r\n" |
1259 | 21 |
22 #define MSN_ONLINE 1 | |
23 #define MSN_BUSY 2 | |
24 #define MSN_IDLE 3 | |
25 #define MSN_BRB 4 | |
26 #define MSN_AWAY 5 | |
27 #define MSN_PHONE 6 | |
28 #define MSN_LUNCH 7 | |
29 #define MSN_OFFLINE 8 | |
30 #define MSN_HIDDEN 9 | |
31 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
32 #define USEROPT_HOTMAIL 0 |
1598 | 33 |
1259 | 34 struct msn_data { |
35 int fd; | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
36 int trId; |
1567 | 37 int inpa; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
38 GSList *switches; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
39 GSList *fl; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
40 gboolean imported; |
1259 | 41 }; |
42 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
43 struct msn_switchboard { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
44 struct gaim_connection *gc; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
45 int fd; |
1259 | 46 int inpa; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
47 char *sessid; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
48 char *auth; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
49 int trId; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
50 int total; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
51 char *user; |
1584 | 52 char *txqueue; |
1259 | 53 }; |
54 | |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
55 struct msn_buddy { |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
56 char *user; |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
57 char *friend; |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
58 }; |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
59 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
60 static void msn_login_callback(gpointer, gint, GdkInputCondition); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
61 static void msn_login_xfr_connect(gpointer, gint, GdkInputCondition); |
1588 | 62 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
63 #define GET_NEXT(tmp) while (*(tmp) && !isspace(*(tmp))) \ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
64 (tmp)++; \ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
65 *(tmp)++ = 0; \ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
66 while (*(tmp) && isspace(*(tmp))) \ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
67 (tmp)++; |
1259 | 68 |
1282 | 69 char *name() |
70 { | |
1259 | 71 return "MSN"; |
72 } | |
73 | |
1282 | 74 char *description() |
75 { | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
76 return "Allows gaim to use the MSN protocol."; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
77 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
78 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
79 static char *msn_name() |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
80 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
81 return "MSN"; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
82 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
83 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
84 static char *msn_normalize(const char *s) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
85 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
86 static char buf[BUF_LEN]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
87 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
88 g_return_val_if_fail(s != NULL, NULL); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
89 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
90 g_snprintf(buf, sizeof(buf), "%s%s", s, strchr(s, '@') ? "" : "@hotmail.com"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
91 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
92 return buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
93 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
94 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
95 static int msn_write(int fd, void *data, int len) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
96 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
97 debug_printf("C: %s", data); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
98 return write(fd, data, len); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
99 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
100 |
1986
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
101 static char *url_decode(const char *msg) |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
102 { |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
103 static char buf[MSN_BUF_LEN]; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
104 int i, j = 0; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
105 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
106 bzero(buf, sizeof(buf)); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
107 for (i = 0; i < strlen(msg); i++) { |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
108 char hex[3]; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
109 if (msg[i] != '%') { |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
110 buf[j++] = msg[i]; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
111 continue; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
112 } |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
113 g_snprintf(hex, sizeof(hex), "%s", msg + ++i); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
114 i++; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
115 sscanf(hex, "%x", (unsigned int *)&buf[j++]); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
116 } |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
117 buf[j] = 0; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
118 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
119 return buf; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
120 } |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
121 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
122 static char *handle_errcode(char *buf, gboolean show) |
1282 | 123 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
124 int errcode; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
125 static char msg[MSN_BUF_LEN]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
126 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
127 buf[4] = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
128 errcode = atoi(buf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
129 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
130 switch (errcode) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
131 case 200: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
132 g_snprintf(msg, sizeof(msg), "Syntax Error (probably a Gaim bug)"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
133 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
134 case 201: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
135 g_snprintf(msg, sizeof(msg), "Invalid Parameter (probably a Gaim bug)"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
136 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
137 case 205: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
138 g_snprintf(msg, sizeof(msg), "Invalid User"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
139 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
140 case 206: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
141 g_snprintf(msg, sizeof(msg), "Fully Qualified Domain Name missing"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
142 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
143 case 207: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
144 g_snprintf(msg, sizeof(msg), "Already Login"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
145 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
146 case 208: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
147 g_snprintf(msg, sizeof(msg), "Invalid Username"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
148 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
149 case 209: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
150 g_snprintf(msg, sizeof(msg), "Invalid Friendly Name"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
151 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
152 case 210: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
153 g_snprintf(msg, sizeof(msg), "List Full"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
154 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
155 case 215: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
156 g_snprintf(msg, sizeof(msg), "Already there"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
157 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
158 case 216: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
159 g_snprintf(msg, sizeof(msg), "Not on list"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
160 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
161 case 218: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
162 g_snprintf(msg, sizeof(msg), "Already in the mode"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
163 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
164 case 219: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
165 g_snprintf(msg, sizeof(msg), "Already in opposite list"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
166 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
167 case 280: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
168 g_snprintf(msg, sizeof(msg), "Switchboard failed"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
169 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
170 case 281: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
171 g_snprintf(msg, sizeof(msg), "Notify Transfer failed"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
172 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
173 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
174 case 300: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
175 g_snprintf(msg, sizeof(msg), "Required fields missing"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
176 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
177 case 302: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
178 g_snprintf(msg, sizeof(msg), "Not logged in"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
179 break; |
1567 | 180 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
181 case 500: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
182 g_snprintf(msg, sizeof(msg), "Internal server error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
183 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
184 case 501: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
185 g_snprintf(msg, sizeof(msg), "Database server error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
186 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
187 case 510: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
188 g_snprintf(msg, sizeof(msg), "File operation error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
189 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
190 case 520: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
191 g_snprintf(msg, sizeof(msg), "Memory allocation error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
192 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
193 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
194 case 600: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
195 g_snprintf(msg, sizeof(msg), "Server busy"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
196 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
197 case 601: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
198 g_snprintf(msg, sizeof(msg), "Server unavailable"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
199 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
200 case 602: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
201 g_snprintf(msg, sizeof(msg), "Peer Notification server down"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
202 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
203 case 603: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
204 g_snprintf(msg, sizeof(msg), "Database connect error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
205 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
206 case 604: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
207 g_snprintf(msg, sizeof(msg), "Server is going down (abandon ship)"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
208 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
209 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
210 case 707: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
211 g_snprintf(msg, sizeof(msg), "Error creating connection"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
212 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
213 case 711: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
214 g_snprintf(msg, sizeof(msg), "Unable to write"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
215 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
216 case 712: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
217 g_snprintf(msg, sizeof(msg), "Session overload"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
218 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
219 case 713: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
220 g_snprintf(msg, sizeof(msg), "User is too active"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
221 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
222 case 714: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
223 g_snprintf(msg, sizeof(msg), "Too many sessions"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
224 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
225 case 715: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
226 g_snprintf(msg, sizeof(msg), "Not expected"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
227 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
228 case 717: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
229 g_snprintf(msg, sizeof(msg), "Bad friend file"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
230 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
231 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
232 case 911: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
233 g_snprintf(msg, sizeof(msg), "Authentication failed"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
234 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
235 case 913: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
236 g_snprintf(msg, sizeof(msg), "Not allowed when offline"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
237 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
238 case 920: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
239 g_snprintf(msg, sizeof(msg), "Not accepting new users"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
240 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
241 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
242 default: |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
243 g_snprintf(msg, sizeof(msg), "Unknown Error Code"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
244 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
245 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
246 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
247 if (show) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
248 do_error_dialog(msg, "MSN Error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
249 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
250 return msg; |
1733 | 251 } |
252 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
253 static void handle_hotmail(struct gaim_connection *gc, char *data) |
1733 | 254 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
255 char *mailct, *mailp, *from = NULL, *subj = NULL, notice[MSN_BUF_LEN]; |
1733 | 256 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
257 if (gc->user->proto_opt[USEROPT_HOTMAIL][0] != '1') return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
258 mailct = strstr(data, "Content-Type: "); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
259 mailp = strstr(mailct, ";"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
260 if (mailct && mailp && (mailp > mailct) && |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
261 !strncmp(mailct, "Content-Type: text/x-msmsgsemailnotification", mailp - mailct - 1)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
262 from = strstr(mailp, "From: "); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
263 subj = strstr(mailp, "Subject: "); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
264 } |
1733 | 265 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
266 if (!from || !subj) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
267 return; |
1733 | 268 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
269 from += strlen("From: "); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
270 mailp = strstr(from, "\r\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
271 if (!mailp) return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
272 *mailp = 0; |
1733 | 273 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
274 subj += strlen("Subject: "); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
275 mailp = strstr(from, "\r\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
276 if (!mailp) return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
277 *mailp = 0; |
1833 | 278 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
279 g_snprintf(notice, sizeof(notice), "Mail from %s, re: %s", from, subj); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
280 do_error_dialog(notice, "New MSN Mail"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
281 } |
1733 | 282 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
283 static struct msn_switchboard *msn_find_switch(struct gaim_connection *gc, char *id) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
284 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
285 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
286 GSList *m = md->switches; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
287 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
288 while (m) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
289 struct msn_switchboard *ms = m->data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
290 m = m->next; |
1989
21c595ef11c8
[gaim-migrate @ 1999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1988
diff
changeset
|
291 if (!g_strcasecmp(ms->user, id)) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
292 return ms; |
1733 | 293 } |
294 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
295 return NULL; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
296 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
297 |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
298 static struct msn_switchboard *msn_find_writable_switch(struct gaim_connection *gc) |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
299 { |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
300 struct msn_data *md = gc->proto_data; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
301 GSList *m = md->switches; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
302 |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
303 while (m) { |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
304 struct msn_switchboard *ms = m->data; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
305 m = m->next; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
306 if (ms->txqueue) |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
307 return ms; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
308 } |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
309 |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
310 return NULL; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
311 } |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
312 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
313 static void msn_kill_switch(struct msn_switchboard *ms) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
314 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
315 struct gaim_connection *gc = ms->gc; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
316 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
317 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
318 gdk_input_remove(ms->inpa); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
319 close(ms->fd); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
320 if (ms->sessid) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
321 g_free(ms->sessid); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
322 g_free(ms->auth); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
323 if (ms->user) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
324 g_free(ms->user); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
325 if (ms->txqueue) |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
326 g_free(ms->txqueue); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
327 ms->txqueue = NULL; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
328 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
329 md->switches = g_slist_remove(md->switches, ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
330 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
331 g_free(ms); |
1567 | 332 } |
1259 | 333 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
334 static void msn_switchboard_callback(gpointer data, gint source, GdkInputCondition cond) |
1572 | 335 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
336 struct msn_switchboard *ms = data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
337 struct gaim_connection *gc = ms->gc; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
338 char buf[MSN_BUF_LEN]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
339 int i = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
340 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
341 bzero(buf, sizeof(buf)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
342 while ((read(ms->fd, buf + i, 1) > 0) && (buf[i++] != '\n')) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
343 if (i == sizeof(buf)) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
344 i--; /* yes i know this loses data but we shouldn't get messages this long |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
345 and it's better than possibly writing past our buffer */ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
346 if (i == 0 || buf[i - 1] != '\n') { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
347 msn_kill_switch(ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
348 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
349 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
350 debug_printf("S: %s", buf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
351 g_strchomp(buf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
352 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
353 if (!g_strncasecmp(buf, "ACK", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
354 } else if (!g_strncasecmp(buf, "ANS", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
355 } else if (!g_strncasecmp(buf, "BYE", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
356 } else if (!g_strncasecmp(buf, "CAL", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
357 } else if (!g_strncasecmp(buf, "IRO", 3)) { |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
358 char *tot, *friend, *tmp = buf; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
359 |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
360 GET_NEXT(tmp); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
361 GET_NEXT(tmp); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
362 GET_NEXT(tmp); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
363 tot = tmp; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
364 GET_NEXT(tmp); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
365 ms->total = atoi(tot); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
366 GET_NEXT(tmp); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
367 friend = tmp; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
368 } else if (!g_strncasecmp(buf, "JOI", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
369 if (ms->txqueue) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
370 g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s", ++ms->trId, |
1988
2bb74a5a574f
[gaim-migrate @ 1998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1987
diff
changeset
|
371 strlen(MIME_HEADER) + strlen(ms->txqueue), |
2bb74a5a574f
[gaim-migrate @ 1998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1987
diff
changeset
|
372 MIME_HEADER, ms->txqueue); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
373 g_free(ms->txqueue); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
374 ms->txqueue = NULL; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
375 if (msn_write(ms->fd, buf, strlen(buf)) < 0) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
376 msn_kill_switch(ms); |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
377 debug_printf("\n"); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
378 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
379 } else if (!g_strncasecmp(buf, "MSG", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
380 char *user, *tmp = buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
381 int length; |
1992
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
382 char *msg, *content, *skiphead, *utf, *final; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
383 int len; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
384 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
385 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
386 user = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
387 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
388 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
389 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
390 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
391 length = atoi(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
392 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
393 msg = g_new0(char, MAX(length + 1, MSN_BUF_LEN)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
394 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
395 if (read(ms->fd, msg, length) != length) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
396 g_free(msg); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
397 hide_login_progress(gc, "Unable to read message"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
398 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
399 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
400 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
401 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
402 |
1992
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
403 content = strstr(msg, "Content-Type: "); |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
404 if (content) { |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
405 if (g_strncasecmp(content, "Content-Type: text/plain", |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
406 strlen("Content-Type: text/plain"))) { |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
407 g_free(msg); |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
408 return; |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
409 } |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
410 } |
5121e706af6d
[gaim-migrate @ 2002]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1991
diff
changeset
|
411 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
412 skiphead = strstr(msg, "\r\n\r\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
413 if (!skiphead || !skiphead[4]) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
414 g_free(msg); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
415 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
416 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
417 skiphead += 4; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
418 utf = utf8_to_str(skiphead); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
419 len = MAX(strlen(utf) + 1, BUF_LEN); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
420 final = g_malloc(len); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
421 g_snprintf(final, len, "%s", utf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
422 g_free(utf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
423 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
424 serv_got_im(gc, user, final, 0, time(NULL)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
425 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
426 g_free(final); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
427 g_free(msg); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
428 } else if (!g_strncasecmp(buf, "NAK", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
429 do_error_dialog("A message may not have been received.", "MSN Error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
430 } else if (!g_strncasecmp(buf, "NLN", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
431 } else if (!g_strncasecmp(buf, "OUT", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
432 } else if (!g_strncasecmp(buf, "USR", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
433 /* good, we got USR, now we need to find out who we want to talk to */ |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
434 struct msn_switchboard *ms = msn_find_writable_switch(gc); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
435 |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
436 if (!ms) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
437 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
438 |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
439 g_snprintf(buf, sizeof(buf), "CAL %d %s\n", ++ms->trId, ms->user); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
440 if (msn_write(ms->fd, buf, strlen(buf)) < 0) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
441 msn_kill_switch(ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
442 } else if (isdigit(*buf)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
443 handle_errcode(buf, TRUE); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
444 } else { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
445 debug_printf("Unhandled message!\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
446 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
447 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
448 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
449 static void msn_rng_connect(gpointer data, gint source, GdkInputCondition cond) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
450 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
451 struct msn_switchboard *ms = data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
452 struct gaim_connection *gc = ms->gc; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
453 struct msn_data *md; |
1572 | 454 char buf[MSN_BUF_LEN]; |
455 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
456 if (source == -1 || !g_slist_find(connections, gc)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
457 g_free(ms->sessid); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
458 g_free(ms->auth); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
459 g_free(ms); |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
460 return; |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
461 } |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
462 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
463 md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
464 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
465 if (md->fd != source) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
466 md->fd = source; |
1572 | 467 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
468 g_snprintf(buf, sizeof(buf), "ANS %d %s %s %s\n", ++ms->trId, gc->username, ms->auth, ms->sessid); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
469 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
470 close(ms->fd); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
471 g_free(ms->sessid); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
472 g_free(ms->auth); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
473 g_free(ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
474 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
475 } |
1572 | 476 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
477 md->switches = g_slist_append(md->switches, ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
478 ms->inpa = gdk_input_add(ms->fd, GDK_INPUT_READ, msn_switchboard_callback, ms); |
1572 | 479 } |
480 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
481 static void msn_ss_xfr_connect(gpointer data, gint source, GdkInputCondition cond) |
1584 | 482 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
483 struct msn_switchboard *ms = data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
484 struct gaim_connection *gc = ms->gc; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
485 char buf[MSN_BUF_LEN]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
486 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
487 if (source == -1 || !g_slist_find(connections, gc)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
488 g_free(ms->auth); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
489 g_free(ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
490 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
491 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
492 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
493 if (ms->fd != source) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
494 ms->fd = source; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
495 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
496 g_snprintf(buf, sizeof(buf), "USR %d %s %s\n", ++ms->trId, gc->username, ms->auth); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
497 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
498 g_free(ms->auth); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
499 g_free(ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
500 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
501 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
502 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
503 ms->inpa = gdk_input_add(ms->fd, GDK_INPUT_READ, msn_switchboard_callback, ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
504 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
505 |
1986
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
506 struct msn_add_permit { |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
507 struct gaim_connection *gc; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
508 char *user; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
509 char *friend; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
510 }; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
511 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
512 static void msn_accept_add(gpointer w, struct msn_add_permit *map) |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
513 { |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
514 struct msn_data *md = map->gc->proto_data; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
515 char buf[MSN_BUF_LEN]; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
516 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
517 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\n", ++md->trId, map->user, map->friend); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
518 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
519 hide_login_progress(map->gc, "Write error"); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
520 signoff(map->gc); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
521 return; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
522 } |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
523 } |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
524 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
525 static void msn_cancel_add(gpointer w, struct msn_add_permit *map) |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
526 { |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
527 g_free(map->user); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
528 g_free(map->friend); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
529 g_free(map); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
530 } |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
531 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
532 static void msn_callback(gpointer data, gint source, GdkInputCondition cond) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
533 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
534 struct gaim_connection *gc = data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
535 struct msn_data *md = gc->proto_data; |
1584 | 536 char buf[MSN_BUF_LEN]; |
537 int i = 0; | |
538 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
539 bzero(buf, sizeof(buf)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
540 while ((read(md->fd, buf + i, 1) > 0) && (buf[i++] != '\n')) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
541 if (i == sizeof(buf)) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
542 i--; /* yes i know this loses data but we shouldn't get messages this long |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
543 and it's better than possibly writing past our buffer */ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
544 if (i == 0 || buf[i - 1] != '\n') { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
545 hide_login_progress(gc, "Error reading from server"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
546 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
547 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
548 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
549 debug_printf("S: %s", buf); |
1584 | 550 g_strchomp(buf); |
551 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
552 if (!g_strncasecmp(buf, "ADD", 3)) { |
1986
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
553 char *list, *user, *friend, *tmp = buf; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
554 struct msn_add_permit *ap = g_new0(struct msn_add_permit, 1); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
555 char msg[MSN_BUF_LEN]; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
556 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
557 GET_NEXT(tmp); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
558 GET_NEXT(tmp); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
559 list = tmp; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
560 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
561 GET_NEXT(tmp); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
562 GET_NEXT(tmp); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
563 user = tmp; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
564 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
565 GET_NEXT(tmp); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
566 friend = tmp; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
567 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
568 if (g_strcasecmp(list, "RL")) |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
569 return; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
570 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
571 ap->user = g_strdup(user); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
572 ap->friend = g_strdup(url_decode(friend)); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
573 ap->gc = gc; |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
574 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
575 g_snprintf(msg, sizeof(msg), "The user %s (%s) wants to add you to their buddy list.", |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
576 ap->user, ap->friend); |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
577 |
00ef734e92e1
[gaim-migrate @ 1996]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1985
diff
changeset
|
578 do_ask_dialog(msg, ap, msn_accept_add, msn_cancel_add); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
579 } else if (!g_strncasecmp(buf, "BLP", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
580 } else if (!g_strncasecmp(buf, "BPR", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
581 } else if (!g_strncasecmp(buf, "CHG", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
582 } else if (!g_strncasecmp(buf, "FLN", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
583 char *usr = buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
584 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
585 GET_NEXT(usr); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
586 serv_got_update(gc, usr, 0, 0, 0, 0, 0, 0); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
587 } else if (!g_strncasecmp(buf, "GTC", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
588 } else if (!g_strncasecmp(buf, "INF", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
589 } else if (!g_strncasecmp(buf, "ILN", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
590 char *state, *user, *tmp = buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
591 int status = UC_NORMAL; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
592 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
593 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
594 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
595 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
596 state = tmp; |
1584 | 597 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
598 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
599 user = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
600 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
601 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
602 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
603 if (!g_strcasecmp(state, "BSY")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
604 status |= (MSN_BUSY << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
605 } else if (!g_strcasecmp(state, "IDL")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
606 status |= (MSN_IDLE << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
607 } else if (!g_strcasecmp(state, "BRB")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
608 status |= (MSN_BRB << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
609 } else if (!g_strcasecmp(state, "AWY")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
610 status = UC_UNAVAILABLE; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
611 } else if (!g_strcasecmp(state, "PHN")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
612 status |= (MSN_PHONE << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
613 } else if (!g_strcasecmp(state, "LUN")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
614 status |= (MSN_LUNCH << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
615 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
616 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
617 serv_got_update(gc, user, 1, 0, 0, 0, status, 0); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
618 } else if (!g_strncasecmp(buf, "LST", 3)) { |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
619 char *which, *who, *friend, *tmp = buf; |
1584 | 620 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
621 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
622 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
623 which = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
624 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
625 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
626 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
627 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
628 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
629 who = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
630 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
631 GET_NEXT(tmp); |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
632 friend = tmp; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
633 |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
634 if (!g_strcasecmp(which, "FL")) { |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
635 struct msn_buddy *b = g_new0(struct msn_buddy, 1); |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
636 b->user = g_strdup(who); |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
637 b->friend = g_strdup(friend); |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
638 md->fl = g_slist_append(md->fl, b); |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
639 } else if (!md->imported) { |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
640 if (bud_list_cache_exists(gc)) |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
641 do_import(NULL, gc); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
642 md->imported = TRUE; |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
643 while (md->fl) { |
1994
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
644 struct msn_buddy *mb = md->fl->data; |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
645 struct buddy *b; |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
646 md->fl = g_slist_remove(md->fl, mb); |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
647 if (!(b = find_buddy(gc, mb->user))) |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
648 add_buddy(gc, "Buddies", mb->user, mb->friend); |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
649 else if (!g_strcasecmp(b->name, b->show)) { |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
650 g_snprintf(b->show, sizeof(b->show), "%s", mb->friend); |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
651 handle_buddy_rename(b, b->name); |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
652 } |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
653 g_free(mb->user); |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
654 g_free(mb->friend); |
0c8073b877d2
[gaim-migrate @ 2004]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1993
diff
changeset
|
655 g_free(mb); |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
656 } |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
657 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
658 } else if (!g_strncasecmp(buf, "MSG", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
659 char *user, *tmp = buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
660 int length; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
661 char *msg, *skiphead, *utf, *final; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
662 int len; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
663 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
664 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
665 user = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
666 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
667 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
668 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
669 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
670 length = atoi(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
671 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
672 msg = g_new0(char, MAX(length + 1, MSN_BUF_LEN)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
673 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
674 if (read(md->fd, msg, length) != length) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
675 g_free(msg); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
676 hide_login_progress(gc, "Unable to read message"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
677 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
678 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
679 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
680 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
681 if (!g_strcasecmp(user, "hotmail")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
682 handle_hotmail(gc, msg); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
683 g_free(msg); |
1584 | 684 return; |
685 } | |
686 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
687 skiphead = strstr(msg, "\r\n\r\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
688 if (!skiphead || !skiphead[4]) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
689 g_free(msg); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
690 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
691 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
692 skiphead += 4; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
693 utf = utf8_to_str(skiphead); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
694 len = MAX(strlen(utf) + 1, BUF_LEN); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
695 final = g_malloc(len); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
696 g_snprintf(final, len, "%s", utf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
697 g_free(utf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
698 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
699 serv_got_im(gc, user, final, 0, time(NULL)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
700 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
701 g_free(final); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
702 g_free(msg); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
703 } else if (!g_strncasecmp(buf, "NLN", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
704 char *state, *user, *tmp = buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
705 int status = UC_NORMAL; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
706 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
707 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
708 state = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
709 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
710 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
711 user = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
712 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
713 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
714 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
715 if (!g_strcasecmp(state, "BSY")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
716 status |= (MSN_BUSY << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
717 } else if (!g_strcasecmp(state, "IDL")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
718 status |= (MSN_IDLE << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
719 } else if (!g_strcasecmp(state, "BRB")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
720 status |= (MSN_BRB << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
721 } else if (!g_strcasecmp(state, "AWY")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
722 status = UC_UNAVAILABLE; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
723 } else if (!g_strcasecmp(state, "PHN")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
724 status |= (MSN_PHONE << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
725 } else if (!g_strcasecmp(state, "LUN")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
726 status |= (MSN_LUNCH << 5); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
727 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
728 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
729 serv_got_update(gc, user, 1, 0, 0, 0, status, 0); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
730 } else if (!g_strncasecmp(buf, "OUT", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
731 } else if (!g_strncasecmp(buf, "PRP", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
732 } else if (!g_strncasecmp(buf, "REM", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
733 } else if (!g_strncasecmp(buf, "RNG", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
734 struct msn_switchboard *ms; |
1989
21c595ef11c8
[gaim-migrate @ 1999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1988
diff
changeset
|
735 char *sessid, *ssaddr, *auth, *user; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
736 int port, i = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
737 char *tmp = buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
738 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
739 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
740 sessid = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
741 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
742 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
743 ssaddr = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
744 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
745 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
746 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
747 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
748 auth = tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
749 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
750 GET_NEXT(tmp); |
1989
21c595ef11c8
[gaim-migrate @ 1999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1988
diff
changeset
|
751 user = tmp; |
21c595ef11c8
[gaim-migrate @ 1999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1988
diff
changeset
|
752 |
21c595ef11c8
[gaim-migrate @ 1999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1988
diff
changeset
|
753 GET_NEXT(tmp); |
1584 | 754 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
755 while (ssaddr[i] && ssaddr[i] != ':') i++; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
756 if (ssaddr[i] == ':') { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
757 char *x = &ssaddr[i + 1]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
758 ssaddr[i] = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
759 port = atoi(x); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
760 } else |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
761 port = 1863; |
1584 | 762 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
763 ms = g_new0(struct msn_switchboard, 1); |
1989
21c595ef11c8
[gaim-migrate @ 1999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1988
diff
changeset
|
764 ms->user = g_strdup(user); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
765 ms->sessid = g_strdup(sessid); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
766 ms->auth = g_strdup(auth); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
767 ms->gc = gc; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
768 ms->fd = proxy_connect(ssaddr, port, msn_rng_connect, ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
769 } else if (!g_strncasecmp(buf, "SYN", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
770 } else if (!g_strncasecmp(buf, "USR", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
771 } else if (!g_strncasecmp(buf, "XFR", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
772 char *host = strstr(buf, "SB"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
773 int port; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
774 int i = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
775 gboolean switchboard = TRUE; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
776 char *tmp; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
777 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
778 if (!host) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
779 host = strstr(buf, "NS"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
780 if (!host) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
781 hide_login_progress(gc, "Got invalid XFR\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
782 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
783 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
784 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
785 switchboard = FALSE; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
786 } |
1584 | 787 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
788 GET_NEXT(host); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
789 while (host[i] && host[i] != ':') i++; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
790 if (host[i] == ':') { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
791 tmp = &host[i + 1]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
792 host[i] = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
793 while (isdigit(*tmp)) tmp++; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
794 *tmp++ = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
795 port = atoi(&host[i + 1]); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
796 } else { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
797 port = 1863; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
798 tmp = host; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
799 GET_NEXT(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
800 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
801 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
802 if (switchboard) { |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
803 struct msn_switchboard *ms = msn_find_writable_switch(gc); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
804 if (!ms) |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
805 return; |
1584 | 806 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
807 GET_NEXT(tmp); |
1584 | 808 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
809 ms->auth = g_strdup(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
810 ms->fd = proxy_connect(host, port, msn_ss_xfr_connect, ms); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
811 } else { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
812 close(md->fd); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
813 gdk_input_remove(md->inpa); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
814 md->inpa = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
815 md->fd = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
816 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
817 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
818 } else if (isdigit(*buf)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
819 handle_errcode(buf, TRUE); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
820 } else { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
821 debug_printf("Unhandled message!\n"); |
1584 | 822 } |
823 } | |
824 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
825 static void msn_login_xfr_connect(gpointer data, gint source, GdkInputCondition cond) |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
826 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
827 struct gaim_connection *gc = data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
828 struct msn_data *md; |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
829 char buf[MSN_BUF_LEN]; |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
830 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
831 if (!g_slist_find(connections, gc)) |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
832 return; |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
833 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
834 md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
835 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
836 if (md->fd != source) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
837 md->fd = source; |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
838 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
839 if (md->fd == -1) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
840 hide_login_progress(gc, "Unable to connect to Notification Server"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
841 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
842 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
843 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
844 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
845 g_snprintf(buf, sizeof(buf), "USR %d MD5 I %s\n", ++md->trId, gc->username); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
846 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
847 hide_login_progress(gc, "Unable to talk to Notification Server"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
848 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
849 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
850 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
851 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
852 md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_login_callback, gc); |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
853 } |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
854 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
855 static void msn_login_callback(gpointer data, gint source, GdkInputCondition cond) |
1567 | 856 { |
857 struct gaim_connection *gc = data; | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
858 struct msn_data *md = gc->proto_data; |
1567 | 859 char buf[MSN_BUF_LEN]; |
860 int i = 0; | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
861 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
862 bzero(buf, sizeof(buf)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
863 while ((read(md->fd, buf + i, 1) > 0) && (buf[i++] != '\n')) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
864 if (i == sizeof(buf)) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
865 i--; /* yes i know this loses data but we shouldn't get messages this long |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
866 and it's better than possibly writing past our buffer */ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
867 if (i == 0 || buf[i - 1] != '\n') { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
868 hide_login_progress(gc, "Error reading from server"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
869 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
870 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
871 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
872 debug_printf("S: %s", buf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
873 g_strchomp(buf); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
874 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
875 if (!g_strncasecmp(buf, "VER", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
876 /* we got VER, check to see that MSNP2 is in the list, then send INF */ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
877 if (!strstr(buf, "MSNP2")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
878 hide_login_progress(gc, "Protocol not supported"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
879 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
880 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
881 } |
1259 | 882 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
883 g_snprintf(buf, sizeof(buf), "INF %d\n", ++md->trId); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
884 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
885 hide_login_progress(gc, "Unable to request INF\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
886 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
887 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
888 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
889 } else if (!g_strncasecmp(buf, "INF", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
890 /* check to make sure we can use md5 */ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
891 if (!strstr(buf, "MD5")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
892 hide_login_progress(gc, "Unable to login using MD5"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
893 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
894 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
895 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
896 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
897 g_snprintf(buf, sizeof(buf), "USR %d MD5 I %s\n", ++md->trId, gc->username); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
898 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
899 hide_login_progress(gc, "Unable to send USR\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
900 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
901 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
902 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
903 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
904 set_login_progress(gc, 3, "Requesting to send password"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
905 } else if (!g_strncasecmp(buf, "USR", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
906 /* so here, we're either getting the challenge or the OK */ |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
907 if (strstr(buf, "OK")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
908 g_snprintf(buf, sizeof(buf), "SYN %d 0\n", ++md->trId); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
909 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
910 hide_login_progress(gc, "Unable to write"); |
1588 | 911 signoff(gc); |
1984
e90a0164436c
[gaim-migrate @ 1994]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1982
diff
changeset
|
912 return; |
1588 | 913 } |
914 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
915 g_snprintf(buf, sizeof(buf), "CHG %d NLN\n", ++md->trId); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
916 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
917 hide_login_progress(gc, "Unable to write"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
918 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
919 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
920 } |
1567 | 921 |
1987
a47327740514
[gaim-migrate @ 1997]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1986
diff
changeset
|
922 g_snprintf(buf, sizeof(buf), "BLP %d AL\n", ++md->trId); |
a47327740514
[gaim-migrate @ 1997]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1986
diff
changeset
|
923 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
a47327740514
[gaim-migrate @ 1997]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1986
diff
changeset
|
924 hide_login_progress(gc, "Unable to write"); |
a47327740514
[gaim-migrate @ 1997]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1986
diff
changeset
|
925 signoff(gc); |
a47327740514
[gaim-migrate @ 1997]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1986
diff
changeset
|
926 return; |
a47327740514
[gaim-migrate @ 1997]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1986
diff
changeset
|
927 } |
a47327740514
[gaim-migrate @ 1997]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1986
diff
changeset
|
928 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
929 account_online(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
930 serv_finish_login(gc); |
1569 | 931 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
932 gdk_input_remove(md->inpa); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
933 md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_callback, gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
934 } else if (strstr(buf, "MD5")) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
935 char *challenge = buf; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
936 char buf2[MSN_BUF_LEN]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
937 md5_state_t st; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
938 md5_byte_t di[16]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
939 int spaces = 4; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
940 int i; |
1569 | 941 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
942 while (spaces) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
943 if (isspace(*challenge)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
944 spaces--; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
945 while (isspace(challenge[1])) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
946 challenge++; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
947 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
948 challenge++; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
949 } |
1833 | 950 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
951 g_snprintf(buf2, sizeof(buf2), "%s%s", challenge, gc->password); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
952 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
953 md5_init(&st); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
954 md5_append(&st, (const md5_byte_t *)buf2, strlen(buf2)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
955 md5_finish(&st, di); |
1833 | 956 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
957 g_snprintf(buf, sizeof(buf), "USR %d MD5 S ", ++md->trId); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
958 for (i = 0; i < 16; i++) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
959 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
960 strcat(buf, buf2); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
961 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
962 strcat(buf, "\n"); |
1628 | 963 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
964 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
965 hide_login_progress(gc, "Unable to send password"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
966 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
967 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
968 } |
1628 | 969 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
970 set_login_progress(gc, 4, "Password sent"); |
1628 | 971 } |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
972 } else if (!g_strncasecmp(buf, "XFR", 3)) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
973 char *host = strstr(buf, "NS"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
974 int port; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
975 int i = 0; |
1572 | 976 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
977 if (!host) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
978 hide_login_progress(gc, "Got invalid XFR\n"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
979 signoff(gc); |
1572 | 980 return; |
981 } | |
982 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
983 GET_NEXT(host); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
984 while (host[i] && host[i] != ':') i++; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
985 if (host[i] == ':') { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
986 char *x = &host[i + 1]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
987 host[i] = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
988 port = atoi(x); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
989 } else |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
990 port = 1863; |
1584 | 991 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
992 close(md->fd); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
993 gdk_input_remove(md->inpa); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
994 md->inpa = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
995 md->fd = 0; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
996 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
997 } else { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
998 if (isdigit(*buf)) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
999 hide_login_progress(gc, handle_errcode(buf, FALSE)); |
1628 | 1000 else |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1001 hide_login_progress(gc, "Unable to parse message"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1002 signoff(gc); |
1628 | 1003 return; |
1004 } | |
1259 | 1005 } |
1006 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1007 static void msn_login_connect(gpointer data, gint source, GdkInputCondition cond) |
1282 | 1008 { |
1567 | 1009 struct gaim_connection *gc = data; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1010 struct msn_data *md; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1011 char buf[1024]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1012 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1013 if (!g_slist_find(connections, gc)) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1014 return; |
1282 | 1015 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1016 md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1017 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1018 if (md->fd != source) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1019 md->fd = source; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1020 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1021 if (md->fd == -1) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1022 hide_login_progress(gc, "Unable to connect"); |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1023 signoff(gc); |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1024 return; |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1025 } |
1567 | 1026 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1027 g_snprintf(buf, sizeof(buf), "VER %d MSNP2\n", ++md->trId); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1028 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1029 hide_login_progress(gc, "Unable to write to server"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1030 signoff(gc); |
1567 | 1031 return; |
1032 } | |
1033 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1034 md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_login_callback, gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1035 set_login_progress(gc, 2, "Synching with server"); |
1259 | 1036 } |
1037 | |
1891
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
1038 static void msn_login(struct aim_user *user) |
1282 | 1039 { |
1567 | 1040 struct gaim_connection *gc = new_gaim_conn(user); |
1041 struct msn_data *md = gc->proto_data = g_new0(struct msn_data, 1); | |
1282 | 1042 |
1043 set_login_progress(gc, 1, "Connecting"); | |
1259 | 1044 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1045 g_snprintf(gc->username, sizeof(gc->username), "%s", msn_normalize(gc->username)); |
1567 | 1046 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1047 md->fd = proxy_connect("messenger.hotmail.com", 1863, msn_login_connect, gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1048 } |
1282 | 1049 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1050 static void msn_close(struct gaim_connection *gc) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1051 { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1052 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1053 close(md->fd); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1054 if (md->inpa) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1055 gdk_input_remove(md->inpa); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1056 while (md->switches) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1057 msn_kill_switch(md->switches->data); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1058 while (md->fl) { |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
1059 struct msn_buddy *tmp = md->fl->data; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1060 md->fl = g_slist_remove(md->fl, tmp); |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
1061 g_free(tmp->user); |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
1062 g_free(tmp->friend); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1063 g_free(tmp); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1064 } |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1065 g_free(md); |
1284 | 1066 } |
1067 | |
1891
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
1068 static void msn_send_im(struct gaim_connection *gc, char *who, char *message, int away) |
1584 | 1069 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1070 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1071 struct msn_switchboard *ms = msn_find_switch(gc, who); |
1584 | 1072 char buf[MSN_BUF_LEN]; |
1073 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1074 if (ms) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1075 g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s", ++ms->trId, |
1988
2bb74a5a574f
[gaim-migrate @ 1998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1987
diff
changeset
|
1076 strlen(MIME_HEADER) + strlen(message), |
2bb74a5a574f
[gaim-migrate @ 1998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1987
diff
changeset
|
1077 MIME_HEADER, message); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1078 if (msn_write(ms->fd, buf, strlen(buf)) < 0) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1079 msn_kill_switch(ms); |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
1080 debug_printf("\n"); |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1081 } else { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1082 g_snprintf(buf, MSN_BUF_LEN, "XFR %d SB\n", ++md->trId); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1083 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1084 hide_login_progress(gc, "Write error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1085 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1086 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1087 } |
1584 | 1088 |
2014
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
1089 ms = g_new0(struct msn_switchboard, 1); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
1090 md->switches = g_slist_append(md->switches, ms); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
1091 ms->user = g_strdup(who); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
1092 ms->txqueue = g_strdup(message); |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
1093 ms->gc = gc; |
162f749ee5e7
[gaim-migrate @ 2024]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1994
diff
changeset
|
1094 ms->fd = -1; |
1585 | 1095 } |
1598 | 1096 } |
1097 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1098 static GList *msn_away_states() |
1630 | 1099 { |
1100 GList *m = NULL; | |
1101 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1102 m = g_list_append(m, "Available"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1103 m = g_list_append(m, "Away From Computer"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1104 m = g_list_append(m, "Be Right Back"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1105 m = g_list_append(m, "Busy"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1106 m = g_list_append(m, "On The Phone"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1107 m = g_list_append(m, "Out To Lunch"); |
1630 | 1108 |
1109 return m; | |
1110 } | |
1111 | |
1600 | 1112 static void msn_set_away(struct gaim_connection *gc, char *state, char *msg) |
1113 { | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1114 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1115 char buf[MSN_BUF_LEN]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1116 char *away; |
1630 | 1117 |
1118 gc->away = NULL; | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1119 |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1120 if (msg) { |
1630 | 1121 gc->away = ""; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1122 away = "AWY"; |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1123 } else if (state) { |
1630 | 1124 gc->away = ""; |
1125 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1126 if (!strcmp(state, "Away From Computer")) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1127 away = "AWY"; |
1630 | 1128 else if (!strcmp(state, "Be Right Back")) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1129 away = "BRB"; |
1630 | 1130 else if (!strcmp(state, "Busy")) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1131 away = "BSY"; |
1630 | 1132 else if (!strcmp(state, "On The Phone")) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1133 away = "PHN"; |
1630 | 1134 else if (!strcmp(state, "Out To Lunch")) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1135 away = "LUN"; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1136 else { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1137 gc->away = NULL; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1138 away = "NLN"; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1139 } |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1140 } else if (gc->is_idle) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1141 away = "IDL"; |
1600 | 1142 else |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1143 away = "NLN"; |
1600 | 1144 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1145 g_snprintf(buf, sizeof(buf), "CHG %d %s\n", ++md->trId, away); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1146 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1147 hide_login_progress(gc, "Write error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1148 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1149 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1150 } |
1600 | 1151 } |
1152 | |
1153 static void msn_set_idle(struct gaim_connection *gc, int idle) | |
1154 { | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1155 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1156 char buf[MSN_BUF_LEN]; |
1600 | 1157 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1158 if (gc->away) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1159 return; |
1600 | 1160 if (idle) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1161 g_snprintf(buf, sizeof(buf), "CHG %d IDL\n", ++md->trId); |
1600 | 1162 else |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1163 g_snprintf(buf, sizeof(buf), "CHG %d NLN\n", ++md->trId); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1164 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1165 hide_login_progress(gc, "Write error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1166 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1167 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1168 } |
1600 | 1169 } |
1170 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1171 static char **msn_list_icon(int uc) |
1600 | 1172 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1173 if (uc == UC_NORMAL) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1174 return msn_online_xpm; |
1600 | 1175 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1176 return msn_away_xpm; |
1600 | 1177 } |
1178 | |
1639 | 1179 static char *msn_get_away_text(int s) |
1180 { | |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1181 switch (s) { |
1639 | 1182 case MSN_BUSY : |
1183 return "Busy"; | |
1184 case MSN_BRB : | |
1185 return "Be right back"; | |
1186 case MSN_AWAY : | |
1187 return "Away from the computer"; | |
1188 case MSN_PHONE : | |
1189 return "On the phone"; | |
1190 case MSN_LUNCH : | |
1191 return "Out to lunch"; | |
1640 | 1192 case MSN_IDLE : |
1193 return "Idle"; | |
1639 | 1194 default: |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1195 return "Available"; |
1639 | 1196 } |
1197 } | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1198 |
1639 | 1199 static void msn_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) |
1200 { | |
1201 struct buddy *b = find_buddy(gc, who); | |
1202 char buf[MSN_BUF_LEN]; | |
1203 GtkWidget *button; | |
1204 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1205 if (!b || !(b->uc >> 5)) |
1639 | 1206 return; |
1207 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1208 g_snprintf(buf, sizeof(buf), "Status: %s", msn_get_away_text(b->uc >> 5)); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1209 |
1639 | 1210 button = gtk_menu_item_new_with_label(buf); |
1211 gtk_menu_append(GTK_MENU(menu), button); | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1212 gtk_widget_show(button); |
1639 | 1213 } |
1214 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1215 struct mod_usr_opt { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1216 struct aim_user *user; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1217 int opt; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1218 }; |
1717 | 1219 |
1220 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m) | |
1221 { | |
1222 if (m->user) { | |
1223 if (m->user->proto_opt[m->opt][0] == '1') | |
1224 m->user->proto_opt[m->opt][0] = '\0'; | |
1225 else | |
1226 strcpy(m->user->proto_opt[m->opt],"1"); | |
1227 } | |
1228 } | |
1229 | |
1230 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) | |
1231 { | |
1232 g_free(m); | |
1233 } | |
1234 | |
1235 static GtkWidget *msn_protoopt_button(const char *text, struct aim_user *u, int option, GtkWidget *box) | |
1236 { | |
1237 GtkWidget *button; | |
1238 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1); | |
1239 button = gtk_check_button_new_with_label(text); | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1240 if (u) |
1717 | 1241 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->proto_opt[option][0] == '1')); |
1242 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); | |
1243 muo->user = u; | |
1244 muo->opt = option; | |
1245 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); | |
1246 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); | |
1247 gtk_widget_show(button); | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1248 |
1717 | 1249 return button; |
1250 } | |
1251 | |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1252 static void msn_user_opts(GtkWidget* book, struct aim_user *user) |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1253 { |
1717 | 1254 GtkWidget *vbox; |
1255 | |
1256 vbox = gtk_vbox_new(FALSE, 5); | |
1257 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1258 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("MSN Options")); |
1717 | 1259 gtk_widget_show(vbox); |
1851
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1260 |
97a097e00139
[gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1833
diff
changeset
|
1261 msn_protoopt_button("Notify me of new HotMail",user,USEROPT_HOTMAIL,vbox); |
1717 | 1262 } |
1263 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1264 static void msn_add_buddy(struct gaim_connection *gc, char *who) |
1717 | 1265 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1266 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1267 char buf[MSN_BUF_LEN]; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1268 GSList *l = md->fl; |
1717 | 1269 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1270 while (l) { |
1991
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
1271 struct msn_buddy *b = l->data; |
308bd76c57db
[gaim-migrate @ 2001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1990
diff
changeset
|
1272 if (!g_strcasecmp(who, b->user)) |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1273 break; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1274 l = l->next; |
1717 | 1275 } |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1276 if (l) |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1277 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1278 |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1279 g_snprintf(buf, sizeof(buf), "ADD %d FL %s %s\n", ++md->trId, who, who); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1280 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1281 hide_login_progress(gc, "Write error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1282 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1283 return; |
1717 | 1284 } |
1285 } | |
1286 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1287 static void msn_rem_buddy(struct gaim_connection *gc, char *who) |
1833 | 1288 { |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1289 struct msn_data *md = gc->proto_data; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1290 char buf[MSN_BUF_LEN]; |
1833 | 1291 |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1292 g_snprintf(buf, sizeof(buf), "REM %d FL %s\n", ++md->trId, who); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1293 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1294 hide_login_progress(gc, "Write error"); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1295 signoff(gc); |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1296 return; |
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1297 } |
1572 | 1298 } |
1299 | |
1259 | 1300 static struct prpl *my_protocol = NULL; |
1301 | |
1891
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
1302 static void msn_init(struct prpl *ret) |
1282 | 1303 { |
1259 | 1304 ret->protocol = PROTO_MSN; |
1305 ret->name = msn_name; | |
1572 | 1306 ret->list_icon = msn_list_icon; |
1639 | 1307 ret->buddy_menu = msn_buddy_menu; |
1717 | 1308 ret->user_opts = msn_user_opts; |
1259 | 1309 ret->login = msn_login; |
1600 | 1310 ret->close = msn_close; |
1584 | 1311 ret->send_im = msn_send_im; |
1630 | 1312 ret->away_states = msn_away_states; |
1600 | 1313 ret->set_away = msn_set_away; |
1314 ret->set_idle = msn_set_idle; | |
1598 | 1315 ret->add_buddy = msn_add_buddy; |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1316 ret->remove_buddy = msn_rem_buddy; |
1756 | 1317 ret->normalize = msn_normalize; |
1259 | 1318 |
1319 my_protocol = ret; | |
1320 } | |
1321 | |
1985
008a4cc4a82c
[gaim-migrate @ 1995]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1984
diff
changeset
|
1322 char *gaim_plugin_init(GModule *handle) |
1282 | 1323 { |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1327
diff
changeset
|
1324 load_protocol(msn_init, sizeof(struct prpl)); |
1259 | 1325 return NULL; |
1326 } | |
1327 | |
1282 | 1328 void gaim_plugin_remove() |
1329 { | |
1259 | 1330 struct prpl *p = find_prpl(PROTO_MSN); |
1331 if (p == my_protocol) | |
1332 unload_protocol(p); | |
1333 } |