annotate src/protocols/napster/napster.c @ 12488:40fada5b3d59

[gaim-migrate @ 14800] return 0 when successful. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 15 Dec 2005 16:13:56 +0000
parents 1b57012eec7b
children 3169cd6727ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim - Napster Protocol Plugin
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
3322
b77edfedc39f [gaim-migrate @ 3340]
Sean Egan <seanegan@gmail.com>
parents: 3033
diff changeset
4 * Copyright (C) 2000-2001, Rob Flynn <rob@marko.net>
7084
0909ebf6fb28 [gaim-migrate @ 7649]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
5 *
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * (at your option) any later version.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * GNU General Public License for more details.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
20 #include "internal.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
22 #include "account.h"
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
23 #include "accountopt.h"
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
24 #include "blist.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
25 #include "conversation.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
26 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
27 #include "notify.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 #include "prpl.h"
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #include "proxy.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
30 #include "util.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
31 #include "version.h"
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3593
diff changeset
32
3322
b77edfedc39f [gaim-migrate @ 3340]
Sean Egan <seanegan@gmail.com>
parents: 3033
diff changeset
33 #define NAP_SERVER "64.124.41.187"
b77edfedc39f [gaim-migrate @ 3340]
Sean Egan <seanegan@gmail.com>
parents: 3033
diff changeset
34 #define NAP_PORT 8888
b77edfedc39f [gaim-migrate @ 3340]
Sean Egan <seanegan@gmail.com>
parents: 3033
diff changeset
35
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
36 #define NAPSTER_CONNECT_STEPS 2
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
37
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 GSList *nap_connections = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 struct nap_data {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 int fd;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 gchar *email;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44
5679
0a0116686d51 [gaim-migrate @ 6097]
Nathan Walp <nwalp@pidgin.im>
parents: 5638
diff changeset
45 static GaimConversation *nap_find_chat(GaimConnection *gc, const char *name)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 {
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
47 GSList *bcs = gc->buddy_chats;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
49 while (bcs) {
5679
0a0116686d51 [gaim-migrate @ 6097]
Nathan Walp <nwalp@pidgin.im>
parents: 5638
diff changeset
50 GaimConversation *b = bcs->data;
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
51 if (!gaim_utf8_strcasecmp(b->name, name))
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
52 return b;
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
53 bcs = bcs->next;
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
54 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
55
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
56 return NULL;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
57 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
58
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
59 static void nap_write_packet(GaimConnection *gc, unsigned short command, const char *format, ...)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
60 {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
61 struct nap_data *ndata = (struct nap_data *)gc->proto_data;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
62 va_list ap;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
63 gchar *message;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
64 unsigned short size;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
65
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
66 va_start(ap, format);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
67 message = g_strdup_vprintf(format, ap);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
68 va_end(ap);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
69
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
70 size = strlen(message);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
71 gaim_debug(GAIM_DEBUG_MISC, "napster", "S %3hd: %s\n", command, message);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
72
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
73 write(ndata->fd, &size, 2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
74 write(ndata->fd, &command, 2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
75 write(ndata->fd, message, size);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
76
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
77 g_free(message);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
78 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
79
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
80 static int nap_do_irc_style(GaimConnection *gc, const char *message, const char *name)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
81 {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
82 gchar **res;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
83
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
84 gaim_debug(GAIM_DEBUG_MISC, "napster", "C %s\n", message);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
85
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
86 res = g_strsplit(message, " ", 2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
87
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
88 if (!g_ascii_strcasecmp(res[0], "/ME")) { /* MSG_CLIENT_PUBLIC */
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
89 nap_write_packet(gc, 824, "%s \"%s\"", name, res[1]);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
90
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
91 } else if (!g_ascii_strcasecmp(res[0], "/MSG")) { /* MSG_CLIENT_PUBLIC */
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
92 nap_write_packet(gc, 205, "%s", res[1]);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
93
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
94 } else if (!g_ascii_strcasecmp(res[0], "/JOIN")) { /* join chatroom MSG_CLIENT_JOIN */
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
95 if (!res[1]) {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
96 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
97 return 1;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
98 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
99 if (res[1][0] != '#')
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
100 nap_write_packet(gc, 400, "#%s", res[1]);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
101 else
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
102 nap_write_packet(gc, 400, "%s", res[1]);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
103
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
104 } else if (!g_ascii_strcasecmp(res[0], "/PART")) { /* partchatroom MSG_CLIENT_PART */
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
105 nap_write_packet(gc, 401, "%s", res[1] ? res[1] : name);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
106
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
107 } else if (!g_ascii_strcasecmp(res[0], "/TOPIC")) { /* set topic MSG_SERVER_TOPIC */
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
108 nap_write_packet(gc, 410, "%s", res[1] ? res[1] : name);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
109
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
110 } else if (!g_ascii_strcasecmp(res[0], "/WHOIS")) { /* whois request MSG_CLIENT_WHOIS */
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
111 nap_write_packet(gc, 603, "%s", res[1]);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
112
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
113 } else if (!g_ascii_strcasecmp(res[0], "/PING")) { /* send ping MSG_CLIENT_PING */
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
114 nap_write_packet(gc, 751, "%s", res[1]);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
115
8386
143d0b29ba82 [gaim-migrate @ 9114]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
116 } else if (!g_ascii_strcasecmp(res[0], "/KICK")) { /* kick asswipe MSG_CLIENT_KICK */
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
117 nap_write_packet(gc, 829, "%s", res[1]);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
118
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
119 } else {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
120 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
121 return 1;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
122 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
123
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
124 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
125 return 0;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
126 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
127
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
128 /* 205 - MSG_CLIENT_PRIVMSG */
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
129 static int nap_send_im(GaimConnection *gc, const char *who, const char *message, GaimMessageFlags flags)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
130 {
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
131 char *tmp = gaim_unescape_html(message);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
132
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
133 if ((strlen(tmp) < 2) || (tmp[0] != '/' ) || (tmp[1] == '/')) {
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
134 /* Actually send a chat message */
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
135 nap_write_packet(gc, 205, "%s %s", who, tmp);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
136 } else {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
137 /* user typed an IRC-style command */
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
138 nap_do_irc_style(gc, tmp, who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
141 g_free(tmp);
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
142
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
143 return 1;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
144 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
145
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
146 /* 207 - MSG_CLIENT_ADD_HOTLIST */
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9040
diff changeset
147 static void nap_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
148 {
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9040
diff changeset
149 nap_write_packet(gc, 207, "%s", buddy->name);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
150 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
151
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
152 /* 208 - MSG_CLIENT_ADD_HOTLIST_SEQ */
10869
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
153 static void nap_send_buddylist(GaimConnection *gc)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
154 {
10869
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
155 GaimBuddyList *blist;
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
156 GaimBlistNode *gnode, *cnode, *bnode;
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
157 GaimBuddy *buddy;
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
158
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
159 if ((blist = gaim_get_blist()) != NULL)
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
160 {
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
161 for (gnode = blist->root; gnode != NULL; gnode = gnode->next)
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
162 {
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
163 if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
164 continue;
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
165 for (cnode = gnode->child; cnode != NULL; cnode = cnode->next)
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
166 {
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
167 if (!GAIM_BLIST_NODE_IS_CONTACT(cnode))
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
168 continue;
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
169 for (bnode = cnode->child; bnode != NULL; bnode = bnode->next)
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
170 {
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
171 if (!GAIM_BLIST_NODE_IS_BUDDY(bnode))
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
172 continue;
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
173 buddy = (GaimBuddy *)bnode;
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
174 nap_write_packet(gc, 208, "%s", buddy->name);
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
175 }
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
176 }
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
177 }
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
178 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
179 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
180
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
181 /* 303 - MSG_CLIENT_REMOVE_HOTLIST */
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9040
diff changeset
182 static void nap_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
183 {
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9040
diff changeset
184 nap_write_packet(gc, 303, "%s", buddy->name);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
185 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
186
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
187 static char *nap_get_chat_name(GHashTable *data) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
188 char *name = g_hash_table_lookup(data, "group");
10200
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
189
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
190 /* Make sure the name has a # preceding it */
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
191 if (name[0] != '#') {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
192 return g_strdup_printf("#%s", name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
193 }
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
194
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
195 return g_strdup(name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
196 }
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
197
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
198 /* 400 - MSG_CLIENT_JOIN */
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
199 static void nap_join_chat(GaimConnection *gc, GHashTable *data)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
200 {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
201 char *name;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
202
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
203 if (!data)
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
204 return;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
205
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
206 name = nap_get_chat_name(data);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
207
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
208 if (name) {
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
209 nap_write_packet(gc, 400, "%s", name);
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
210 g_free(name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
211 }
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
212 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
213
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
214 /* 401 - MSG_CLIENT_PART */
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
215 static void nap_chat_leave(GaimConnection *gc, int id)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
216 {
5679
0a0116686d51 [gaim-migrate @ 6097]
Nathan Walp <nwalp@pidgin.im>
parents: 5638
diff changeset
217 GaimConversation *c = gaim_find_chat(gc, id);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
218
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
219 if (!c)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
220 return;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
221
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
222 nap_write_packet(gc, 401, "%s", c->name);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
223 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
224
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
225 /* 402 - MSG_CLIENT_PUBLIC */
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
226 static int nap_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
227 {
5679
0a0116686d51 [gaim-migrate @ 6097]
Nathan Walp <nwalp@pidgin.im>
parents: 5638
diff changeset
228 GaimConversation *c = gaim_find_chat(gc, id);
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
229 char *tmp = gaim_unescape_html(message);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
230
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
231 if (!c)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
232 return -EINVAL;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
233
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
234 if ((strlen(tmp) < 2) || (tmp[0] != '/' ) || (tmp[1] == '/')) {
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
235 /* Actually send a chat message */
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
236 nap_write_packet(gc, 402, "%s %s", c->name, tmp);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
237 } else {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
238 /* user typed an IRC-style command */
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
239 nap_do_irc_style(gc, tmp, c->name);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
240 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
241
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
242 g_free(tmp);
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
243
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
244 return 0;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
245 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
246
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
247 /* 603 - MSG_CLIENT_WHOIS */
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
248 static void nap_get_info(GaimConnection *gc, const char *who)
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
249 {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
250 nap_write_packet(gc, 603, "%s", who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
253 static void nap_callback(gpointer data, gint source, GaimInputCondition condition)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 {
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
255 GaimConnection *gc = data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 struct nap_data *ndata = gc->proto_data;
10010
56e34a659db2 [gaim-migrate @ 10927]
Mark Doliner <mark@kingant.net>
parents: 9953
diff changeset
257 GaimAccount *account = gaim_connection_get_account(gc);
5679
0a0116686d51 [gaim-migrate @ 6097]
Nathan Walp <nwalp@pidgin.im>
parents: 5638
diff changeset
258 GaimConversation *c;
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
259 gchar *buf, *buf2, *buf3, **res;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 unsigned short header[2];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 int len;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 int command;
2220
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
263 int i;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
265 if (read(source, (void*)header, 4) != 4) {
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
266 gaim_connection_error(gc, _("Unable to read header from server"));
2220
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
267 return;
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
268 }
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
269
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 len = header[0];
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10732
diff changeset
271 command = header[1];
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
272 buf = (gchar *)g_malloc((len + 1) * sizeof(gchar));
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
273 buf[len] = '\0';
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274
2220
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
275 i = 0;
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
276 do {
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
277 int tmp = read(source, buf + i, len - i);
2220
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
278 if (tmp <= 0) {
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
279 g_free(buf);
10816
c94f40ffcafb [gaim-migrate @ 12471]
Luke Schierer <lschiere@pidgin.im>
parents: 10812
diff changeset
280 buf = g_strdup_printf(_("Unable to read message from server: %s. Command is %hd, length is %hd."), strerror(errno), len, command);
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
281 gaim_connection_error(gc, buf);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
282 g_free(buf);
2220
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
283 return;
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
284 }
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
285 i += tmp;
8b7ba25a7ece [gaim-migrate @ 2230]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
286 } while (i != len);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
288 gaim_debug(GAIM_DEBUG_MISC, "napster", "R %3hd: %s\n", command, buf);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
290 switch (command) {
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
291 case 000: /* MSG_SERVER_ERROR */
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5402
diff changeset
292 gaim_notify_error(gc, NULL, buf, NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
293 gaim_input_remove(gc->inpa);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
294 gc->inpa = 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 close(source);
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10732
diff changeset
296 gaim_connection_error(gc, _("Unknown server error."));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
297 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
299 case 003: /* MSG_SERVER_EMAIL */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
300 gaim_debug(GAIM_DEBUG_MISC, "napster", "Registered with e-mail address: %s\n", buf);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 ndata->email = g_strdup(buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 /* Our signon is complete */
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
304 gaim_connection_set_state(gc, GAIM_CONNECTED);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305
10869
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
306 /* Send the server our buddy list */
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
307 nap_send_buddylist(gc);
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
308
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
309 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
310
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
311 case 201: /* MSG_SERVER_SEARCH_RESULT */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
312 res = g_strsplit(buf, " ", 0);
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11533
diff changeset
313 gaim_prpl_got_user_status(account, res[0], "available", NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
314 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
315 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
316
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
317 case 202: /* MSG_SERVER_SEARCH_END */
10123
1369e3ae9c9d [gaim-migrate @ 11160]
Nathan Walp <nwalp@pidgin.im>
parents: 10122
diff changeset
318 gaim_prpl_got_user_status(account, buf, "offline", NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
319 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
320
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
321 case 205: /* MSG_CLIENT_PRIVMSG */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
322 res = g_strsplit(buf, " ", 2);
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10723
diff changeset
323 buf2 = g_markup_escape_text(res[1], -1);
8495
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
324 serv_got_im(gc, res[0], buf2, 0, time(NULL));
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
325 g_free(buf2);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
326 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
327 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
328
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
329 case 209: /* MSG_SERVER_USER_SIGNON */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
330 /* USERNAME SPEED */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
331 res = g_strsplit(buf, " ", 2);
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11533
diff changeset
332 gaim_prpl_got_user_status(account, res[0], "available", NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
333 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
334 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
335
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
336 case 210: /* MSG_SERVER_USER_SIGNOFF */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
337 /* USERNAME SPEED */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
338 res = g_strsplit(buf, " ", 2);
10010
56e34a659db2 [gaim-migrate @ 10927]
Mark Doliner <mark@kingant.net>
parents: 9953
diff changeset
339 gaim_prpl_got_user_status(account, res[0], "offline", NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
340 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
341 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
342
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
343 case 214: /* MSG_SERVER_STATS */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
344 res = g_strsplit(buf, " ", 3);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
345 buf2 = g_strdup_printf(_("users: %s, files: %s, size: %sGB"), res[0], res[1], res[2]);
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6979
diff changeset
346 serv_got_im(gc, "server", buf2, 0, time(NULL));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
347 g_free(buf2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
348 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
349 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
350
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
351 case 301: /* MSG_SERVER_HOTLIST_ACK */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
352 /* Our buddy was added successfully */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
353 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
354
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
355 case 302: /* MSG_SERVER_HOTLIST_ERROR */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
356 buf2 = g_strdup_printf(_("Unable to add \"%s\" to your Napster hotlist"), buf);
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5402
diff changeset
357 gaim_notify_error(gc, NULL, buf2, NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
358 g_free(buf2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
359 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
360
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
361 case 316: /* MSG_SERVER_DISCONNECTING */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
362 /* we have been kicked off =^( */
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10732
diff changeset
363 gaim_connection_error(gc, _("You were disconnected from the server."));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
364 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
365
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
366 case 401: /* MSG_CLIENT_PART */
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
367 c = nap_find_chat(gc, buf);
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
368 if (c)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
369 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
370 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
371
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
372 case 403: /* MSG_SERVER_PUBLIC */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
373 res = g_strsplit(buf, " ", 3);
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
374 c = nap_find_chat(gc, res[0]);
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
375 if (c)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
376 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), res[1], 0, res[2], time((time_t)NULL));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
377 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
378 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
379
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
380 case 404: /* MSG_SERVER_NOSUCH */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
381 /* abused by opennap servers to broadcast stuff */
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10723
diff changeset
382 buf2 = g_markup_escape_text(buf, -1);
8495
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
383 serv_got_im(gc, "server", buf2, 0, time(NULL));
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
384 g_free(buf2);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
385 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
386
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
387 case 405: /* MSG_SERVER_JOIN_ACK */
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
388 c = nap_find_chat(gc, buf);
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
389 if (!c)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
390 serv_got_joined_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), buf);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
391 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
392
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
393 case 407: /* MSG_SERVER_PART */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
394 res = g_strsplit(buf, " ", 0);
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
395 c = nap_find_chat(gc, res[0]);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
396 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), res[1], NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
397 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
398 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
399
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
400 case 406: /* MSG_SERVER_JOIN */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
401 case 408: /* MSG_SERVER_CHANNEL_USER_LIST */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
402 res = g_strsplit(buf, " ", 4);
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
403 c = nap_find_chat(gc, res[0]);
9846
c28d5b45624e [gaim-migrate @ 10724]
Mark Doliner <mark@kingant.net>
parents: 9797
diff changeset
404 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), res[1], NULL, GAIM_CBFLAGS_NONE, TRUE);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
405 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
406 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
407
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
408 case 409: /* MSG_SERVER_CHANNEL_USER_LIST_END */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
409 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
410
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
411 case 410: /* MSG_SERVER_TOPIC */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
412 /* display the topic in the channel */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
413 res = g_strsplit(buf, " ", 2);
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
414 c = nap_find_chat(gc, res[0]);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
415 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), res[0], res[1]);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
416 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
417 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
418
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
419 case 603: /* MSG_CLIENT_WHOIS */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
420 buf2 = g_strdup_printf(_("%s requested your information"), buf);
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6979
diff changeset
421 serv_got_im(gc, "server", buf2, 0, time(NULL));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
422 g_free(buf2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
423 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
424
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
425 case 604: /* MSG_SERVER_WHOIS_RESPONSE */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
426 /* XXX - Format is: "Elite" 37 " " "Active" 0 0 0 0 "gaim 0.63cvs" 0 0 192.168.1.41 32798 0 unknown flounder */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
427 res = g_strsplit(buf, " ", 2);
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
428 /* res[0] == username */
11533
c9b815aeddc1 [gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents: 11531
diff changeset
429 gaim_notify_userinfo(gc, res[0], res[1], NULL, NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
430 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
431 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
432
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
433 case 621:
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
434 case 622: /* MSG_CLIENT_MOTD */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
435 /* also replaces MSG_SERVER_MOTD, so we should display it */
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10723
diff changeset
436 buf2 = g_markup_escape_text(buf, -1);
8495
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
437 serv_got_im(gc, "motd", buf2, 0, time(NULL));
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
438 g_free(buf2);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
439 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
440
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
441 case 627: /* MSG_CLIENT_WALLOP */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
442 /* abused by opennap server maintainers to broadcast stuff */
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10723
diff changeset
443 buf2 = g_markup_escape_text(buf, -1);
8495
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
444 serv_got_im(gc, "wallop", buf2, 0, time(NULL));
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
445 g_free(buf2);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
446 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
447
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
448 case 628: /* MSG_CLIENT_ANNOUNCE */
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10723
diff changeset
449 buf2 = g_markup_escape_text(buf, -1);
8495
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
450 serv_got_im(gc, "announce", buf2, 0, time(NULL));
a88124e46fc6 [gaim-migrate @ 9230]
Mark Doliner <mark@kingant.net>
parents: 8386
diff changeset
451 g_free(buf);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
452 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
453
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
454 case 748: /* MSG_SERVER_GHOST */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
455 /* Looks like someone logged in as us! =-O */
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10732
diff changeset
456 gaim_connection_error(gc, _("You have signed on from another location."));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
457 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
458
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
459 case 751: /* MSG_CLIENT_PING */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
460 buf2 = g_strdup_printf(_("%s requested a PING"), buf);
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6979
diff changeset
461 serv_got_im(gc, "server", buf2, 0, time(NULL));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
462 g_free(buf2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
463 /* send back a pong */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
464 /* MSG_CLIENT_PONG */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
465 nap_write_packet(gc, 752, "%s", buf);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
466 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
467
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
468 case 752: /* MSG_CLIENT_PONG */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
469 buf2 = g_strdup_printf("Received pong from %s", buf);
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5402
diff changeset
470 gaim_notify_info(gc, NULL, buf2, NULL);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
471 g_free(buf2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
472 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
473
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
474 case 824: /* MSG_CLIENT_EMOTE */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
475 res = g_strsplit(buf, " ", 3);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
476 buf2 = g_strndup(res[2]+1, strlen(res[2]) - 2); /* chomp off the surround quotes */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
477 buf3 = g_strdup_printf("/me %s", buf2);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
478 g_free(buf2);
5402
f3cf3bff72f0 [gaim-migrate @ 5778]
Mark Doliner <mark@kingant.net>
parents: 5388
diff changeset
479 if ((c = nap_find_chat(gc, res[0]))) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
480 gaim_conv_chat_write(GAIM_CONV_CHAT(c), res[1], buf3, GAIM_MESSAGE_NICK, time(NULL));
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
481 }
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
482 g_free(buf3);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
483 g_strfreev(res);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
484 break;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
485
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
486 default:
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
487 gaim_debug(GAIM_DEBUG_MISC, "napster", "Unknown packet %hd: %s\n", command, buf);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
488 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 }
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
490
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
491 g_free(buf);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
494 /* 002 - MSG_CLIENT_LOGIN */
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
495 static void nap_login_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 {
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
497 GaimConnection *gc = data;
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
498 struct nap_data *ndata = (struct nap_data *)gc->proto_data;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
499 gchar *buf;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500
5605
4fa8ca4f4259 [gaim-migrate @ 6009]
Nathan Walp <nwalp@pidgin.im>
parents: 5604
diff changeset
501 if (!g_list_find(gaim_connections_get_all(), gc)) {
2701
8a84f2bb1716 [gaim-migrate @ 2714]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
502 close(source);
8a84f2bb1716 [gaim-migrate @ 2714]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
503 return;
8a84f2bb1716 [gaim-migrate @ 2714]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
504 }
8a84f2bb1716 [gaim-migrate @ 2714]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
505
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 if (source < 0) {
7981
ad5c8f01882b [gaim-migrate @ 8658]
Luke Schierer <lschiere@pidgin.im>
parents: 7956
diff changeset
507 gaim_connection_error(gc, _("Unable to connect."));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510
4452
2afc0f845e74 [gaim-migrate @ 4727]
Sean Egan <seanegan@gmail.com>
parents: 4359
diff changeset
511 ndata->fd = source;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
513 /* Update the login progress status display */
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
514 buf = g_strdup_printf("Logging in: %s", gaim_account_get_username(gc->account));
7884
71354edf06d7 [gaim-migrate @ 8538]
Mark Doliner <mark@kingant.net>
parents: 7844
diff changeset
515 gaim_connection_update_progress(gc, buf, 1, NAPSTER_CONNECT_STEPS);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
516 g_free(buf);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
517
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
518 /* Write our signon data */
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
519 nap_write_packet(gc, 2, "%s %s 0 \"gaim %s\" 0",
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
520 gaim_account_get_username(gc->account),
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10732
diff changeset
521 gaim_connection_get_password(gc), VERSION);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
522
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
523 /* And set up the input watcher */
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
524 gc->inpa = gaim_input_add(ndata->fd, GAIM_INPUT_READ, nap_callback, gc);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526
11837
fa742ad8068c [gaim-migrate @ 14128]
Mark Doliner <mark@kingant.net>
parents: 11779
diff changeset
527 static void nap_login(GaimAccount *account)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 {
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
529 GaimConnection *gc = gaim_account_get_connection(account);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
530
7884
71354edf06d7 [gaim-migrate @ 8538]
Mark Doliner <mark@kingant.net>
parents: 7844
diff changeset
531 gaim_connection_update_progress(gc, _("Connecting"), 0, NAPSTER_CONNECT_STEPS);
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
532
4460
23af9ba33ca4 [gaim-migrate @ 4735]
Nathan Walp <nwalp@pidgin.im>
parents: 4455
diff changeset
533 gc->proto_data = g_new0(struct nap_data, 1);
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5679
diff changeset
534 if (gaim_proxy_connect(account,
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
535 gaim_account_get_string(account, "server", NAP_SERVER),
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
536 gaim_account_get_int(account, "port", NAP_PORT),
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4460
diff changeset
537 nap_login_connect, gc) != 0) {
7981
ad5c8f01882b [gaim-migrate @ 8658]
Luke Schierer <lschiere@pidgin.im>
parents: 7956
diff changeset
538 gaim_connection_error(gc, _("Unable to connect."));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
542 static void nap_close(GaimConnection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 struct nap_data *ndata = (struct nap_data *)gc->proto_data;
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
545
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546 if (gc->inpa)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
547 gaim_input_remove(gc->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
549 if (!ndata)
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
550 return;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
551
10882
83e119608cb5 [gaim-migrate @ 12580]
Gary Kramlich <grim@reaperworld.com>
parents: 10869
diff changeset
552 close(ndata->fd);
83e119608cb5 [gaim-migrate @ 12580]
Gary Kramlich <grim@reaperworld.com>
parents: 10869
diff changeset
553
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
554 g_free(ndata->email);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
555 g_free(ndata);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6622
diff changeset
558 static const char* nap_list_icon(GaimAccount *a, GaimBuddy *b)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
560 return "napster";
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562
9953
d908907d9441 [gaim-migrate @ 10849]
Nathan Walp <nwalp@pidgin.im>
parents: 9943
diff changeset
563 static void nap_list_emblems(GaimBuddy *b, const char **se, const char **sw,
d908907d9441 [gaim-migrate @ 10849]
Nathan Walp <nwalp@pidgin.im>
parents: 9943
diff changeset
564 const char **nw, const char **ne)
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
565 {
10723
a9c77f7b8ced [gaim-migrate @ 12323]
Luke Schierer <lschiere@pidgin.im>
parents: 10649
diff changeset
566 if(!GAIM_BUDDY_IS_ONLINE(b))
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
567 *se = "offline";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
568 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
569
10200
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
570 static GList *nap_status_types(GaimAccount *account)
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
571 {
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
572 GList *types = NULL;
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
573 GaimStatusType *type;
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
574
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
575 g_return_val_if_fail(account != NULL, NULL);
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
576
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
577 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
578 "offline",
10723
a9c77f7b8ced [gaim-migrate @ 12323]
Luke Schierer <lschiere@pidgin.im>
parents: 10649
diff changeset
579 _("Offline"), TRUE, TRUE, FALSE);
10200
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
580 types = g_list_append(types, type);
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
581
11522
a26eb48d1953 [gaim-migrate @ 13770]
Mark Doliner <mark@kingant.net>
parents: 11257
diff changeset
582 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11533
diff changeset
583 "available",
12467
1b57012eec7b [gaim-migrate @ 14777]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
584 _("Available"), TRUE, TRUE, FALSE);
10200
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
585 types = g_list_append(types, type);
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
586
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
587 return types;
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
588 }
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
589
5604
92b2c7f461f9 [gaim-migrate @ 6008]
Nathan Walp <nwalp@pidgin.im>
parents: 5436
diff changeset
590 static GList *nap_chat_info(GaimConnection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 {
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
592 GList *m = NULL;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
593 struct proto_chat_entry *pce;
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
594
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
595 pce = g_new0(struct proto_chat_entry, 1);
7844
a6298fd7ee21 [gaim-migrate @ 8498]
Mark Doliner <mark@kingant.net>
parents: 7118
diff changeset
596 pce->label = _("_Group:");
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
597 pce->identifier = "group";
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
598 m = g_list_append(m, pce);
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
599
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
600 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 }
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
602
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
603 GHashTable *nap_chat_info_defaults(GaimConnection *gc, const char *chat_name)
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
604 {
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
605 GHashTable *defaults;
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
606
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
607 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
608
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
609 if (chat_name != NULL)
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
610 g_hash_table_insert(defaults, "group", g_strdup(chat_name));
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
611
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
612 return defaults;
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
613 }
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
614
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
615 static GaimPlugin *my_protocol = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
616
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
617 static GaimPluginProtocolInfo prpl_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
618 {
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
619 OPT_PROTO_CHAT_TOPIC,
9475
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
620 NULL, /* user_splits */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
621 NULL, /* protocol_options */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
622 NO_BUDDY_ICONS, /* icon_spec */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
623 nap_list_icon, /* list_icon */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
624 nap_list_emblems, /* list_emblems */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
625 NULL, /* status_text */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
626 NULL, /* tooltip_text */
10200
f086269582b1 [gaim-migrate @ 11317]
Mark Doliner <mark@kingant.net>
parents: 10123
diff changeset
627 nap_status_types, /* status_types */
9475
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
628 NULL, /* blist_node_menu */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
629 nap_chat_info, /* chat_info */
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
630 nap_chat_info_defaults, /* chat_info_defaults */
9475
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
631 nap_login, /* login */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
632 nap_close, /* close */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
633 nap_send_im, /* send_im */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
634 NULL, /* set_info */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
635 NULL, /* send_typing */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
636 nap_get_info, /* get_info */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
637 NULL, /* set_away */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
638 NULL, /* set_idle */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
639 NULL, /* change_passwd */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
640 nap_add_buddy, /* add_buddy */
10869
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10816
diff changeset
641 NULL, /* add_buddies */
9475
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
642 nap_remove_buddy, /* remove_buddy */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
643 NULL, /* remove_buddies */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
644 NULL, /* add_permit */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
645 NULL, /* add_deny */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
646 NULL, /* rem_permit */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
647 NULL, /* rem_deny */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
648 NULL, /* set_permit_deny */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
649 nap_join_chat, /* join_chat */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
650 NULL, /* reject chat invite */
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
651 nap_get_chat_name, /* get_chat_name */
9475
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
652 NULL, /* chat_invite */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
653 nap_chat_leave, /* chat_leave */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
654 NULL, /* chat_whisper */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
655 nap_chat_send, /* chat_send */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
656 NULL, /* keepalive */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
657 NULL, /* register_user */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
658 NULL, /* get_cb_info */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
659 NULL, /* get_cb_away */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
660 NULL, /* alias_buddy */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
661 NULL, /* group_buddy */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
662 NULL, /* rename_group */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
663 NULL, /* buddy_free */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
664 NULL, /* convo_closed */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
665 NULL, /* normalize */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
666 NULL, /* set_buddy_icon */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
667 NULL, /* remove_group */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
668 NULL, /* get_cb_real_name */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
669 NULL, /* set_chat_topic */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
670 NULL, /* find_blist_chat */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
671 NULL, /* roomlist_get_list */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
672 NULL, /* roomlist_cancel */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
673 NULL, /* roomlist_expand_category */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9473
diff changeset
674 NULL, /* can_receive_file */
12143
cbebda5f019c [gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents: 11837
diff changeset
675 NULL, /* send_file */
cbebda5f019c [gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents: 11837
diff changeset
676 NULL /* new_xfer */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
677 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
678
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
679 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
680 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
681 GAIM_PLUGIN_MAGIC,
11779
80af53b5b3c5 [gaim-migrate @ 14070]
Gary Kramlich <grim@reaperworld.com>
parents: 11638
diff changeset
682 GAIM_MAJOR_VERSION,
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
683 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
684 GAIM_PLUGIN_PROTOCOL, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
685 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
686 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
687 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
688 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
689
5388
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
690 "prpl-napster", /**< id */
5d0df915ca09 [gaim-migrate @ 5764]
Mark Doliner <mark@kingant.net>
parents: 5234
diff changeset
691 "Napster", /**< name */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
692 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
693 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
694 N_("NAPSTER Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
695 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
696 N_("NAPSTER Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
697 NULL, /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6321
diff changeset
698 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
699
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
700 NULL, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
701 NULL, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
702 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
703
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
704 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8950
diff changeset
705 &prpl_info, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8950
diff changeset
706 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8950
diff changeset
707 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
708 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
709
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
710 static void init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
711 {
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
712 GaimAccountOption *option;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
713
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
714 option = gaim_account_option_string_new(_("Server"), "server",
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
715 NAP_SERVER);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
716 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
717 option);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
718
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
719 option = gaim_account_option_int_new(_("Port"), "port", 8888);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
720 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5605
diff changeset
721 option);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
722
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
723 my_protocol = plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
724 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
725
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
726 GAIM_INIT_PLUGIN(napster, init_plugin, info);