annotate plugins/msn/msn.c @ 1881:a02584b98823

[gaim-migrate @ 1891] C:) committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 23 May 2001 07:59:05 +0000
parents 466fc4ada7cb
children 1c977d995da9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim - MSN Protocol Plugin
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 2000, Rob Flynn <rob@tgflinux.com>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
1514
0dd012166152 [gaim-migrate @ 1524]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
22 #include "config.h"
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 #include <netdb.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <gtk/gtk.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <unistd.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <errno.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <netinet/in.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <arpa/inet.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <string.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <stdlib.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <stdio.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #include <time.h>
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
34 #include <fcntl.h>
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <sys/socket.h>
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include <sys/stat.h>
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
37 #include <sys/types.h>
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
38 #include <ctype.h>
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #include "multi.h"
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include "prpl.h"
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #include "gaim.h"
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
42 #include "proxy.h"
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 #include "md5.h"
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44
1284
ea91dbf089db [gaim-migrate @ 1294]
Rob Flynn <gaim@robflynn.com>
parents: 1283
diff changeset
45 #include "pixmaps/msn_online.xpm"
1285
f8557a227369 [gaim-migrate @ 1295]
Rob Flynn <gaim@robflynn.com>
parents: 1284
diff changeset
46 #include "pixmaps/msn_away.xpm"
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
47 #include "pixmaps/ok.xpm"
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
48 #include "pixmaps/cancel.xpm"
1284
ea91dbf089db [gaim-migrate @ 1294]
Rob Flynn <gaim@robflynn.com>
parents: 1283
diff changeset
49
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
50 #define MIME_HEADER "MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\nX-MMS-IM-Format: FN=MS%20Sans%20Serif; EF=; CO=0; CS=0; PF=0\r\n\r\n"
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
52 #define MSN_BUF_LEN 8192
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54 #define MSN_ONLINE 1
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 #define MSN_BUSY 2
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56 #define MSN_IDLE 3
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57 #define MSN_BRB 4
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
58 #define MSN_AWAY 5
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
59 #define MSN_PHONE 6
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
60 #define MSN_LUNCH 7
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61 #define MSN_OFFLINE 8
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
62 #define MSN_HIDDEN 9
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
64 #define MSN_SIGNON_GOT_XFR 0x0001
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
65 #define MSN_SIGNON_SENT_USR 0x0002
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
66
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
67 #define USEROPT_HOTMAIL 0
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
68
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
69 struct mod_usr_opt {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
70 struct aim_user *user;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
71 int opt;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
72 };
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
73
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
74 struct msn_ask_add_permit {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
75 struct gaim_connection *gc;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
76 char *user;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
77 char *friendly;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
78 };
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
79
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
80 struct msn_data {
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 int fd;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
82
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83 char protocol[6];
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84 char *friendly;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85 gchar *policy;
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
86 int inpa;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
87 int status;
1631
7f44a3f3a928 [gaim-migrate @ 1641]
Rob Flynn <gaim@robflynn.com>
parents: 1630
diff changeset
88 int away;
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
89 time_t last_trid;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
90 };
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
91
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
92 struct msn_name_dlg {
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
93 GtkWidget *window;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
94 GtkWidget *menu;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
95 struct aim_user *user;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
96 GtkWidget *entry;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
97 GtkWidget *ok;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
98 GtkWidget *cancel;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
99 };
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
100
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
101 struct msn_conn {
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
102 gchar *user;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
103 int inpa;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
104 int fd;
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
105 struct gaim_connection *gc;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
106 char *secret;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
107 char *session;
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
108 time_t last_trid;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
109 char *txqueue;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
110 };
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
111
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
112 GSList *msn_connections = NULL;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
113
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
114 unsigned long long globalc = 0;
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
115 static void msn_callback(gpointer data, gint source, GdkInputCondition condition);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
116 static void msn_add_permit(struct gaim_connection *gc, char *who);
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
117 static void process_hotmail_msg(struct gaim_connection *gc, gchar *msgdata);
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
118 void msn_des_win(GtkWidget *a, GtkWidget *b);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
119 void msn_newmail_dialog(const char *text);
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
120 static char *msn_normalize(const char *s);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
121
1754
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
122 char tochar(char *h)
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
123 {
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
124 char tmp;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
125 char b = 0;
1754
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
126 int v = 0;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
127 int i;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
128
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
129 for (i = strlen(h); i > 0; i--) {
1754
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
130 tmp = tolower(h[strlen(h) - i]);
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
131
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
132 if (tmp >= '0' && tmp <= '9')
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
133 b = tmp - '0';
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
134 else if (tmp >= 'a' && tmp <= 'f')
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
135 b = (tmp - 'a') + 10;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
136
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
137 if (i > 1)
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
138 v =+ ((i-1) * 16) * b;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
139 else
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
140 v += b;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
141 }
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
142
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
143 return v;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
144 }
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
145
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
146 char *url_decode(char *text)
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
147 {
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
148 static char newtext[MSN_BUF_LEN];
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
149 char *buf;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
150 int c = 0;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
151 int i = 0;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
152 int j = 0;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
153
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
154 for (i = 0; i < strlen(text); i++) {
1754
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
155 if (text[i] == '%')
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
156 c++;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
157 }
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
158
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
159 buf = (char *)malloc(strlen(text) + c + 1);
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
160
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
161 for (i = 0, j = 0 ; text[i] != 0; i++) {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
162 if (text[i] != '%') {
1754
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
163 buf[j++] = text[i];
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
164 } else {
1754
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
165 char hex[3];
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
166 hex[0] = text[++i];
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
167 hex[1] = text[++i];
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
168 hex[2] = 0;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
169
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
170 buf[j++] = tochar(hex);
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
171 }
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
172 }
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
173
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
174 buf[j] = 0;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
175
1754
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
176 for (i = 0; i < strlen(buf); i++)
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
177 newtext[i] = buf[i];
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
178
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
179 free(buf);
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
180
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
181 return newtext;
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
182 }
6e51e206a388 [gaim-migrate @ 1764]
Rob Flynn <gaim@robflynn.com>
parents: 1733
diff changeset
183
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
184 void msn_accept_add_permit(gpointer w, struct msn_ask_add_permit *ap)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
185 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
186 msn_add_permit(ap->gc, ap->user);
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
187 /* leak if we don't free these? */
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
188 g_free(ap->user);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
189 g_free(ap->friendly);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
190 g_free(ap);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
191 }
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
192
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
193 void msn_cancel_add_permit(gpointer w, struct msn_ask_add_permit *ap)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
194 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
195 g_free(ap->user);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
196 g_free(ap->friendly);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
197 g_free(ap);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
198 }
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
199
1588
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
200 void free_msn_conn(struct msn_conn *mc)
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
201 {
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
202 if (mc->user)
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
203 free(mc->user);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
204
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
205 if (mc->secret)
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
206 free(mc->secret);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
207
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
208 if (mc->session)
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
209 free(mc->session);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
210
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
211 if (mc->txqueue)
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
212 free(mc->txqueue);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
213
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
214 gdk_input_remove(mc->inpa);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
215 close(mc->fd);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
216
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
217 msn_connections = g_slist_remove(msn_connections, mc);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
218
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
219 g_free(mc);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
220 }
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
221
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
222
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
223 struct msn_conn *find_msn_conn_by_user(gchar * user)
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
224 {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
225 struct msn_conn *mc;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
226 GSList *conns = msn_connections;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
227
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
228 while (conns) {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
229 mc = (struct msn_conn *)conns->data;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
230
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
231 if (mc != NULL) {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
232 if (strcasecmp(mc->user, user) == 0) {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
233 return mc;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
234 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
235 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
236
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
237 conns = g_slist_next(conns);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
238 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
239
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
240 return NULL;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
241 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
242
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
243 struct msn_conn *find_msn_conn_by_trid(time_t trid)
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
244 {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
245 struct msn_conn *mc;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
246 GSList *conns = msn_connections;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
247
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
248 while (conns) {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
249 mc = (struct msn_conn *)conns->data;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
250
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
251 if (mc != NULL) {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
252
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
253 debug_printf("Comparing: %d <==> %d\n", mc->last_trid, trid);
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
254 if (mc->last_trid == trid) {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
255 return mc;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
256 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
257 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
258
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
259 conns = g_slist_next(conns);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
260 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
261
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
262 return NULL;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
263 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
264
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
265 static char *msn_name()
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
266 {
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
267 return "MSN";
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
268 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
269
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
270 char *name()
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
271 {
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
272 return "MSN";
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
273 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
274
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
275 char *description()
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
276 {
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
277 return "Allows gaim to use the MSN protocol. For some reason, this frightens me.";
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
278 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
279
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
280 time_t trId(struct msn_data *md)
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
281 {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
282 md->last_trid = time((time_t *)NULL) + globalc++;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
283 return md->last_trid;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
284 }
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
285
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
286 void msn_write(int fd, char *buf)
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
287 {
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
288 write(fd, buf, strlen(buf));
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
289 debug_printf("MSN(%d) <== %s", fd, buf);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
290 }
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
291
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
292 void msn_add_request(struct gaim_connection *gc, char *buf)
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
293 {
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
294 char **res;
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
295
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
296 res = g_strsplit(buf, " ", 0);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
297
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
298 if (!strcasecmp(res[2], "RL")) {
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
299 struct msn_ask_add_permit *ap = g_new0(struct msn_ask_add_permit, 1);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
300
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
301 snprintf(buf, MSN_BUF_LEN, "The user %s (%s) wants to add you to their buddylist.", res[4], res[5]);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
302
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
303 ap->user = g_strdup(res[4]);
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
304
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
305 ap->friendly = g_strdup(url_decode(res[5]));
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
306 ap->gc = gc;
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
307
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
308 do_ask_dialog(buf, ap, (GtkFunction) msn_accept_add_permit, (GtkFunction) msn_cancel_add_permit);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
309 }
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
310
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
311 g_strfreev(res);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
312 }
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
314 static void msn_answer_callback(gpointer data, gint source, GdkInputCondition condition)
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
315 {
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
316 struct msn_conn *mc = data;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
317 char buf[MSN_BUF_LEN];
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
318
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
319 if (source == -1) {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
320 g_free(mc->session);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
321 g_free(mc->secret);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
322 g_free(mc->user);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
323 g_free(mc);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
324 return;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
325 }
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
326
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
327 if (mc->fd != source)
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
328 mc->fd = source;
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
329
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
330 g_snprintf(buf, MSN_BUF_LEN, "ANS 1 %s %s %s\n",mc->gc->username, mc->secret, mc->session);
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
331 msn_write(mc->fd, buf);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
332
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
333 mc->inpa = gdk_input_add(mc->fd, GDK_INPUT_READ, msn_callback, mc->gc);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
334
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
335 /* Append our connection */
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
336 msn_connections = g_slist_append(msn_connections, mc);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
337 }
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
338
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
339 static void msn_invite_callback(gpointer data, gint source, GdkInputCondition condition)
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
340 {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
341 struct msn_conn *mc = data;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
342 struct msn_data *md = (struct msn_data *)mc->gc->proto_data;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
343 char buf[MSN_BUF_LEN];
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
344 int i = 0;
1585
f367ea8020fb [gaim-migrate @ 1595]
Rob Flynn <gaim@robflynn.com>
parents: 1584
diff changeset
345
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
346 bzero(buf, MSN_BUF_LEN);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
347 do {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
348 if (!read(source, buf + i, 1)) {
1588
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
349 free_msn_conn(mc);
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
350 return;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
351 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
352 } while (buf[i++] != '\n');
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
353
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
354 g_strchomp(buf);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
355
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
356 debug_printf("MSN(%d) ==> %s\n", source, buf);
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
357
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
358 if (!strncmp("USR ", buf, 4)) {
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
359 char **res;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
360
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
361 res = g_strsplit(buf, " ", 0);
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
362 debug_printf("%s\n",res[2]);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
363 if (strcasecmp("OK", res[2])) {
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
364 g_strfreev(res);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
365 close(mc->fd);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
366 return;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
367 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
368
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
369 /* We've authorized. Let's send an invite request */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
370 g_snprintf(buf, MSN_BUF_LEN, "CAL %ld %s\n", trId(md), mc->user);
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
371 msn_write(source, buf);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
372 return;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
373 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
374
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
375 else if (!strncmp("JOI ", buf, 4)) {
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
376 /* Looks like they just joined! Write their queued message */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
377 g_snprintf(buf, MSN_BUF_LEN, "MSG %ld N %d\r\n%s%s", trId(md), strlen(mc->txqueue) + strlen(MIME_HEADER), MIME_HEADER, mc->txqueue);
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
378
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
379 msn_write(source, buf);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
380
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
381 gdk_input_remove(mc->inpa);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
382 mc->inpa = gdk_input_add(mc->fd, GDK_INPUT_READ, msn_callback, mc->gc);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
383
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
384 return;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
385
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
386 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
387 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
388
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
389 static void msn_xfr_callback(gpointer data, gint source, GdkInputCondition condition)
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
390 {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
391 struct msn_conn *mc = data;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
392 char buf[MSN_BUF_LEN];
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
393
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
394 if (source == -1)
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
395 return;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
396
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
397 if (mc->fd != source)
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
398 mc->fd = source;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
399
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
400 mc->inpa = gdk_input_add(mc->fd, GDK_INPUT_READ, msn_invite_callback, mc);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
401 g_snprintf(buf, MSN_BUF_LEN, "USR %ld %s %s\n", mc->last_trid, mc->gc->username, mc->secret);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
402 msn_write(mc->fd, buf);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
403 }
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
404
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
405 static void msn_callback(gpointer data, gint source, GdkInputCondition condition)
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
406 {
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
407 struct gaim_connection *gc = data;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
408 struct msn_data *md = (struct msn_data *)gc->proto_data;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
409 char buf[MSN_BUF_LEN];
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
410 int i = 0;
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
411 int num;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
412
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
413 bzero(buf, MSN_BUF_LEN);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
414
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
415 do {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
416 if (!read(source, buf + i, 1)) {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
417 if (md->fd == source) {
1588
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
418 hide_login_progress(gc, "Read error");
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
419 signoff(gc);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
420 }
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
421
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
422 close(source);
2a3cac07e69d [gaim-migrate @ 1598]
Rob Flynn <gaim@robflynn.com>
parents: 1586
diff changeset
423
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
424 return;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
425 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
426
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
427 } while (buf[i++] != '\n');
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
428
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
429 g_strchomp(buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
430
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
431 debug_printf("MSN(%d) ==> %s\n", source, buf);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
432
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
433 if (!strncmp("NLN ", buf, 4) || !strncmp("ILN ", buf, 4)) {
1569
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
434 int status;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
435 int query;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
436 char **res;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
437
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
438 res = g_strsplit(buf, " ", 0);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
439
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
440 if (!strcmp(res[0], "NLN"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
441 query = 1;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
442 else
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
443 query = 2;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
444
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
445 if (!strcasecmp(res[query], "NLN"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
446 status = UC_NORMAL;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
447 else if (!strcasecmp(res[query], "BSY"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
448 status = UC_NORMAL | (MSN_BUSY << 5);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
449 else if (!strcasecmp(res[query], "IDL"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
450 status = UC_NORMAL | (MSN_IDLE << 5);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
451 else if (!strcasecmp(res[query], "BRB"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
452 status = UC_NORMAL | (MSN_BRB << 5);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
453 else if (!strcasecmp(res[query], "AWY"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
454 status = UC_UNAVAILABLE;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
455 else if (!strcasecmp(res[query], "PHN"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
456 status = UC_NORMAL | (MSN_PHONE << 5);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
457 else if (!strcasecmp(res[query], "LUN"))
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
458 status = UC_NORMAL | (MSN_LUNCH << 5);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
459 else
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
460 status = UC_NORMAL;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
461
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
462 serv_got_update(gc, res[query+1], 1, 0, 0, 0, status, 0);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
463
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
464 g_strfreev(res);
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
465
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
466 return;
446536be85dd [gaim-migrate @ 1579]
Rob Flynn <gaim@robflynn.com>
parents: 1568
diff changeset
467
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
468 } else if (!strncmp("REA ", buf, 4)) {
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
469 char **res;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
470
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
471 res = g_strsplit(buf, " ", 0);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
472
1864
5cb89cf24f45 [gaim-migrate @ 1874]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1851
diff changeset
473 /* Kill the old one */
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
474 g_free(md->friendly);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
475
1864
5cb89cf24f45 [gaim-migrate @ 1874]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1851
diff changeset
476 /* Set the new one */
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
477 md->friendly = g_strdup(res[4]);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
478
1864
5cb89cf24f45 [gaim-migrate @ 1874]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1851
diff changeset
479 /* And free up some memory. That's all, folks. */
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
480 g_strfreev(res);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
481 } else if (!strncmp("BYE ", buf, 4)) {
1628
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
482 char **res;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
483 struct msn_conn *mc;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
484
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
485 res = g_strsplit(buf, " ", 0);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
486
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
487 mc = find_msn_conn_by_user(res[1]);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
488
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
489 if (mc) {
1628
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
490 /* Looks like we need to close up some stuff :-) */
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
491 free_msn_conn(mc);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
492 }
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
493
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
494 g_strfreev(res);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
495 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
496 } else if (!strncmp("MSG ", buf, 4)) {
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
497 /* We are receiving an incoming message */
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
498 gchar **res;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
499 gchar *user;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
500 gchar *msgdata;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
501 int size;
1731
7fc4b9fe295a [gaim-migrate @ 1741]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1717
diff changeset
502 char rahc[MSN_BUF_LEN * 2];
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
503
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
504 res = g_strsplit(buf, " ", 0);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
505
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
506 user = g_strdup(res[1]);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
507 size = atoi(res[3]);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
508
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
509 /* Ok, we know who we're receiving a message from as well as
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
510 * how big the message is */
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
511
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
512 msgdata = (gchar *)g_malloc(sizeof(gchar) *(size + 1));
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
513 num = recv(source, msgdata, size, 0);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
514 msgdata[size] = 0;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
515
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
516 if (num < size)
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
517 debug_printf("MSN: Uhh .. we gots a problem!. Expected %d but got %d.\n", size, num);
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
518
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
519 /* We should ignore messages from the user Hotmail */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
520 if (!strcasecmp("hotmail", res[1])) {
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
521 process_hotmail_msg(gc,msgdata);
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
522 g_strfreev(res);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
523 g_free(msgdata);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
524 return;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
525 }
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
526
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
527 /* Check to see if any body is in the message */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
528 if (!strcmp(strstr(msgdata, "\r\n\r\n") + 4, "\r\n")) {
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
529 g_strfreev(res);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
530 g_free(msgdata);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
531 return;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
532 }
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
533
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
534 /* Otherwise, everything is ok. Let's show the message. Skipping,
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
535 * of course, the header. */
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
536
1731
7fc4b9fe295a [gaim-migrate @ 1741]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1717
diff changeset
537 g_snprintf(rahc, sizeof(rahc), "%s", strstr(msgdata, "\r\n\r\n") + 4);
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1756
diff changeset
538 serv_got_im(gc, res[1], rahc, 0, time((time_t)NULL));
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
539
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
540 g_strfreev(res);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
541 g_free(msgdata);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
542
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
543 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
544 } else if (!strncmp("RNG ", buf, 4)) {
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
545 /* Ok, someone wants to talk to us. Ring ring? Hi!!! */
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
546 gchar **address;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
547 gchar **res;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
548 struct msn_conn *mc = g_new0(struct msn_conn, 1);
1864
5cb89cf24f45 [gaim-migrate @ 1874]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1851
diff changeset
549 struct aim_user *user = gc->user;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
550 mc->gc = gc;
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
551
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
552 res = g_strsplit(buf, " ", 0);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
553 address = g_strsplit(res[2], ":", 0);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
554
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
555 /* Set up our struct with user and input watcher */
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
556 mc->user = g_strdup(res[5]);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
557 mc->secret = g_strdup(res[4]);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
558 mc->session = g_strdup(res[1]);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
559
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1866
diff changeset
560 mc->fd = proxy_connect(address[0], atoi(address[1]), msn_answer_callback, mc);
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
561 g_strfreev(address);
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
562 g_strfreev(res);
1866
466fc4ada7cb [gaim-migrate @ 1876]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1864
diff changeset
563 if (!user->gc || (mc->fd < 0)) {
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
564 /* Looks like we had an error connecting. */
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
565 g_free(mc->session);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
566 g_free(mc->secret);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
567 g_free(mc->user);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
568 g_free(mc);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
569 return;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
570 }
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
571 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
572 } else if (!strncmp("XFR ", buf, 4)) {
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
573 char **res;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
574 struct msn_conn *mc;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
575
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
576 res = g_strsplit(buf, " ", 0);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
577
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
578 debug_printf("Last trid is: %d\n", md->last_trid);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
579 debug_printf("This TrId is: %d\n", atoi(res[1]));
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
580
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
581 mc = find_msn_conn_by_trid(atoi(res[1]));
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
582
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
583 if (!mc) {
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
584 g_strfreev(res);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
585 return;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
586 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
587
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
588 strcpy(buf, res[3]);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
589
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
590 mc->secret = g_strdup(res[5]);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
591 mc->session = g_strdup(res[1]);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
592
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
593 g_strfreev(res);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
594
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
595 res = g_strsplit(buf, ":", 0);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
596
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
597 /* Now we have the host and port */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
598 debug_printf("Connecting to: %s:%s\n", res[0], res[1]);
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
599
1585
f367ea8020fb [gaim-migrate @ 1595]
Rob Flynn <gaim@robflynn.com>
parents: 1584
diff changeset
600 if (mc->inpa)
f367ea8020fb [gaim-migrate @ 1595]
Rob Flynn <gaim@robflynn.com>
parents: 1584
diff changeset
601 gdk_input_remove(mc->inpa);
f367ea8020fb [gaim-migrate @ 1595]
Rob Flynn <gaim@robflynn.com>
parents: 1584
diff changeset
602
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1866
diff changeset
603 mc->fd = proxy_connect(res[0], atoi(res[1]), msn_xfr_callback, mc);
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
604 g_strfreev(res);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
605
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
606 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
607 } else if (!strncmp("LST ", buf, 4)) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
608 char **res;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
609
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
610 res = g_strsplit(buf, " ", 0);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
611
1568
5a8c66de56b7 [gaim-migrate @ 1578]
Rob Flynn <gaim@robflynn.com>
parents: 1567
diff changeset
612 /* If we have zero buddies, abort */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
613 if (atoi(res[5]) == 0) {
1568
5a8c66de56b7 [gaim-migrate @ 1578]
Rob Flynn <gaim@robflynn.com>
parents: 1567
diff changeset
614 g_strfreev(res);
5a8c66de56b7 [gaim-migrate @ 1578]
Rob Flynn <gaim@robflynn.com>
parents: 1567
diff changeset
615 return;
5a8c66de56b7 [gaim-migrate @ 1578]
Rob Flynn <gaim@robflynn.com>
parents: 1567
diff changeset
616 }
5a8c66de56b7 [gaim-migrate @ 1578]
Rob Flynn <gaim@robflynn.com>
parents: 1567
diff changeset
617
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
618 /* First, let's check the list type */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
619 if (!strcmp("FL", res[2])) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
620 /* We're dealing with a forward list. Add them
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
621 * to our buddylist and continue along our
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
622 * merry little way */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
623
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
624 struct buddy *b;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
625
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
626 b = find_buddy(gc, res[6]);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
627
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
628 if (!b)
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
629 add_buddy(gc, "Buddies", res[6], res[7]);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
630 }
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
631
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
632 g_strfreev(res);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
633
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
634 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
635 } else if (!strncmp("FLN ", buf, 4)) {
1628
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
636 /* Someone signed off */
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
637 char **res;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
638
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
639 res = g_strsplit(buf, " ", 0);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
640
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
641 serv_got_update(gc, res[1], 0, 0, 0, 0, 0, 0);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
642
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
643 g_strfreev(res);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
644
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
645 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
646 } else if (!strncmp("ADD ", buf, 4)) {
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
647 msn_add_request(gc,buf);
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
648 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
649 } if ( (!strncmp("NLN ", buf, 4)) || (!strncmp("ILN ", buf, 4))) {
1628
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
650 int status;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
651 int query;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
652 char **res;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
653
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
654 res = g_strsplit(buf, " ", 0);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
655
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
656 if (strcasecmp(res[0], "NLN") == 0)
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
657 query = 1;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
658 else
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
659 query = 2;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
660
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
661 if (!strcasecmp(res[query], "NLN"))
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
662 status = UC_NORMAL;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
663 else if (!strcasecmp(res[query], "BSY"))
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
664 status = UC_NORMAL | (MSN_BUSY << 5);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
665 else if (!strcasecmp(res[query], "IDL"))
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
666 status = UC_NORMAL | (MSN_IDLE << 5);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
667 else if (!strcasecmp(res[query], "BRB"))
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
668 status = UC_NORMAL | (MSN_BRB << 5);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
669 else if (!strcasecmp(res[query], "AWY"))
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
670 status = UC_UNAVAILABLE;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
671 else if (!strcasecmp(res[query], "PHN"))
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
672 status = UC_NORMAL | (MSN_PHONE << 5);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
673 else if (!strcasecmp(res[query], "LUN"))
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
674 status = UC_NORMAL | (MSN_LUNCH << 5);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
675 else
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
676 status = UC_NORMAL;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
677
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
678 serv_got_update(gc, res[query+1], 1, 0, 0, 0, status, 0);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
679
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
680 g_strfreev(res);
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
681 return;
bde395f3dbf1 [gaim-migrate @ 1638]
Rob Flynn <gaim@robflynn.com>
parents: 1603
diff changeset
682 }
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
683
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
684 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
685
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
686 static void msn_login_callback(gpointer data, gint source, GdkInputCondition condition)
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
687 {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
688 struct gaim_connection *gc = data;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
689 struct msn_data *md = (struct msn_data *)gc->proto_data;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
690 char buf[MSN_BUF_LEN];
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
691 int i = 0;
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
692
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
693 if (source == -1) {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
694 signoff(gc);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
695 return;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
696 }
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
697
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
698 if (md->fd != source) {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
699 debug_printf("Eric, you fucked up.\n");
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
700 md->fd = source;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
701 }
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
702
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
703 if (!gc->inpa) {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
704 if (md->inpa > 0)
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
705 gdk_input_remove(md->inpa);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
706 md->inpa = 0;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
707
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
708 gc->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_login_callback, gc);
1307
751937b4f109 [gaim-migrate @ 1317]
Rob Flynn <gaim@robflynn.com>
parents: 1285
diff changeset
709
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
710 if (md->status & MSN_SIGNON_GOT_XFR) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
711 /* Looks like we were transfered here. Just send a sign on */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
712 set_login_progress(gc, 3, "Signing On");
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
713 g_snprintf(buf, MSN_BUF_LEN, "USR %ld %s I %s\n", md->last_trid, md->policy, gc->username);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
714 msn_write(md->fd, buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
715
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
716 /* Reset this bit */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
717 md->status ^= MSN_SIGNON_GOT_XFR;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
718 } else {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
719 /* Otherwise, send an initial request */
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
720 set_login_progress(gc, 2, "Verifying");
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
721
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
722 g_snprintf(md->protocol, 6, "MSNP2");
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
723
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
724 g_snprintf(buf, MSN_BUF_LEN, "VER %ld %s\n", trId(md), md->protocol);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
725 msn_write(md->fd, buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
726 }
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
727
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
728 return;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
729 }
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
730
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
731 bzero(buf, MSN_BUF_LEN);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
732
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
733 do {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
734 if (!read(source, buf + i, 1)) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
735 hide_login_progress(gc, "Read error");
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
736 signoff(gc);
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
737 return;
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
738 }
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
739 } while (buf[i++] != '\n');
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
740
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
741 g_strchomp(buf);
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
742
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
743 debug_printf("MSN ==> %s\n", buf);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
744
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
745 /* Check to see what was just sent back to us. We should be seeing a VER tag. */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
746 if (!strncmp("VER ", buf, 4) && (!strstr("MSNP2", buf))) {
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
747 /* Now that we got our ver, we should send a policy request */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
748 g_snprintf(buf, MSN_BUF_LEN, "INF %ld\n", trId(md));
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
749 msn_write(md->fd, buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
750
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
751 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
752 } else if (!strncmp("INF ", buf, 4)) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
753 char **res;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
754
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
755 /* Make a copy of our resulting policy */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
756 res = g_strsplit(buf, " ", 0);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
757 md->policy = g_strdup(res[2]);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
758
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
759 /* And send our signon packet */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
760 set_login_progress(gc, 3, "Signing On");
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
761
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
762 g_snprintf(buf, MSN_BUF_LEN, "USR %ld %s I %s\n", trId(md), md->policy, gc->username);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
763 msn_write(md->fd, buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
764
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
765 g_strfreev(res);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
766
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
767 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
768 } else if (!strncmp("ADD ", buf, 4)) {
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
769 msn_add_request(gc,buf);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
770 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
771 } else if (!strncmp("XFR ", buf, 4)) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
772 char **res;
1864
5cb89cf24f45 [gaim-migrate @ 1874]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1851
diff changeset
773 struct aim_user *user = gc->user;
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
774
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
775 res = g_strsplit(buf, " ", 0);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
776
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
777 strcpy(buf, res[3]);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
778
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
779 g_strfreev(res);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
780
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
781 res = g_strsplit(buf, ":", 0);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
782
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
783 close(md->fd);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
784
1603
b9f6f0190787 [gaim-migrate @ 1613]
Rob Flynn <gaim@robflynn.com>
parents: 1600
diff changeset
785 set_login_progress(gc, 3, "Connecting to Auth");
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
786
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
787
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
788 md->status |= MSN_SIGNON_GOT_XFR;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
789
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
790 gdk_input_remove(gc->inpa);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
791 gc->inpa = 0;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
792
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
793 /* Now we have the host and port */
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1866
diff changeset
794 md->fd = proxy_connect(res[0], atoi(res[1]), msn_login_callback, gc);
1866
466fc4ada7cb [gaim-migrate @ 1876]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1864
diff changeset
795 if (!user->gc || (md->fd < 0)) {
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
796 g_strfreev(res);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
797 hide_login_progress(gc, "Error connecting to server");
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
798 signoff(gc);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
799 return;
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
800 }
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
801
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
802 g_strfreev(res);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
803 return;
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
804 } else if (!strncmp("USR ", buf, 4)) {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
805 if (md->status & MSN_SIGNON_SENT_USR) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
806 char **res;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
807
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
808 res = g_strsplit(buf, " ", 0);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
809
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
810 if (strcasecmp("OK", res[2])) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
811 hide_login_progress(gc, "Error signing on");
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
812 signoff(gc);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
813 } else {
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
814 debug_printf("Before: %s\n", res[4]);
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
815 md->friendly = g_strdup(url_decode(res[4]));
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
816 debug_printf("After: %s\n", md->friendly);
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
817
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
818 /* Ok, ok. Your account is FINALLY online. Ya think Microsoft
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
819 * could have had any more steps involved? */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
820
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
821 set_login_progress(gc, 4, "Fetching config");
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
822
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
823 /* Sync our buddylist */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
824 g_snprintf(buf, MSN_BUF_LEN, "SYN %ld 0\n", trId(md));
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
825 msn_write(md->fd, buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
826
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
827 /* And set ourselves online */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
828 g_snprintf(buf, MSN_BUF_LEN, "CHG %ld NLN\n", trId(md));
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
829 msn_write(md->fd, buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
830
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
831 account_online(gc);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
832 serv_finish_login(gc);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
833
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
834 if (bud_list_cache_exists(gc))
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
835 do_import(NULL, gc);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
836
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
837 gdk_input_remove(gc->inpa);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
838 gc->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_callback, gc);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
839 }
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
840
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
841 g_strfreev(res);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
842 } else {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
843 char **res;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
844 char buf2[MSN_BUF_LEN];
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
845 md5_state_t st;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
846 md5_byte_t di[16];
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
847
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
848 res = g_strsplit(buf, " ", 0);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
849
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
850 /* Make a copy of our MD5 Hash key */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
851 strcpy(buf, res[4]);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
852
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
853 /* Generate our secret with our key and password */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
854 snprintf(buf2, MSN_BUF_LEN, "%s%s", buf, gc->password);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
855
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
856 md5_init(&st);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
857 md5_append(&st, (const md5_byte_t *)buf2, strlen(buf2));
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
858 md5_finish(&st, di);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
859
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
860 /* Now that we have the MD5 Hash, lets' hex encode this bad boy. I smoke bad crack. */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
861 sprintf(buf, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
862 di[0],di[1],di[2],di[3],di[4],di[5],di[6],di[7],di[8],di[9],di[10],di[11],di[12],
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
863 di[13],di[14],di[15]);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
864
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
865 /* And now, send our final sign on packet */
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
866 g_snprintf(buf2, MSN_BUF_LEN, "USR %s %s S %s\n", res[1], md->policy, buf);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
867 msn_write(md->fd, buf2);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
868
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
869 md->status |= MSN_SIGNON_SENT_USR;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
870
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
871 g_strfreev(res);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
872 }
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
873
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
874 return;
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
875 }
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
876 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
877
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
878 void msn_login(struct aim_user *user)
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
879 {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
880 struct gaim_connection *gc = new_gaim_conn(user);
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
881 struct msn_data *md = gc->proto_data = g_new0(struct msn_data, 1);
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
882
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
883 gc->inpa = 0;
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
884
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
885 set_login_progress(gc, 1, "Connecting");
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
886
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
887 while (gtk_events_pending())
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
888 gtk_main_iteration();
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
889
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
890 if (!g_slist_find(connections, gc))
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
891 return;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
892
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
893 md->status = 0;
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
894
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
895 sprintf(gc->username, "%s", msn_normalize(gc->username));
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1866
diff changeset
896 md->fd = proxy_connect("messenger.hotmail.com", 1863, msn_login_callback, gc);
1866
466fc4ada7cb [gaim-migrate @ 1876]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1864
diff changeset
897 if (!user->gc || (md->fd < 0)) {
1567
0357164dffd0 [gaim-migrate @ 1577]
Rob Flynn <gaim@robflynn.com>
parents: 1514
diff changeset
898 hide_login_progress(gc, "Error connecting to server");
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
899 signoff(gc);
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
900 return;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
901 }
1284
ea91dbf089db [gaim-migrate @ 1294]
Rob Flynn <gaim@robflynn.com>
parents: 1283
diff changeset
902 }
ea91dbf089db [gaim-migrate @ 1294]
Rob Flynn <gaim@robflynn.com>
parents: 1283
diff changeset
903
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
904 void msn_send_im(struct gaim_connection *gc, char *who, char *message, int away)
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
905 {
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
906 struct msn_conn *mc;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
907 struct msn_data *md = (struct msn_data *)gc->proto_data;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
908 char buf[MSN_BUF_LEN];
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
909
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
910 if (!g_strcasecmp(who, gc->username)) {
1733
4e51ddc6632f [gaim-migrate @ 1743]
Rob Flynn <gaim@robflynn.com>
parents: 1731
diff changeset
911 do_error_dialog("You can not send a message to yourself!", "Gaim: MSN Error");
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
912 return;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
913 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
914
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
915 mc = find_msn_conn_by_user(who);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
916
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
917 /* If we're not already in a conversation with
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
918 * this person then we have to do some tricky things. */
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
919
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
920 if (!mc) {
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
921 /* Request a new switchboard connection */
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
922 g_snprintf(buf, MSN_BUF_LEN, "XFR %ld SB\n", trId(md));
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
923 msn_write(md->fd, buf);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
924
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
925 mc = g_new0(struct msn_conn, 1);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
926
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
927 mc->user = g_strdup(who);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
928 mc->gc = gc;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
929 mc->last_trid = md->last_trid;
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
930 mc->txqueue = g_strdup(message);
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
931
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
932 /* Append our connection */
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
933 msn_connections = g_slist_append(msn_connections, mc);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
934 } else {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
935 g_snprintf(buf, MSN_BUF_LEN, "MSG %ld N %d\r\n%s%s", trId(md),
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
936 strlen(message) + strlen(MIME_HEADER), MIME_HEADER, message);
1585
f367ea8020fb [gaim-migrate @ 1595]
Rob Flynn <gaim@robflynn.com>
parents: 1584
diff changeset
937
f367ea8020fb [gaim-migrate @ 1595]
Rob Flynn <gaim@robflynn.com>
parents: 1584
diff changeset
938 msn_write(mc->fd, buf);
f367ea8020fb [gaim-migrate @ 1595]
Rob Flynn <gaim@robflynn.com>
parents: 1584
diff changeset
939 }
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
940
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
941 }
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
942
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
943 static void msn_add_buddy(struct gaim_connection *gc, char *who)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
944 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
945 struct msn_data *md = (struct msn_data *)gc->proto_data;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
946 char buf[MSN_BUF_LEN - 1];
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
947
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
948 snprintf(buf, MSN_BUF_LEN, "ADD %ld FL %s %s\n", trId(md), who, who);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
949 msn_write(md->fd, buf);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
950 }
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
951
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
952 static void msn_remove_buddy(struct gaim_connection *gc, char *who)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
953 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
954 struct msn_data *md = (struct msn_data *)gc->proto_data;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
955 char buf[MSN_BUF_LEN - 1];
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
956
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
957 snprintf(buf, MSN_BUF_LEN, "REM %ld FL %s\n", trId(md), who);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
958 msn_write(md->fd, buf);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
959 }
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
960
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
961 static void msn_rem_permit(struct gaim_connection *gc, char *who)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
962 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
963 struct msn_data *md = (struct msn_data *)gc->proto_data;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
964 char buf[MSN_BUF_LEN - 1];
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
965
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
966 snprintf(buf, MSN_BUF_LEN, "REM %ld AL %s\n", trId(md), who);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
967 msn_write(md->fd, buf);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
968 }
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
969
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
970 static void msn_add_permit(struct gaim_connection *gc, char *who)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
971 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
972 struct msn_data *md = (struct msn_data *)gc->proto_data;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
973 char buf[MSN_BUF_LEN - 1];
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
974
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
975 snprintf(buf, MSN_BUF_LEN, "ADD %ld AL %s %s\n", trId(md), who, who);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
976 msn_write(md->fd, buf);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
977 }
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
978
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
979 static void msn_rem_deny(struct gaim_connection *gc, char *who)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
980 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
981 struct msn_data *md = (struct msn_data *)gc->proto_data;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
982 char buf[MSN_BUF_LEN - 1];
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
983
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
984 snprintf(buf, MSN_BUF_LEN, "REM %ld BL %s\n", trId(md), who);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
985 msn_write(md->fd, buf);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
986 }
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
987
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
988 static void msn_add_deny(struct gaim_connection *gc, char *who)
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
989 {
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
990 struct msn_data *md = (struct msn_data *)gc->proto_data;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
991 char buf[MSN_BUF_LEN - 1];
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
992
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
993 snprintf(buf, MSN_BUF_LEN, "ADD %ld BL %s %s\n", trId(md), who, who);
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
994 msn_write(md->fd, buf);
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
995 }
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
996
1630
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
997 static GList *msn_away_states()
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
998 {
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
999 GList *m = NULL;
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1000
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1001 m = g_list_append(m, "Available");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1002 m = g_list_append(m, "Away From Computer");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1003 m = g_list_append(m, "Be Right Back");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1004 m = g_list_append(m, "Busy");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1005 m = g_list_append(m, "On The Phone");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1006 m = g_list_append(m, "Out To Lunch");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1007
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1008 return m;
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1009 }
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1010
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1011 static void msn_set_away(struct gaim_connection *gc, char *state, char *msg)
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1012 {
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1013 struct msn_data *md = (struct msn_data *)gc->proto_data;
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1014 char buf[MSN_BUF_LEN - 1];
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1015
1630
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1016
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1017 gc->away = NULL;
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1018
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1019 if (msg) {
1630
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1020 gc->away = "";
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1021 snprintf(buf, MSN_BUF_LEN, "CHG %ld AWY\n", trId(md));
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1022 } else if (state) {
1630
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1023 char away[4];
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1024
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1025 gc->away = "";
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1026
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1027 if (!strcmp(state, "Available"))
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1028 sprintf(away, "NLN");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1029 else if (!strcmp(state, "Away From Computer"))
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1030 sprintf(away, "AWY");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1031 else if (!strcmp(state, "Be Right Back"))
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1032 sprintf(away, "BRB");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1033 else if (!strcmp(state, "Busy"))
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1034 sprintf(away, "BSY");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1035 else if (!strcmp(state, "On The Phone"))
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1036 sprintf(away, "PHN");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1037 else if (!strcmp(state, "Out To Lunch"))
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1038 sprintf(away, "LUN");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1039 else
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1040 sprintf(away, "NLN");
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1041
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1042 snprintf(buf, MSN_BUF_LEN, "CHG %ld %s\n", trId(md), away);
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1043 } else if (gc->is_idle)
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1044 snprintf(buf, MSN_BUF_LEN, "CHG %ld IDL\n", trId(md));
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1045 else
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1046 snprintf(buf, MSN_BUF_LEN, "CHG %ld NLN\n", trId(md));
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1047
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1048 msn_write(md->fd, buf);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1049 }
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1050
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1051
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1052 static void msn_set_idle(struct gaim_connection *gc, int idle)
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1053 {
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1054 struct msn_data *md = (struct msn_data *)gc->proto_data;
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1055 char buf[MSN_BUF_LEN - 1];
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1056
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1057 if (idle)
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1058 snprintf(buf, MSN_BUF_LEN, "CHG %ld IDL\n", trId(md));
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1059 else
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1060 snprintf(buf, MSN_BUF_LEN, "CHG %ld NLN\n", trId(md));
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1061
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1062 msn_write(md->fd, buf);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1063 }
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1064
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1065 static void msn_close(struct gaim_connection *gc)
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1066 {
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1067 struct msn_data *md = (struct msn_data *)gc->proto_data;
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1068 char buf[MSN_BUF_LEN - 1];
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1069 struct msn_conn *mc = NULL;
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1070
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1071 while (msn_connections) {
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1072 mc = (struct msn_conn *)msn_connections->data;
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1073
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1074 free_msn_conn(mc);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1075 }
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1076
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1077 if (md->fd) {
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1078 snprintf(buf, MSN_BUF_LEN, "OUT\n");
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1079 msn_write(md->fd, buf);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1080 close(md->fd);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1081 }
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1082
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1083 if (gc->inpa)
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1084 gdk_input_remove(gc->inpa);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1085
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1086 if (md->friendly)
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1087 free(md->friendly);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1088
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1089 g_free(gc->proto_data);
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1090 }
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1091
1639
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1092 static char *msn_get_away_text(int s)
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1093 {
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1094 switch (s) {
1639
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1095 case MSN_BUSY :
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1096 return "Busy";
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1097 case MSN_BRB :
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1098 return "Be right back";
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1099 case MSN_AWAY :
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1100 return "Away from the computer";
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1101 case MSN_PHONE :
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1102 return "On the phone";
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1103 case MSN_LUNCH :
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1104 return "Out to lunch";
1640
5f3027fbce4c [gaim-migrate @ 1650]
Rob Flynn <gaim@robflynn.com>
parents: 1639
diff changeset
1105 case MSN_IDLE :
5f3027fbce4c [gaim-migrate @ 1650]
Rob Flynn <gaim@robflynn.com>
parents: 1639
diff changeset
1106 return "Idle";
1639
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1107 default:
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1108 return NULL;
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1109 }
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1110 }
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1111
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1112 static void msn_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who)
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1113 {
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1114 struct buddy *b = find_buddy(gc, who);
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1115 char buf[MSN_BUF_LEN];
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1116 GtkWidget *button;
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1117
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1118 if (!(b->uc >> 5))
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1119 return;
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1120
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1121 g_snprintf(buf, MSN_BUF_LEN, "Status: %s", msn_get_away_text(b->uc >> 5));
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1122
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1123 button = gtk_menu_item_new_with_label(buf);
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1124 gtk_menu_append(GTK_MENU(menu), button);
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1125 gtk_widget_show(button);
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1126 }
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1127
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1128 void msn_newmail_dialog(const char *text)
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1129 {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1130 GtkWidget *window;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1131 GtkWidget *vbox;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1132 GtkWidget *label;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1133 GtkWidget *hbox;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1134 GtkWidget *button;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1135
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1136 window = gtk_window_new(GTK_WINDOW_DIALOG);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1137 gtk_window_set_wmclass(GTK_WINDOW(window), "prompt", "Gaim");
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1138 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1139 gtk_window_set_title(GTK_WINDOW(window), _("Gaim-MSN: New Mail"));
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1140 gtk_widget_realize(window);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1141 aol_icon(window->window);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1142
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1143 vbox = gtk_vbox_new(FALSE, 5);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1144 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1145 gtk_container_add(GTK_CONTAINER(window), vbox);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1146
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1147 label = gtk_label_new(text);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1148 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1149
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1150 hbox = gtk_hbox_new(FALSE, 5);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1151 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1152
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1153 button = picture_button(window, _("OK"), ok_xpm);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1154 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1155 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(msn_des_win), window);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1156
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1157 gtk_widget_show_all(window);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1158 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1159
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1160 void msn_des_win(GtkWidget *a, GtkWidget *b)
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1161 {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1162 gtk_widget_destroy(b);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1163 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1164
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1165 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m)
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1166 {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1167 if (m->user) {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1168 if (m->user->proto_opt[m->opt][0] == '1')
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1169 m->user->proto_opt[m->opt][0] = '\0';
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1170 else
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1171 strcpy(m->user->proto_opt[m->opt],"1");
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1172 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1173 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1174
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1175 static void free_muo(GtkWidget *b, struct mod_usr_opt *m)
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1176 {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1177 g_free(m);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1178 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1179
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1180 static GtkWidget *msn_protoopt_button(const char *text, struct aim_user *u, int option, GtkWidget *box)
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1181 {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1182 GtkWidget *button;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1183 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1184 button = gtk_check_button_new_with_label(text);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1185 if (u) {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1186 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->proto_opt[option][0] == '1'));
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1187 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1188 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1189 muo->user = u;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1190 muo->opt = option;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1191 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1192 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1193 gtk_widget_show(button);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1194 return button;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1195 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1196
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1197 static void msn_user_opts(GtkWidget* book, struct aim_user *user)
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1198 {
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1199 /* so here, we create the new notebook page */
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1200 GtkWidget *vbox;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1201
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1202 vbox = gtk_vbox_new(FALSE, 5);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1203 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1204 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("MSN Options"));
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1205 gtk_widget_show(vbox);
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1206
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1207 msn_protoopt_button("Notify me of new HotMail",user,USEROPT_HOTMAIL,vbox);
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1208 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1209
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1210 /*
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1211 Process messages from Hotmail service. right now we just check for new
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1212 mail notifications, if the user has checking enabled.
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1213 */
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1214
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1215 static void process_hotmail_msg(struct gaim_connection *gc, gchar *msgdata)
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1216 {
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1217 gchar *mailnotice;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1218 char *mailfrom,*mailsubj,*mailct,*mailp;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1219
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1220 if (gc->user->proto_opt[USEROPT_HOTMAIL][0] != '1') return;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1221 mailfrom=NULL; mailsubj=NULL; mailct=NULL; mailp=NULL;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1222 mailct = strstr(msgdata,"Content-Type: ");
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1223 mailp = strstr(mailct,";");
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1224 if ((mailct != NULL) && (mailp != NULL) && (mailp > mailct) &&
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1225 !strncmp(mailct,"Content-Type: text/x-msmsgsemailnotification",(mailp-mailct)-1)) {
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1226 mailfrom=strstr(mailp,"From: ");
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1227 mailsubj=strstr(mailp,"Subject: ");
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1228 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1229
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1230 if (mailfrom != NULL && mailsubj != NULL) {
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1231 mailfrom += 6;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1232 mailp=strstr(mailfrom,"\r\n");
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1233 if (mailp==NULL) return;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1234 *mailp = 0;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1235 mailsubj += 9;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1236 mailp=strstr(mailsubj,"\r\n");
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1237 if (mailp==NULL) return;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1238 *mailp = 0;
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1239 mailnotice = (gchar *)g_malloc(sizeof(gchar) *(strlen(mailfrom)+strlen(mailsubj)+128));
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1240 sprintf(mailnotice,"Mail from %s, re: %s",mailfrom,mailsubj);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1241 msn_newmail_dialog(mailnotice);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1242 g_free(mailnotice);
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1243 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1244 }
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1245
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1246 static char *msn_normalize(const char *s)
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1247 {
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1248 static char buf[BUF_LEN];
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1249 char *t, *u;
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1250 int x = 0;
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1251
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1252 g_return_val_if_fail((s != NULL), NULL);
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1253
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1254 u = t = g_strdup(s);
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1255
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1256 g_strdown(t);
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1257
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1258 while (*t && (x < BUF_LEN - 1)) {
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1259 if (*t != ' ')
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1260 buf[x++] = *t;
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1261 t++;
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1262 }
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1263 buf[x] = '\0';
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1264 g_free(u);
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1265
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1266 if (!strchr(buf, '@')) {
1851
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1267 strcat(buf, "@hotmail.com"); /* if they don't specify something, it will be hotmail.com.
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1268 msn.com is valid too, but hey, if they wanna use it,
97a097e00139 [gaim-migrate @ 1861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1833
diff changeset
1269 they gotta enter it themselves. */
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1270 } else if ((u = strchr(strchr(buf, '@'), '/')) != NULL) {
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1271 *u = '\0';
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1272 }
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1273
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1274 return buf;
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1275 }
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1276
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1277 void do_change_name(GtkWidget *w, struct msn_name_dlg *b)
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1278 {
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1279 struct gaim_connection *gc = b->user->gc;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1280 struct msn_data *md = (struct msn_data *)gc->proto_data;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1281 char buf[MSN_BUF_LEN - 1];
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1282 gchar *newname;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1283
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1284 newname = gtk_entry_get_text(GTK_ENTRY(b->entry));
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1285
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1286 snprintf(buf, MSN_BUF_LEN, "REA %ld %s %s\n", trId(md), gc->username, newname);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1287
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1288 msn_write(md->fd, buf);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1289
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1290 msn_des_win(NULL, b->window);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1291
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1292 return;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1293 }
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1294
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1295 void show_change_name(struct gaim_connection *gc)
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1296 {
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1297 GtkWidget *label;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1298 GtkWidget *vbox;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1299 GtkWidget *buttons;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1300 GtkWidget *hbox;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1301 struct aim_user *tmp;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1302 gchar *buf;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1303 struct msn_data *md;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1304
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1305 struct msn_name_dlg *b = g_new0(struct msn_name_dlg, 1);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1306 if (!g_slist_find(connections, gc))
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1307 gc = connections->data;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1308
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1309 tmp = gc->user;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1310 b->user = tmp;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1311
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1312 md = (struct msn_data *)gc->proto_data;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1313
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1314 b->window = gtk_window_new(GTK_WINDOW_DIALOG);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1315 gtk_window_set_wmclass(GTK_WINDOW(b->window), "msn_change_name", "Gaim");
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1316
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1317 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Change MSN Name"));
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1318 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(msn_des_win), b->window);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1319 gtk_widget_realize(b->window);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1320 aol_icon(b->window->window);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1321
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1322 vbox = gtk_vbox_new(FALSE, 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1323 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1324 gtk_container_add(GTK_CONTAINER(b->window), vbox);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1325 gtk_widget_show(vbox);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1326
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1327 hbox = gtk_hbox_new(FALSE, 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1328 gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1329 gtk_widget_show(hbox);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1330 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1331
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1332 buf = g_malloc(256);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1333 g_snprintf(buf, 256, "New name for %s (%s):", tmp->username, md->friendly);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1334 label = gtk_label_new(buf);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1335 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1336 gtk_widget_show(label);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1337 g_free(buf);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1338
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1339 b->entry = gtk_entry_new();
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1340 gtk_box_pack_start(GTK_BOX(hbox), b->entry, FALSE, FALSE, 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1341 gtk_widget_show(b->entry);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1342
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1343 buttons = gtk_hbox_new(FALSE, 5);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1344 gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1345 gtk_widget_show(buttons);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1346
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1347 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1348 gtk_box_pack_end(GTK_BOX(buttons), b->cancel, FALSE, FALSE, 0);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1349 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", GTK_SIGNAL_FUNC(msn_des_win), b->window);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1350
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1351 b->ok = picture_button(b->window, _("Ok"), ok_xpm);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1352 gtk_box_pack_end(GTK_BOX(buttons), b->ok, FALSE, FALSE, 0);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1353 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", GTK_SIGNAL_FUNC(do_change_name), b);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1354
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1355
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1356 gtk_widget_show(b->window);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1357
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1358
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1359 }
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1360
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1361 static void msn_do_action(struct gaim_connection *gc, char *act)
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1362 {
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1363 if (!strcmp(act, "Change Name"))
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1364 show_change_name(gc);
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1365 }
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1366
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1367 static GList *msn_actions()
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1368 {
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1369 GList *m = NULL;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1370
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1371 m = g_list_append(m, "Change Name");
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1372
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1373 return m;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1374 }
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1375
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1376 static char **msn_list_icon(int uc)
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1377 {
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1378 if (uc == UC_UNAVAILABLE)
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1379 return msn_away_xpm;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1380 else if (uc == UC_NORMAL)
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1381 return msn_online_xpm;
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1382
1631
7f44a3f3a928 [gaim-migrate @ 1641]
Rob Flynn <gaim@robflynn.com>
parents: 1630
diff changeset
1383 return msn_away_xpm;
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1384 }
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1385
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1386 static struct prpl *my_protocol = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1387
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
1388 void msn_init(struct prpl *ret)
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
1389 {
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1390 ret->protocol = PROTO_MSN;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1391 ret->name = msn_name;
1572
d60672672a13 [gaim-migrate @ 1582]
Rob Flynn <gaim@robflynn.com>
parents: 1569
diff changeset
1392 ret->list_icon = msn_list_icon;
1639
285dd96928cd [gaim-migrate @ 1649]
Rob Flynn <gaim@robflynn.com>
parents: 1632
diff changeset
1393 ret->buddy_menu = msn_buddy_menu;
1717
1c8e109f8934 [gaim-migrate @ 1727]
Rob Flynn <gaim@robflynn.com>
parents: 1640
diff changeset
1394 ret->user_opts = msn_user_opts;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1395 ret->login = msn_login;
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1396 ret->close = msn_close;
1584
30a4ecea466a [gaim-migrate @ 1594]
Rob Flynn <gaim@robflynn.com>
parents: 1572
diff changeset
1397 ret->send_im = msn_send_im;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1398 ret->set_info = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1399 ret->get_info = NULL;
1630
862a2acf2bcc [gaim-migrate @ 1640]
Rob Flynn <gaim@robflynn.com>
parents: 1628
diff changeset
1400 ret->away_states = msn_away_states;
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1401 ret->set_away = msn_set_away;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1402 ret->get_away_msg = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1403 ret->set_dir = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1404 ret->get_dir = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1405 ret->dir_search = NULL;
1600
aa82b76afa3a [gaim-migrate @ 1610]
Rob Flynn <gaim@robflynn.com>
parents: 1598
diff changeset
1406 ret->set_idle = msn_set_idle;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1407 ret->change_passwd = NULL;
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
1408 ret->add_buddy = msn_add_buddy;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1409 ret->add_buddies = NULL;
1598
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
1410 ret->remove_buddy = msn_remove_buddy;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
1411 ret->add_permit = msn_add_permit;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
1412 ret->rem_permit = msn_rem_permit;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
1413 ret->add_deny = msn_add_deny;
07070c592a7c [gaim-migrate @ 1608]
Rob Flynn <gaim@robflynn.com>
parents: 1589
diff changeset
1414 ret->rem_deny = msn_rem_deny;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1415 ret->warn = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1416 ret->accept_chat = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1417 ret->join_chat = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1418 ret->chat_invite = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1419 ret->chat_leave = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1420 ret->chat_whisper = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1421 ret->chat_send = NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1422 ret->keepalive = NULL;
1833
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1423 ret->actions = msn_actions;
cf6ba4aa23b9 [gaim-migrate @ 1843]
Rob Flynn <gaim@robflynn.com>
parents: 1764
diff changeset
1424 ret->do_action = msn_do_action;
1756
baf57b74e818 [gaim-migrate @ 1766]
Rob Flynn <gaim@robflynn.com>
parents: 1754
diff changeset
1425 ret->normalize = msn_normalize;
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1426
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1427 my_protocol = ret;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1428 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1429
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
1430 char *gaim_plugin_init(GModule * handle)
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
1431 {
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1327
diff changeset
1432 load_protocol(msn_init, sizeof(struct prpl));
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1433 return NULL;
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1434 }
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1435
1282
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
1436 void gaim_plugin_remove()
577b71ae4e2a [gaim-migrate @ 1292]
Rob Flynn <gaim@robflynn.com>
parents: 1279
diff changeset
1437 {
1259
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1438 struct prpl *p = find_prpl(PROTO_MSN);
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1439 if (p == my_protocol)
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1440 unload_protocol(p);
7db9121aac80 [gaim-migrate @ 1269]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1441 }