annotate plugins/irc.c @ 1953:f0ff0b367e3d

[gaim-migrate @ 1963] more gtk2 stuff. this isn't all that's needed for prefs.c but the rest of it won't work for gtk1.2. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 02 Jun 2001 00:24:50 +0000
parents a02584b98823
children b71494004378
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim - IRC Protocol Plugin
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
1672
7cb0cebd6d87 [gaim-migrate @ 1682]
Rob Flynn <gaim@robflynn.com>
parents: 1504
diff changeset
4 * Copyright (C) 2000-2001, Rob Flynn <rob@tgflinux.com>
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 *
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * (at your option) any later version.
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 *
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * GNU General Public License for more details.
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 *
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 *
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 */
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 #include "../config.h"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <netdb.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <gtk/gtk.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <unistd.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <errno.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <netinet/in.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <arpa/inet.h>
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
32 #include <fcntl.h>
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #include <string.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include <stdlib.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <stdio.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include <time.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <sys/socket.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <sys/stat.h>
1864
5cb89cf24f45 [gaim-migrate @ 1874]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1848
diff changeset
39 #include <ctype.h>
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include "multi.h"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #include "prpl.h"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 #include "gaim.h"
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
43 #include "proxy.h"
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
45 #include "pixmaps/free_icon.xpm"
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
46
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
47 #define IRC_BUF_LEN 4096
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
48
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
49
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
50 #define USEROPT_SERV 0
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
51 #define USEROPT_PORT 1
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
52
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
53 static int chat_id = 0;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
54
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
55 struct irc_channel {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
56 int id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
57 gchar *name;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
58 };
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
59
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
60 struct irc_data {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
61 int fd;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
62 int inpa; /* used for non-block logins */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
63
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
64 int timer;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
65
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
66 int totalblocks;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
67 int recblocks;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
68
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
69 GSList *templist;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
70 GList *channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
71 };
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
72
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
73 static char *irc_name()
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
74 {
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
75 return "IRC";
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
76 }
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
77
1675
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
78 static void irc_get_info(struct gaim_connection *gc, char *who);
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
79
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
80 char *name()
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
81 {
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
82 return "IRC";
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
83 }
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
84
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
85 char *description()
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
86 {
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
87 return "Allows gaim to use the IRC protocol";
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
88 }
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
89
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
90 static void irc_join_chat(struct gaim_connection *gc, int id, char *name)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
91 {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
92 struct irc_data *idata = (struct irc_data *)gc->proto_data;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
93 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
94
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
95 g_snprintf(buf, IRC_BUF_LEN, "JOIN %s\n", name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
96 write(idata->fd, buf, strlen(buf));
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
97 write(idata->fd, buf, strlen(buf));
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
98
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
99 g_free(buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
100 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
101
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
102 static void irc_update_user(struct gaim_connection *gc, char *name, int status)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
103 {
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
104 struct irc_data *idata = (struct irc_data *)gc->proto_data;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
105 struct irc_channel *u;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
106 GSList *temp = idata->templist;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
107
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
108 /* Loop through our list */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
109
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
110 while (temp) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
111 u = (struct irc_channel *)temp->data;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
112 if (g_strcasecmp(u->name, name) == 0) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
113 u->id = status;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
114 return;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
115 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
116
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
117 temp = g_slist_next(temp);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
118 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
119 return;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
120 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
121
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
122 static void irc_request_buddy_update(struct gaim_connection *gc)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
123 {
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
124 struct irc_data *idata = (struct irc_data *)gc->proto_data;
1046
4593605da0e2 [gaim-migrate @ 1056]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1022
diff changeset
125 GSList *grp = gc->groups;
4593605da0e2 [gaim-migrate @ 1056]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1022
diff changeset
126 GSList *person;
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
127 struct group *g;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
128 struct buddy *b;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
129 struct irc_channel *u;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
130
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
131 if (idata->templist != NULL)
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
132 return;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
133
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
134 idata->recblocks = 0;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
135 idata->totalblocks = 1;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
136
1105
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
137 /* First, let's check to see if we have anyone on our buddylist */
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
138 if (!grp) {
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
139 return;
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
140 }
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
141
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
142 /* Send the first part of our request */
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
143 write(idata->fd, "ISON", 4);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
144
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
145 /* Step through our list of groups */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
146 while (grp) {
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
147
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
148 g = (struct group *)grp->data;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
149 person = g->members;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
150
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
151 while (person) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
152 b = (struct buddy *)person->data;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
153
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
154 /* We will store our buddy info here. I know, this is cheap
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
155 * but hey, its the exact same data structure. Why should we
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
156 * bother with making another one */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
157
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
158 u = g_new0(struct irc_channel, 1);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
159 u->id = 0; /* Assume by default that they're offline */
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
160 u->name = strdup(b->name);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
161
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
162 write(idata->fd, " ", 1);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
163 write(idata->fd, u->name, strlen(u->name));
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
164 idata->templist = g_slist_append(idata->templist, u);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
165
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
166 person = person->next;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
167 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
168
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
169 grp = g_slist_next(grp);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
170 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
171 write(idata->fd, "\n", 1);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
172 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
173
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
174
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
175 static void irc_send_im(struct gaim_connection *gc, char *who, char *message, int away)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
176 {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
177
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
178 struct irc_data *idata = (struct irc_data *)gc->proto_data;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
179 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
180
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
181 if (who[0] == '@' || who[0] == '+') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
182
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
183 /* If the user trys to msg an op or a voice from the channel, the convo will try
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
184 * to send it to @nick or +nick... needless to say, this is undesirable.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
185 */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
186 who++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
187 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
188
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
189 /* Before we actually send this, we should check to see if they're trying
1674
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
190 * To issue a command and handle it properly. */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
191
1674
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
192 if (message[0] == '/')
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
193 {
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
194 /* I'll change the implementation of this a little later :-) */
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
195 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) {
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
196 /* We have /me!! We have /me!! :-) */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
197
1674
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
198 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
199 strcpy(temp, message + 4);
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
200 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%cACTION %s%c\n", who, '\001', temp, '\001');
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
201 g_free(temp);
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
202 }
1675
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
203 else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) {
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
204 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
205 strcpy(temp, message + 7);
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
206 irc_get_info(gc, temp);
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
207 g_free(temp);
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
208
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
209 return;
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
210 }
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
211
1674
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
212 }
1127fa1b4c02 [gaim-migrate @ 1684]
Rob Flynn <gaim@robflynn.com>
parents: 1673
diff changeset
213 else {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
214 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%s\n", who, message);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
215 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
216
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
217 write(idata->fd, buf, strlen(buf));
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
218
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
219 g_free(buf);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
220 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
221
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
222 static int find_id_by_name(struct gaim_connection *gc, char *name)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
223 {
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
224 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
225 GList *templist;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
226 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
227
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
228 templist = ((struct irc_data *)gc->proto_data)->channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
229
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
230 while (templist) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
231 channel = (struct irc_channel *)templist->data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
232
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
233 g_snprintf(temp, IRC_BUF_LEN, "#%s", channel->name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
234
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
235 if (g_strcasecmp(temp, name) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
236 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
237 return channel->id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
238 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
239
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
240 templist = templist->next;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
241 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
242
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
243 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
244
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
245 /* Return -1 if we have no ID */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
246 return -1;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
247 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
248
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
249 static struct irc_channel *find_channel_by_name(struct gaim_connection *gc, char *name)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
250 {
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
251 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
252 GList *templist;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
253 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
254
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
255 templist = ((struct irc_data *)gc->proto_data)->channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
256
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
257 while (templist) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
258 channel = (struct irc_channel *)templist->data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
259
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
260 g_snprintf(temp, IRC_BUF_LEN, "%s", channel->name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
261
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
262 if (g_strcasecmp(temp, name) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
263 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
264 return channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
265 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
266
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
267 templist = templist->next;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
268 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
269
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
270 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
271
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
272 /* If we found nothing, return nothing :-) */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
273 return NULL;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
274 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
275
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
276 static struct irc_channel *find_channel_by_id(struct gaim_connection *gc, int id)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
277 {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
278 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
279 struct irc_channel *channel;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
280
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
281 GList *temp;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
282
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
283 temp = idata->channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
284
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
285 while (temp) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
286 channel = (struct irc_channel *)temp->data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
287
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
288 if (channel->id == id) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
289 /* We've found our man */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
290 return channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
291 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
292
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
293 temp = temp->next;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
294 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
295
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
296
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
297 /* If we didnt find one, return NULL */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
298 return NULL;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
299 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
300
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
301 static void irc_chat_leave(struct gaim_connection *gc, int id);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
302 static void irc_chat_send(struct gaim_connection *gc, int id, char *message)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
303 {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
304
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
305 struct irc_data *idata = (struct irc_data *)gc->proto_data;
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
306 struct irc_channel *channel = NULL;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
307 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1);
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
308 char **kick;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
309 gboolean is_command = FALSE;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
310 /* First lets get our current channel */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
311 channel = find_channel_by_id(gc, id);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
312
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
313
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
314 if (!channel) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
315 /* If for some reason we've lost our channel, let's bolt */
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
316 g_free(buf);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
317 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
318 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
319
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
320
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
321 /* Before we actually send this, we should check to see if they're trying
1675
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
322 * To issue a command and handle it properly. */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
323
1675
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
324 if (message[0] == '/')
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
325 {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
326
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
327 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
328 /* We have /me!! We have /me!! :-) */
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
329
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
330 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
331 strcpy(temp, message + 4);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
332
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
333 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%cACTION %s%c\n", channel->name, '\001', temp,
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
334 '\001');
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
335 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
336 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
337 else if ((g_strncasecmp(message, "/op ", 4) == 0) && (strlen(message) > 4)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
338 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
339 strcpy(temp, message + 4);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
340
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
341 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s +o %s\n", channel->name, temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
342
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
343 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
344 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
345
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
346 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
347 else if ((g_strncasecmp(message, "/deop ", 6) == 0) && (strlen(message) > 6)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
348 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
349 strcpy(temp, message + 6);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
350 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s -o %s\n", channel->name, temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
351
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
352 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
353 is_command = TRUE;
1675
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
354 }
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
355
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
356 else if ((g_strncasecmp(message, "/voice ", 7) == 0) && (strlen(message) > 7)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
357 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
358 strcpy(temp, message + 7);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
359
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
360 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s +v %s\n", channel->name, temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
361
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
362 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
363 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
364
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
365 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
366 else if ((g_strncasecmp(message, "/devoice ", 9) == 0) && (strlen(message) > 9)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
367 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
368 strcpy(temp, message + 6);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
369 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s -v %s\n", channel->name, temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
370
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
371 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
372 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
373 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
374 else if ((g_strncasecmp(message, "/mode ", 6) == 0) && (strlen(message) > 6)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
375 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
376 strcpy(temp, message + 6);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
377 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s %s\n", channel->name, temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
378 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
379 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
380 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
381
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
382 else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
383 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
384
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
385 strcpy(temp, message + 7);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
386 irc_get_info(gc, temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
387 g_free(temp);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
388 is_command = TRUE;
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
389
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
390 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
391
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
392 else if (!g_strncasecmp(message, "/part", 5) && (strlen(message) == 5)) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
393
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
394 /* If I'm not mistaken, the chat_leave command was coded under the
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
395 * pretense that it would only occur when someone closed the window.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
396 * For this reason, the /part command will not close the window. Nor
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
397 * will the window close when the user is /kicked. I'll let you decide
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
398 * the best way to fix it--I'd imagine it'd just be a little line like
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
399 * if (convo) close (convo), but I'll let you decide where to put it.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
400 */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
401
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
402 irc_chat_leave(gc, id);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
403 is_command = TRUE;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
404 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
405
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
406
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
407 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
408
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
409 else if (!g_strncasecmp(message, "/join ", 6) && (strlen(message) > 6)) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
410
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
411 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
412
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
413 strcpy(temp, message + 6);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
414
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
415
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
416 irc_join_chat(gc, 0, temp);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
417 g_free(temp);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
418 is_command = TRUE;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
419 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
420 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
421
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
422 else if (!g_strncasecmp(message, "/raw ", 5) && (strlen(message) > 5)){
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
423 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
424 strcpy(temp, message + 5);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
425 g_snprintf(buf, IRC_BUF_LEN, "%s\r\n", temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
426 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
427 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
428 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
429
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
430 else if (!g_strncasecmp(message, "/quote ", 7) && (strlen(message) >7)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
431 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
432 strcpy(temp, message + 7);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
433 g_snprintf(buf, IRC_BUF_LEN, "%s\r\n", temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
434 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
435 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
436 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
437
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
438 else if (!g_strncasecmp(message, "/kick ", 6) && (strlen(message) > 6)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
439 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
440 strcpy(temp, message + 6);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
441 kick = g_strsplit(temp, " ", 2);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
442 g_snprintf(buf, IRC_BUF_LEN, "KICK #%s %s :%s\r\n", channel->name, kick[0], kick[1]);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
443 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
444 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
445 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
446
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
447 /* FIXME: I'll go back in and grab this later. -- Rob */
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
448 /*
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
449 I THOUGHT THIS WOULD WORK, BUT I WAS WRONG. WOULD SOMEONE KINDLY FIX IT?
1675
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
450
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
451
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
452 else if (!g_strncasecmp(message, "/help", 5)) {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
453 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
454 strcpy(temp, message + 5);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
455 if (temp == "") {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
456
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
457 serv_got_chat_in(gc, id, "gAIM", 0, "Available Commands:");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
458 serv_got_chat_in(gc, id, "gAIM", 0, " ");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
459 serv_got_chat_in(gc, id, "gAIM", 0, "<b>op voice kick </b>");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
460 serv_got_chat_in(gc, id, "gAIM", 0, "<b>deop devoice whois</b>");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
461 serv_got_chat_in(gc, id, "gAIM", 0, "<b>me raw quote</b>");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
462 serv_got_chat_in(gc, id, "gAIM", 0, "<b>mode</b>");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
463 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
464 else {
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
465 serv_got_chat_in(gc, id, "gAIM", 0, "Usage: ");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
466 if (temp == "op")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
467 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/op <nick></b> - Gives operator status to user.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
468 else if (temp == "deop")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
469 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/deop <nick></b> - Removes operator status from user.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
470 else if (temp == "me")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
471 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/me <action></b> - Sends an action to the channel.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
472 else if (temp == "mode")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
473 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/mode {[+|-}|o|p|s|i|t|n|b|v} [<limit][<nick>][<ban mask]</b> - Changes channel and user modes.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
474 else if (temp == "voice")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
475 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/voice <nick></b> - Gives voice status to user.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
476 else if (temp == "devoice")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
477 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/devoice <nick></b> - Removes voice status from user.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
478 else if (temp == "raw")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
479 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/raw <text></b> - Sends raw text to the server.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
480 else if (temp == "kick")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
481 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/kick [<comment>]</b> - Kicks a user out of the channel.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
482 else if (temp == "whois")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
483 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/whois <nick></b> - Gets information about user.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
484 else if (temp == "quote")
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
485 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/raw <text></b> - Sends raw text to the server.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
486 else
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
487 serv_got_chat_in(gc, id, "gAIM", 0, "No such command.");
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
488 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
489
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
490 g_free(temp);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
491 is_command = TRUE;
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
492 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
493 */
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
494
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
495 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
496
1675
3232467ae220 [gaim-migrate @ 1685]
Rob Flynn <gaim@robflynn.com>
parents: 1674
diff changeset
497 else {
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
498 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%s\n", channel->name, message);
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
499
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
500 }
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
501
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
502
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
503 write(idata->fd, buf, strlen(buf));
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
504
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
505 /* Since AIM expects us to receive the message we send, we gotta fake it */
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
506 if (is_command==FALSE)
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1742
diff changeset
507 serv_got_chat_in(gc, id, gc->username, 0, message, time((time_t)NULL));
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
508
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
509 g_free(buf);
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
510
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
511
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
512 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
513 static struct conversation *find_conversation_by_id(struct gaim_connection *gc, int id)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
514 {
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
515 GSList *bc = gc->buddy_chats;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
516 struct conversation *b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
517
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
518 while (bc) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
519 b = (struct conversation *)bc->data;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
520 if (id == b->id) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
521 break;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
522 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
523 bc = bc->next;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
524 b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
525 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
526
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
527 if (!b) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
528 return NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
529 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
530
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
531 return b;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
532 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
533
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
534 static struct conversation *find_conversation_by_name(struct gaim_connection *gc, char *name)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
535 {
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
536 GSList *bc = gc->buddy_chats;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
537 struct conversation *b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
538
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
539 while (bc) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
540 b = (struct conversation *)bc->data;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
541
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
542 if (g_strcasecmp(name, b->name) == 0) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
543 break;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
544 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
545 bc = bc->next;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
546 b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
547 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
548
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
549 if (!b) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
550 return NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
551 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
552
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
553 return b;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
554 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
555
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
556
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
557
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
558 static void irc_callback(gpointer data, gint source, GdkInputCondition condition)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
559 {
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
560 struct gaim_connection *gc = data;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
561 int i = 0;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
562 gchar buf[4096];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
563 gchar **buf2;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
564 struct irc_data *idata;
1742
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
565
34369ed4e212 [gaim-migrate @ 1752]
Rob Flynn <gaim@robflynn.com>
parents: 1678
diff changeset
566 idata = (struct irc_data *)gc->proto_data;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
567
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
568
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
569 do {
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
570 if (read(idata->fd, buf + i, 1) < 0) {
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
571 hide_login_progress(gc, "Read error");
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
572 signoff(gc);
1105
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
573 return;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
574 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
575 } while (buf[i++] != '\n');
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
576
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
577 buf[--i] = '\0';
1301
e973ef7a8a87 [gaim-migrate @ 1311]
Rob Flynn <gaim@robflynn.com>
parents: 1288
diff changeset
578 g_strchomp(buf);
1269
677e2c9e8baf [gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1266
diff changeset
579 g_print("%s\n", buf);
1105
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
580
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
581 /* Check for errors */
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
582
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
583 if (((strstr(buf, "ERROR :") && (!strstr(buf, "PRIVMSG ")) &&
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
584 (!strstr(buf, "NOTICE ")) && (strlen(buf) > 7)))) {
1105
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
585
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
586 gchar *u_errormsg;
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
587
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
588 /* Let's get our error message */
1269
677e2c9e8baf [gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1266
diff changeset
589 u_errormsg = g_strdup(buf + 7);
1105
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
590
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
591 /* We got our error message. Now, let's reaise an
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
592 * error dialog */
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
593
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
594 do_error_dialog(u_errormsg, "Gaim: IRC Error");
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
595
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
596 /* And our necessary garbage collection */
1269
677e2c9e8baf [gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1266
diff changeset
597 g_free(u_errormsg);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
598 return;
1105
c964df5b2a84 [gaim-migrate @ 1115]
Rob Flynn <gaim@robflynn.com>
parents: 1090
diff changeset
599 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
600
1673
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
601 /* This should be a whois response. I only care about the first (311) one. I might do
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
602 * the other's later. They're boring. */
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
603
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
604 if (((strstr(buf, " 311 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) {
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
605 char **res;
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
606
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
607 res = g_strsplit(buf, " ", 7);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
608
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
609 if (!strcmp(res[1], "311"))
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
610 {
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
611 char buf[8192];
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
612
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
613 g_snprintf(buf, 4096, "<b>Nick:</b> %s<br>"
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
614 "<b>Host:</b> %s@%s<br>"
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
615 "<b>Name:</b> %s<br>", res[3], res[4], res[5], res[7]+1);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
616
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
617 g_show_info_text(buf);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
618 }
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
619
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
620 g_strfreev(res);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
621 return;
1673
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
622 }
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
623
1676
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
624 /* Autoresponse to an away message */
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
625 if (((strstr(buf, " 301 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) {
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
626 char **res;
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
627
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
628 res = g_strsplit(buf, " ", 5);
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
629
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
630 if (!strcmp(res[1], "301"))
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1742
diff changeset
631 serv_got_im(gc, res[3], res[4] + 1, 1, time((time_t)NULL));
1676
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
632
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
633 g_strfreev(res);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
634 return;
1676
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
635 }
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
636
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
637 /* Parse the list of names that we receive when we first sign on to
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
638 * a channel */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
639
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
640 if (((strstr(buf, " 353 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) {
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
641 gchar u_host[255];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
642 gchar u_command[32];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
643 gchar u_channel[128];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
644 gchar u_names[IRC_BUF_LEN + 1];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
645 struct conversation *convo = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
646 int j;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
647
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
648 for (j = 0, i = 0; buf[i] != ' '; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
649 u_host[j] = buf[i];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
650 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
651
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
652 u_host[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
653 i++;
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
654
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
655 for (j = 0; buf[i] != ' '; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
656 u_command[j] = buf[i];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
657 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
658
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
659 u_command[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
660 i++;
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
661
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
662 for (j = 0; buf[i] != '#'; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
663 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
664 i++;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
665
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
666 for (j = 0; buf[i] != ':'; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
667 u_channel[j] = buf[i];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
668 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
669
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
670 u_channel[j - 1] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
671 i++;
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
672
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
673 while ((buf[i] == ' ') || (buf[i] == ':')) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
674 i++;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
675 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
676
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
677 strcpy(u_names, buf + i);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
678
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
679 buf2 = g_strsplit(u_names, " ", 0);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
680
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
681 /* Let's get our conversation window */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
682 convo = find_conversation_by_name(gc, u_channel);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
683
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
684 if (!convo) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
685 return;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
686 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
687
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
688 /* Now that we've parsed the hell out of this big
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
689 * mess, let's try to split up the names properly */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
690
1269
677e2c9e8baf [gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1266
diff changeset
691 for (i = 0; buf2[i] != NULL; i++)
677e2c9e8baf [gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1266
diff changeset
692 add_chat_buddy(convo, buf2[i]);
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
693
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
694 /* And free our pointers */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
695 g_strfreev(buf2);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
696
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
697 return;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
698
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
699 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
700
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
701 /* Receive a list of users that are currently online */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
702
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
703 if (((strstr(buf, " 303 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) {
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
704 gchar u_host[255];
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
705 gchar u_command[32];
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
706 gchar u_names[IRC_BUF_LEN + 1];
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
707 int j;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
708
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
709 for (j = 0, i = 0; buf[i] != ' '; j++, i++) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
710 u_host[j] = buf[i];
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
711 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
712
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
713 u_host[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
714 i++;
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
715
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
716 for (j = 0; buf[i] != ' '; j++, i++) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
717 u_command[j] = buf[i];
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
718 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
719
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
720 u_command[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
721 i++;
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
722
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
723 for (j = 0; buf[i] != ':'; j++, i++) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
724 /* My Nick */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
725 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
726 i++;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
727
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
728 strcpy(u_names, buf + i);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
729
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
730 buf2 = g_strsplit(u_names, " ", 0);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
731
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
732 /* Now that we've parsed the hell out of this big
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
733 * mess, let's try to split up the names properly */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
734
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
735 for (i = 0; buf2[i] != NULL; i++) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
736 /* If we have a name here then our buddy is online. We should
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
737 * update our temporary gslist accordingly. When we achieve our maximum
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
738 * list of names then we should force an update */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
739
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
740 irc_update_user(gc, buf2[i], 1);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
741 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
742
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
743 /* Increase our received blocks counter */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
744 idata->recblocks++;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
745
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
746 /* If we have our total number of blocks */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
747 if (idata->recblocks == idata->totalblocks) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
748 GSList *temp;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
749 struct irc_channel *u;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
750
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
751 /* Let's grab our list of people and bring them all on or off line */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
752 temp = idata->templist;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
753
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
754 /* Loop */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
755 while (temp) {
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
756
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
757 u = temp->data;
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
758
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
759 /* Tell Gaim to bring the person on or off line */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
760 serv_got_update(gc, u->name, u->id, 0, 0, 0, 0, 0);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
761
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
762 /* Grab the next entry */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
763 temp = g_slist_next(temp);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
764 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
765
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
766 /* And now, let's delete all of our entries */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
767 temp = idata->templist;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
768 while (temp) {
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
769 u = temp->data;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
770 g_free(u->name);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
771 temp = g_slist_remove(temp, u);
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
772 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
773
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
774 /* Reset our list */
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
775 idata->totalblocks = 0;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
776 idata->recblocks = 0;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
777
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
778 idata->templist = NULL;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
779
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
780 return;
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
781 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
782
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
783 /* And free our pointers */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
784 g_strfreev(buf2);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
785
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
786 return;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
787
1022
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
788 }
d5c022006a60 [gaim-migrate @ 1032]
Rob Flynn <gaim@robflynn.com>
parents: 1021
diff changeset
789
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
790
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
791 if ((strstr(buf, " MODE ")) && (strstr(buf, "!")) && (strstr(buf, "+v") || strstr(buf, "-v") || strstr(buf, "-o") || strstr(buf, "+o")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
792
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
793 gchar u_channel[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
794 gchar u_nick[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
795
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
796 gchar u_mode[5];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
797 char **people;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
798 gchar *temp, *temp_new;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
799
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
800
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
801 struct irc_channel *channel;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
802 int j;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
803 temp = NULL;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
804 temp_new = NULL;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
805
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
806
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
807 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
808 u_nick[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
809 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
810 u_nick[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
811 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
812
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
813 for (j = 0; buf[i] != '#'; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
814 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
815 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
816
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
817 for (j = 0; buf[i] != ' '; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
818 u_channel[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
819 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
820
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
821 u_channel[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
822 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
823
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
824 for (j = 0; buf[i] != ' '; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
825 u_mode[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
826 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
827 u_mode[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
828 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
829
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
830
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
831
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
832
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
833 people = g_strsplit(buf + i, " ", 3);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
834
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
835
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
836
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
837 channel = find_channel_by_name(gc, u_channel);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
838
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
839 if (!channel) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
840 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
841 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
842
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
843 for (j = 0; j < strlen(u_mode) - 1 ; j++)
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
844 {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
845
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
846
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
847 struct conversation *convo = NULL;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
848 convo = find_conversation_by_id(gc, channel->id);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
849
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
850
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
851
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
852 temp = (gchar *)g_malloc(strlen(people[j]) + 3);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
853 temp_new = (gchar *)g_malloc(strlen(people[j]) + 3);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
854 g_snprintf(temp, strlen(people[j]) + 2, "@%s", people[j]);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
855
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
856 if (u_mode[1] == 'v' && u_mode[0] == '+') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
857 g_snprintf(temp_new, strlen(people[j]) + 2, "+%s", people[j]);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
858 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
859 else if (u_mode[1] == 'o' && u_mode[0] == '+') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
860 g_snprintf(temp_new, strlen(people[j]) + 2, "@%s", people[j]);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
861 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
862
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
863 else if (u_mode[0] == '-') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
864 g_snprintf(temp_new, strlen(people[j]) + 1, "%s", people[j]);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
865 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
866
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
867
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
868
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
869 rename_chat_buddy(convo, temp, temp_new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
870 g_snprintf(temp, strlen(people[j]) + 2, "+%s", people[j]);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
871 rename_chat_buddy(convo, temp, temp_new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
872
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
873 rename_chat_buddy(convo, people[j], temp_new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
874
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
875
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
876
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
877
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
878
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
879 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
880 if (temp)
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
881 g_free(temp);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
882 if (temp_new)
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
883 g_free(temp_new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
884
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
885 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
886 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
887
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
888
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
889 if ((strstr(buf, " KICK ")) && (strstr(buf, "!")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
890 gchar u_channel[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
891 gchar u_nick[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
892 gchar u_comment[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
893 gchar u_who[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
894
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
895 int id;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
896
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
897 gchar *temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
898
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
899
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
900
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
901 struct irc_channel *channel;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
902 int j;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
903
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
904 temp = NULL;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
905
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
906 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
907 u_nick[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
908 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
909 u_nick[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
910 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
911
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
912 for (j = 0; buf[i] != '#'; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
913 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
914 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
915
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
916 for (j = 0; buf[i] != ' '; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
917 u_channel[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
918 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
919
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
920 u_channel[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
921 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
922
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
923 for (j = 0; buf[i] != ' '; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
924 u_who[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
925 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
926 u_who[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
927 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
928 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
929 strcpy(u_comment, buf + i);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
930 g_strchomp(u_comment);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
931
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
932 channel = find_channel_by_name(gc, u_channel);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
933
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
934 if (!channel) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
935 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
936 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
937
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
938
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
939 id = find_id_by_name(gc, u_channel);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
940
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
941
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
942 if (g_strcasecmp(u_nick, gc->username) == 0) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
943
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
944 /* It looks like you've been naughty! */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
945
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
946 serv_got_chat_left(gc, channel->id);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
947
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
948 idata->channels = g_list_remove(idata->channels, channel);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
949 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
950 else {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
951 struct conversation *convo = NULL;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
952
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
953 /* Find their conversation window */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
954 convo = find_conversation_by_id(gc, channel->id);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
955
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
956 if (!convo) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
957 /* Some how the window doesn't exist.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
958 * Let's get out of here */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
959 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
960 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
961
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
962 /* And remove their name */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
963 /* If the person is an op or voice, this won't work.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
964 * so we'll just do a nice hack and remove nick and
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
965 * @nick and +nick. Truly wasteful.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
966 */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
967
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
968 temp = (gchar *) g_malloc(strlen(u_who) + 3);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
969 g_snprintf(temp, strlen(u_who) + 2, "@%s", u_who);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
970 remove_chat_buddy(convo, temp);
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
971 g_free(temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
972 temp = (gchar *) g_malloc(strlen(u_who) + 3);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
973 g_snprintf(temp, strlen(u_who) + 2, "+%s", u_who);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
974 remove_chat_buddy(convo, temp);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
975 remove_chat_buddy(convo, u_who);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
976
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
977 g_free(temp);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
978
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
979 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
980
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
981 /* Go Home! */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
982 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
983 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
984
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
985
1831
1b61db419774 [gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
986 if ((strstr(buf, " JOIN ")) && (strstr(buf, "!")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
987
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
988 gchar u_channel[128];
1012
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
989 gchar u_nick[128];
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
990
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
991 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
992 int j;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
993
1012
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
994 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
995 u_nick[j] = buf[i];
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
996 }
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
997
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
998 u_nick[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
999 i++;
1012
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
1000
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
1001 for (j = 0; buf[i] != '#'; j++, i++) {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1002 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1003
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1004 i++;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1005
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1006 strcpy(u_channel, buf + i);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1007
1301
e973ef7a8a87 [gaim-migrate @ 1311]
Rob Flynn <gaim@robflynn.com>
parents: 1288
diff changeset
1008 g_strchomp(u_channel);
e973ef7a8a87 [gaim-migrate @ 1311]
Rob Flynn <gaim@robflynn.com>
parents: 1288
diff changeset
1009
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1010 /* Looks like we're going to join the channel for real
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1011 * now. Let's create a valid channel structure and add
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1012 * it to our list. Let's make sure that
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1013 * we are not already in a channel first */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1014
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1015 channel = find_channel_by_name(gc, u_channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1016
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1017 if (!channel) {
1301
e973ef7a8a87 [gaim-migrate @ 1311]
Rob Flynn <gaim@robflynn.com>
parents: 1288
diff changeset
1018
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1019 chat_id++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1020
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1021 channel = g_new0(struct irc_channel, 1);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1022
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1023 channel->id = chat_id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1024 channel->name = strdup(u_channel);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1025
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1026 idata->channels = g_list_append(idata->channels, channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1027
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1028 serv_got_joined_chat(gc, chat_id, u_channel);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1029 } else {
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1030 struct conversation *convo = NULL;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1031
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1032 /* Someone else joined. Find their conversation
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1033 * window */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1034 convo = find_conversation_by_id(gc, channel->id);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1035
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1036 /* And add their name to it */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1037 add_chat_buddy(convo, u_nick);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1038
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1039 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1040
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1041 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1042 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1043
1831
1b61db419774 [gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1044 if ((strstr(buf, " NICK ")) && (strstr(buf, "!")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) {
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1045
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1046 gchar old[128];
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1047 gchar new[128];
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1048
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1049 GList *templist;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1050 gchar *temp, *temp_new;
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1051 struct irc_channel *channel;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1052 int j;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1053 temp = temp_new = NULL;
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1054 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1055 old[j] = buf[i];
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1056 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1057
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1058 old[j] = '\0';
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1059 i++;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1060
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1061 for (j = 0; buf[i] != ':'; j++, i++) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1062 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1063
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1064 i++;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1065 strcpy(new, buf + i);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1066
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1067 g_strchomp(new);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1068
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1069 templist = ((struct irc_data *)gc->proto_data)->channels;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1070
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1071 while (templist) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1072 struct conversation *convo = NULL;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1073 channel = templist->data;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1074
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1075 convo = find_conversation_by_id(gc, channel->id);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1076
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1077 /* If the person is an op or voice, this won't work.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1078 * so we'll just do a nice hack and rename nick and
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1079 * @nick and +nick. Truly wasteful.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1080 */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1081
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1082 temp = (gchar *)g_malloc(strlen(old) + 5);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1083 temp_new = (gchar *)g_malloc(strlen(new) + 5);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1084 g_snprintf(temp_new, strlen(new) + 2, "@%s", new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1085 g_snprintf(temp, strlen(old) + 2, "@%s", old);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1086 rename_chat_buddy(convo, temp, temp_new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1087 g_snprintf(temp, strlen(old) + 2, "+%s", old);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1088 g_snprintf(temp_new, strlen(new) + 2, "+%s", new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1089 rename_chat_buddy(convo, temp, temp_new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1090 rename_chat_buddy(convo, old, new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1091 if (temp)
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1092 g_free(temp);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1093 if (temp_new)
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1094 g_free(temp_new);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1095
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1096 templist = templist->next;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1097 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1098 return;
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1099 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1100
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1101
1831
1b61db419774 [gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1102 if ((strstr(buf, "QUIT ")) && (buf[0] == ':') && (strstr(buf, "!")) && (!strstr(buf, " NOTICE "))) {
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1103
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1104 gchar u_nick[128];
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1105 gchar *temp;
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1106 GList *templist;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1107
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1108 struct irc_channel *channel;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1109 int j;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1110
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1111
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1112 temp = NULL;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1113 for (j = 0, i = 1 ; buf[i] != '!'; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1114 u_nick[j] = buf[i];
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1115 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1116
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1117 u_nick[j] = '\0';
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1118
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1119 templist = ((struct irc_data *)gc->proto_data)->channels;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1120
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1121 while (templist) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1122 struct conversation *convo = NULL;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1123 channel = templist->data;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1124
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1125 convo = find_conversation_by_id(gc, channel->id);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1126
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1127 /* If the person is an op or voice, this won't work.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1128 * so we'll just do a nice hack and remove nick and
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1129 * @nick and +nick. Truly wasteful.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1130 */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1131
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1132 temp = (gchar *) g_malloc(strlen(u_nick) + 2);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1133 g_snprintf(temp, strlen(u_nick) + 2, "@%s", u_nick);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1134 remove_chat_buddy(convo, temp);
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1135 g_free(temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1136 temp = (gchar *) g_malloc(strlen(u_nick) + 2);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1137 g_snprintf(temp, strlen(u_nick) + 2, "+%s", u_nick);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1138 remove_chat_buddy(convo, temp);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1139 remove_chat_buddy(convo, u_nick);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1140
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1141
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1142
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1143 templist = templist->next;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1144 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1145
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1146 g_free(temp);
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1147
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1148 return;
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1149 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1150
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1151
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1152
1831
1b61db419774 [gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1153 if ((strstr(buf, " PART ")) && (strstr(buf, "!")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1154
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1155 gchar u_channel[128];
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1156 gchar u_nick[128];
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1157 gchar *temp;
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1158 struct irc_channel *channel;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1159 int j;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1160 temp = NULL;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1161 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1162 u_nick[j] = buf[i];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1163 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1164 u_nick[j] = '\0';
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1165
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1166 i++;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1167
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1168 for (j = 0; buf[i] != '#'; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1169 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1170
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1171 i++;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1172
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1173 for (j = 0; buf[i] != ' '; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1174 if (buf[i] == '\0') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1175 break;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1176 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1177 u_channel[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1178 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1179 u_channel[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1180
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1181 /* Now, lets check to see if it was US that was leaving.
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1182 * If so, do the correct thing by closing up all of our
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1183 * old channel stuff. Otherwise,
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1184 * we should just print that someone left */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1185
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1186 channel = find_channel_by_name(gc, u_channel);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1187
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1188 if (!channel) {
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1189 return;
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1190 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1191
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1192 if (g_strcasecmp(u_nick, gc->username) == 0) {
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1193
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1194 /* Looks like we're going to leave the channel for
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1195 * real now. Let's create a valid channel structure
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1196 * and add it to our list */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1197
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1198 serv_got_chat_left(gc, channel->id);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1199
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1200 idata->channels = g_list_remove(idata->channels, channel);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1201 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1202 else {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1203 struct conversation *convo = NULL;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1204
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1205 /* Find their conversation window */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1206 convo = find_conversation_by_id(gc, channel->id);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1207
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1208 if (!convo) {
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1209 /* Some how the window doesn't exist.
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1210 * Let's get out of here */
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1211 return;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1212 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1213
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1214 /* And remove their name */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1215 /* If the person is an op or voice, this won't work.
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1216 * so we'll just do a nice hack and remove nick and
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1217 * @nick and +nick. Truly wasteful.
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1218 */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1219
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1220 temp = (gchar *) g_malloc(strlen(u_nick) + 3);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1221 g_snprintf(temp, strlen(u_nick) + 2, "@%s", u_nick);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1222 remove_chat_buddy(convo, temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1223 g_free(temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1224 temp = (gchar *) g_malloc(strlen(u_nick) + 3);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1225 g_snprintf(temp, strlen(u_nick) + 2, "+%s", u_nick);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1226 remove_chat_buddy(convo, temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1227 g_free(temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1228 remove_chat_buddy(convo, u_nick);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1229
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1230
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1231 }
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1232
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
1233 /* Go Home! */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1234 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1235 }
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1236
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1237 if ((strstr(buf, " NOTICE ")) && (buf[0] == ':')) {
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1238 gchar u_nick[128];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1239 gchar u_host[255];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1240 gchar u_command[32];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1241 gchar u_channel[128];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1242 gchar u_message[IRC_BUF_LEN];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1243 int j;
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1244
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1245 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1246 u_nick[j] = buf[i];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1247 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1248
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1249 u_nick[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1250 i++;
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1251
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1252 for (j = 0; buf[i] != ' '; j++, i++) {
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1253 u_host[j] = buf[i];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1254 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1255
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1256 u_host[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1257 i++;
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1258
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1259 for (j = 0; buf[i] != ' '; j++, i++) {
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1260 u_command[j] = buf[i];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1261 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1262
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1263 u_command[j] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1264 i++;
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1265
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1266 for (j = 0; buf[i] != ':'; j++, i++) {
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1267 u_channel[j] = buf[i];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1268 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1269
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1270 u_channel[j - 1] = '\0';
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1271 i++;
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1272
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1273
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1274 /* Now that everything is parsed, the rest of this baby must be our message */
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1275 strncpy(u_message, buf + i, IRC_BUF_LEN);
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1276
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1277 /* Now, lets check the message to see if there's anything special in it */
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1278 if (u_message[0] == '\001') {
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1279 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) {
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1280 /* Someone's triyng to ping us. Let's respond */
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1281 gchar u_arg[24];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1282 gchar u_buf[200];
1393
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1283 unsigned long tend= time((time_t *)NULL);
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1284 unsigned long tstart;
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1285
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1286 printf("LA: %s\n", buf);
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1287
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1288 strcpy(u_arg, u_message + 6);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1289 u_arg[strlen(u_arg) - 1] = '\0';
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1290
1393
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1291 tstart = atol(u_arg);
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1292
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1293 g_snprintf(u_buf, sizeof(u_buf), "Ping Reply From %s: [%ld seconds]", u_nick, tend-tstart);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1294
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1295 do_error_dialog(u_buf, "Gaim IRC - Ping Reply");
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1296
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1297 return;
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1298 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1299 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1300
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1301 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1302
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1303
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1304 if ((strstr(buf, " PRIVMSG ")) && (buf[0] == ':')) {
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1305 gchar u_nick[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1306 gchar u_host[255];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1307 gchar u_command[32];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1308 gchar u_channel[128];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1309 gchar u_message[IRC_BUF_LEN];
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1310 gboolean is_closing;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1311
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1312 int j;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1313
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1314
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1315 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1316 u_nick[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1317 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1318
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1319 u_nick[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1320 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1321
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1322 for (j = 0; buf[i] != ' '; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1323 u_host[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1324 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1325
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1326 u_host[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1327 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1328
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1329 for (j = 0; buf[i] != ' '; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1330 u_command[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1331 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1332
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1333 u_command[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1334 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1335
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1336 for (j = 0; buf[i] != ':'; j++, i++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1337 u_channel[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1338 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1339
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1340 u_channel[j - 1] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1341 i++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1342
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1343
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1344 /* Now that everything is parsed, the rest of this baby must be our message */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1345 strncpy(u_message, buf + i, IRC_BUF_LEN);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1346
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1347 /* Now, lets check the message to see if there's anything special in it */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1348 if (u_message[0] == '\001') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1349 if (g_strncasecmp(u_message, "\001VERSION", 8) == 0) {
1017
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
1350 /* Looks like we have a version request. Let
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
1351 * us handle it thusly */
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1352
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1353 g_snprintf(buf, IRC_BUF_LEN,
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1354 "NOTICE %s :%cVERSION GAIM %s:The Pimpin Penguin AIM Clone:%s%c\n",
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1355 u_nick, '\001', VERSION, WEBSITE, '\001');
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1356
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1357 write(idata->fd, buf, strlen(buf));
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1358
1017
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
1359 /* And get the heck out of dodge */
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1360 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1361 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1362
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1363 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) {
1017
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
1364 /* Someone's triyng to ping us. Let's respond */
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1365 gchar u_arg[24];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1366
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1367 strcpy(u_arg, u_message + 6);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1368 u_arg[strlen(u_arg) - 1] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1369
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1370 g_snprintf(buf, IRC_BUF_LEN, "NOTICE %s :%cPING %s%c\n", u_nick, '\001',
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1371 u_arg, '\001');
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1372
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1373 write(idata->fd, buf, strlen(buf));
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1374
1017
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
1375 /* And get the heck out of dodge */
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1376 return;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1377 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1378
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1379 if (g_strncasecmp(u_message, "\001ACTION ", 8) == 0) {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1380 /* Looks like we have an action. Let's parse it a little */
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1381 strcpy(buf, u_message);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1382
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1383 strcpy(u_message, "/me ");
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1384 for (j = 4, i = 8; buf[i] != '\001'; i++, j++) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1385 u_message[j] = buf[i];
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1386 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1387 u_message[j] = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1388 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1389 }
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1390
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1391
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1392 /* OK, It is a chat or IM message. Here, let's translate the IRC formatting into
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1393 * good ol' fashioned gtkimhtml style hypertext markup. */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1394
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1395
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1396 is_closing = FALSE;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1397
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1398 while(strchr(u_message, '\002')) { // \002 = ^B
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1399 gchar *current;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1400 gchar *temp, *free_here;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1401
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1402
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1403 temp = g_strdup(strchr(u_message, '\002'));
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1404 free_here = temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1405 temp++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1406
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1407 current = strchr(u_message, '\002');
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1408 *current = '<';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1409 current++;
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1410 if (is_closing) {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1411 *current = '/';
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1412 current++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1413 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1414 *current = 'b';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1415 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1416 *current = '>';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1417 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1418
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1419
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1420 while (*temp != '\0') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1421 *current = *temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1422 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1423 temp++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1424 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1425 *current = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1426 g_free(free_here);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1427
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1428 is_closing = !is_closing;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1429 }
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1430
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1431 is_closing = FALSE;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1432 while(strchr(u_message, '\037')) { // \037 = ^_
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1433 gchar *current;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1434 gchar *temp, *free_here;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1435
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1436
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1437 temp = g_strdup(strchr(u_message, '\037'));
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1438 free_here = temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1439 temp++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1440
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1441 current = strchr(u_message, '\037');
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1442 *current = '<';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1443 current++;
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1444 if (is_closing) {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1445 *current = '/';
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1446 current++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1447 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1448 *current = 'u';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1449 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1450 *current = '>';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1451 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1452
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1453
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1454 while (*temp != '\0') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1455 *current = *temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1456 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1457 temp++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1458 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1459 *current = '\0';
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1460 g_free(free_here);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1461 is_closing = !is_closing;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1462
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1463 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1464
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1465 while(strchr(u_message, '\003')) { // \003 = ^C
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1466
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1467 /* This is color formatting. IRC uses its own weird little system
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1468 * that we must translate to HTML. */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1469
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1470
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1471 /* The format is something like this:
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1472 * ^C5 or ^C5,3
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1473 * The number before the comma is the foreground color, after is the
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1474 * background color. Either number can be 1 or two digits.
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1475 */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1476
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1477 gchar *current;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1478 gchar *temp, *free_here;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1479 gchar *font_tag, *body_tag;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1480 int fg_color, bg_color;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1481
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1482 temp = g_strdup(strchr(u_message, '\003'));
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1483 free_here = temp;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1484 temp++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1485
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1486 fg_color = bg_color = -1;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1487 body_tag = font_tag = "";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1488
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1489 /* Parsing the color information: */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1490 do {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1491 if (!isdigit(*temp)) break; // This translates to </font>
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1492 fg_color = (int)(*temp - 48);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1493 temp++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1494 if (isdigit(*temp)) {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1495 fg_color = (fg_color * 10) + (int)(*temp - 48);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1496 temp++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1497 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1498 if (*temp != ',') break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1499 temp++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1500 if (!isdigit(*temp)) break; // This translates to </font>
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1501 bg_color = (int)(*temp - 48);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1502 temp++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1503 if (isdigit(*temp)) {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1504 bg_color = (bg_color * 10) + (int)(*temp - 48);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1505 temp++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1506 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1507 }while (FALSE);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1508
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1509 if (fg_color > 15)
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1510 fg_color = fg_color % 16;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1511 if (bg_color > 15)
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1512 bg_color = bg_color % 16;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1513
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1514 switch (fg_color) {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1515 case -1:
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1516 font_tag = "</font></body>";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1517 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1518 case 0: // WHITE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1519 font_tag = "<font color=\"#ffffff\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1520 /* If no background color is specified, we're going to make it black anyway.
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1521 * That's probably what the sender anticipated the background color to be.
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1522 * White on white would be illegible.
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1523 */
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1524 if (bg_color == -1) {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1525 body_tag = "<body bgcolor=\"#000000\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1526 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1527 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1528 case 1: // BLACK
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1529 font_tag = "<font color=\"#000000\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1530 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1531 case 2: // NAVY BLUE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1532 font_tag = "<font color=\"#000066\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1533 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1534 case 3: // GREEN
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1535 font_tag = "<font color=\"#006600\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1536 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1537 case 4: // RED
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1538 font_tag = "<font color=\"#ff0000\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1539 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1540 case 5: // MAROON
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1541 font_tag = "<font color=\"#660000\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1542 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1543 case 6: // PURPLE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1544 font_tag = "<font color=\"#660066\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1545 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1546 case 7: // DISGUSTING PUKE COLOR
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1547 font_tag = "<font color=\"#666600\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1548 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1549 case 8: // YELLOW
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1550 font_tag = "<font color=\"#cccc00\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1551 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1552 case 9: // LIGHT GREEN
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1553 font_tag = "<font color=\"#33cc33\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1554 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1555 case 10: // TEAL
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1556 font_tag = "<font color=\"#00acac\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1557 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1558 case 11: // CYAN
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1559 font_tag = "<font color=\"#00ccac\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1560 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1561 case 12: // BLUE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1562 font_tag = "<font color=\"#0000ff\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1563 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1564 case 13: // PINK
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1565 font_tag = "<font color=\"#cc00cc\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1566 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1567 case 14: // GREY
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1568 font_tag = "<font color=\"#666666\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1569 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1570 case 15: // SILVER
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1571 font_tag = "<font color=\"#00ccac\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1572 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1573 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1574
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1575 switch (bg_color) {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1576 case 0: // WHITE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1577 body_tag = "<body bgcolor=\"#ffffff\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1578 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1579 case 1: // BLACK
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1580 body_tag = "<body bgcolor=\"#000000\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1581 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1582 case 2: // NAVY BLUE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1583 body_tag = "<body bgcolor=\"#000066\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1584 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1585 case 3: // GREEN
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1586 body_tag = "<body bgcolor=\"#006600\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1587 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1588 case 4: // RED
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1589 body_tag = "<body bgcolor=\"#ff0000\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1590 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1591 case 5: // MAROON
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1592 body_tag = "<body bgcolor=\"#660000\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1593 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1594 case 6: // PURPLE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1595 body_tag = "<body bgcolor=\"#660066\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1596 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1597 case 7: // DISGUSTING PUKE COLOR
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1598 body_tag = "<body bgcolor=\"#666600\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1599 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1600 case 8: // YELLOW
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1601 body_tag = "<body bgcolor=\"#cccc00\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1602 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1603 case 9: // LIGHT GREEN
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1604 body_tag = "<body bgcolor=\"#33cc33\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1605 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1606 case 10: // TEAL
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1607 body_tag = "<body bgcolor=\"#00acac\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1608 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1609 case 11: // CYAN
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1610 body_tag = "<body bgcolor=\"#00ccac\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1611 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1612 case 12: // BLUE
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1613 body_tag = "<body bgcolor=\"#0000ff\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1614 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1615 case 13: // PINK
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1616 body_tag = "<body bgcolor=\"#cc00cc\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1617 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1618 case 14: // GREY
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1619 body_tag = "<body bgcolor=\"#666666\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1620 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1621 case 15: // SILVER
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1622 body_tag = "<body bgcolor=\"#00ccac\">";
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1623 break;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1624 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1625
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1626 current = strchr(u_message, '\003');
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1627
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1628 while (*body_tag != '\0') {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1629 *current = *body_tag;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1630 current++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1631 body_tag++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1632 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1633
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1634 while (*font_tag != '\0') {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1635 *current = *font_tag;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1636 current++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1637 font_tag++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1638 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1639
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1640 while (*temp != '\0') {
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1641 *current = *temp;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1642 current++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1643 temp++;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1644 }
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1645 *current = '\0';
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1646 g_free(free_here);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1647 is_closing = !is_closing;
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1648
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1649 }
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1650
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1651 while(strchr(u_message, '\017')) { // \017 = ^O
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1652 gchar *current;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1653 gchar *temp, *free_here;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1654
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1655
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1656 temp = g_strdup(strchr(u_message, '\017'));
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1657 free_here = temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1658 temp++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1659
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1660 current = strchr(u_message, '\017');
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1661 *current = '<';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1662 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1663 *current = '/';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1664 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1665 *current = 'b';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1666 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1667 *current = '>';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1668 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1669 *current = '<';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1670 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1671 *current = '/';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1672 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1673 *current = 'u';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1674 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1675 *current = '>';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1676 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1677
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1678 while (*temp != '\0') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1679 *current = *temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1680 current++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1681 temp++;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1682 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1683 *current = '\0';
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1684 g_free(free_here);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1685 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1686
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1687 /* Let's check to see if we have a channel on our hands */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1688 if (u_channel[0] == '#') {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1689 /* Yup. We have a channel */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1690 int id;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1691
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1692 id = find_id_by_name(gc, u_channel);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1693 if (id != -1) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1694 serv_got_chat_in(gc, id, u_nick, 0, u_message, time((time_t)NULL));
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1695
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1696 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1697
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1698 } else {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1699 /* Nope. Let's treat it as a private message */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1700
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1701 gchar *temp;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1702 temp = NULL;
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1703
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1704 temp = (gchar *) g_malloc(strlen(u_nick) + 5);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1705 g_snprintf(temp, strlen(u_nick) + 2, "@%s", u_nick);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1706
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1707
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1708 /* If I get a message from SeanEgn, and I already have a window
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1709 * open for him as @SeanEgn or +SeanEgn, this will keep it in the
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1710 * same window. Unfortunately, if SeanEgn loses his op status
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1711 * (a sad thing indeed), the messages will still appear to come from
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1712 * @SeanEgn, until that convo is closed.
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1713 */
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1714
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1715 if (find_conversation(temp)){
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1716 serv_got_im(gc, temp, u_message, 0, time((time_t)NULL));
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1717 g_free(temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1718 return;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1719 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1720 else {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1721 g_snprintf(temp, strlen(u_nick) + 2, "+%s", u_nick);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1722 if (find_conversation(temp)) {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1723 serv_got_im(gc, temp, u_message, 0, time((time_t)NULL));
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1724 g_free(temp);
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1725 return;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1726 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1727 else {
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1728 g_free(temp);
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1729 serv_got_im(gc, u_nick, u_message, 0, time((time_t)NULL));
1848
e246a4bd1141 [gaim-migrate @ 1858]
Rob Flynn <gaim@robflynn.com>
parents: 1847
diff changeset
1730 return;
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1731 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1732 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1733 }
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1734
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1735 return;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1736 }
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1737
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1738 /* Let's parse PING requests so that we wont get booted for inactivity */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1739
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1740 if (strncmp(buf, "PING :", 6) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1741 buf2 = g_strsplit(buf, ":", 1);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1742
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1743 /* Let's build a new response */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1744 g_snprintf(buf, IRC_BUF_LEN, "PONG :%s\n", buf2[1]);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1745 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1746
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1747 /* And clean up after ourselves */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1748 g_strfreev(buf2);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1749
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1750 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1751 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1752
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1753 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1754
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1755 static void irc_close(struct gaim_connection *gc)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1756 {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1757 struct irc_data *idata = (struct irc_data *)gc->proto_data;
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1758 GList *chats = idata->channels;
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1759 struct irc_channel *cc;
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1760
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1761 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1762
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1763 g_snprintf(buf, IRC_BUF_LEN, "QUIT :Download GAIM [%s]\n", WEBSITE);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1764 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1765
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1766 g_free(buf);
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1767
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1768 if (idata->timer)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1769 gtk_timeout_remove(idata->timer);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1770
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1771 while (chats) {
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1772 cc = (struct irc_channel *)chats->data;
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1773 g_free(cc->name);
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1774 chats = g_list_remove(chats, cc);
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1775 g_free(cc);
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1776 }
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1777
1021
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1778 if (gc->inpa)
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1779 gdk_input_remove(gc->inpa);
90e8714bf95b [gaim-migrate @ 1031]
Rob Flynn <gaim@robflynn.com>
parents: 1019
diff changeset
1780
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1781 if (idata->inpa)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1782 gdk_input_remove(idata->inpa);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1783
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1784 close(idata->fd);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1785 g_free(gc->proto_data);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1786 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1787
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1788 static void irc_chat_leave(struct gaim_connection *gc, int id)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1789 {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1790 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1791 struct irc_channel *channel;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1792 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1793
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1794 channel = find_channel_by_id(gc, id);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1795
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1796 if (!channel) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1797 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1798 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1799
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1800 g_snprintf(buf, IRC_BUF_LEN, "PART #%s\n", channel->name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1801 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1802
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1803 g_free(buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1804 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1805
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1806 static void irc_login_callback(gpointer data, gint source, GdkInputCondition condition)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1807 {
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1808 struct gaim_connection *gc = data;
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1809 struct irc_data *idata = gc->proto_data;
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1810 char buf[4096];
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1811
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1812 if (source == -1) {
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1813 hide_login_progress(gc, "Write error");
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1814 signoff(gc);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1815 return;
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1816 }
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1817
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1818 if (idata->fd == 0)
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1819 idata->fd = source;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1820
1847
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1821 g_snprintf(buf, 4096, "NICK %s\n USER %s localhost %s :GAIM (%s)\n",
029cc08d9c54 [gaim-migrate @ 1857]
Rob Flynn <gaim@robflynn.com>
parents: 1844
diff changeset
1822 gc->username, g_get_user_name(), gc->user->proto_opt[USEROPT_SERV], WEBSITE);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1823
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1824 if (write(idata->fd, buf, strlen(buf)) < 0) {
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1825 hide_login_progress(gc, "Write error");
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1826 signoff(gc);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1827 return;
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1828 }
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1829
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1830 idata->inpa = gdk_input_add(idata->fd, GDK_INPUT_READ, irc_callback, gc);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1831 idata->inpa = 0;
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1832
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1833 /* Now lets sign ourselves on */
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1834 account_online(gc);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1835 serv_finish_login(gc);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1836
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1837 if (bud_list_cache_exists(gc))
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1838 do_import(NULL, gc);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1839
1269
677e2c9e8baf [gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1266
diff changeset
1840 /* we don't call this now because otherwise some IRC servers might not like us */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1841 idata->timer = gtk_timeout_add(20000, (GtkFunction)irc_request_buddy_update, gc);
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1842 }
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1843
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1844 static void irc_login(struct aim_user *user)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1845 {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1846 char buf[4096];
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1847
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1075
diff changeset
1848 struct gaim_connection *gc = new_gaim_conn(user);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1849 struct irc_data *idata = gc->proto_data = g_new0(struct irc_data, 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1850
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1851 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1852 set_login_progress(gc, 2, buf);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1853
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1854 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV],
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1855 user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 6667,
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1842
diff changeset
1856 irc_login_callback, gc);
1866
466fc4ada7cb [gaim-migrate @ 1876]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1864
diff changeset
1857 if (!user->gc || (idata->fd < 0)) {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1858 hide_login_progress(gc, "Unable to create socket");
1115
114cd406b022 [gaim-migrate @ 1125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1105
diff changeset
1859 signoff(gc);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1860 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1861 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
1862 }
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
1863
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1864 static void irc_print_option(GtkEntry *entry, struct aim_user *user)
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1865 {
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1866 int entrynum;
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1867
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1868 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1869
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1870 if (entrynum == USEROPT_SERV) {
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1871 g_snprintf(user->proto_opt[USEROPT_SERV],
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1872 sizeof(user->proto_opt[USEROPT_SERV]), "%s", gtk_entry_get_text(entry));
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1873 } else if (entrynum == USEROPT_PORT) {
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1874 g_snprintf(user->proto_opt[USEROPT_PORT],
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1875 sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry));
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1876 }
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1877 }
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1878
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1879 static void irc_user_opts(GtkWidget * book, struct aim_user *user)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1880 {
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1881 /* so here, we create the new notebook page */
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1882 GtkWidget *vbox;
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1883 GtkWidget *hbox;
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1884 GtkWidget *label;
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1885 GtkWidget *entry;
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1886
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1887 vbox = gtk_vbox_new(FALSE, 5);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1888 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1889 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("IRC Options"));
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1890 gtk_widget_show(vbox);
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1891
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1892 hbox = gtk_hbox_new(FALSE, 5);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1893 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1894 gtk_widget_show(hbox);
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1895
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1896 label = gtk_label_new("Server:");
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1897 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1898 gtk_widget_show(label);
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1899
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1900 entry = gtk_entry_new();
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1901 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1902 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SERV);
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1903 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user);
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1904 if (user->proto_opt[USEROPT_SERV][0]) {
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1905 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SERV]);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1906 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SERV]);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1907 }
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1908 gtk_widget_show(entry);
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1909
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1910 hbox = gtk_hbox_new(FALSE, 0);
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1911 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1912 gtk_widget_show(hbox);
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1913
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1914 label = gtk_label_new("Port:");
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1915 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1916 gtk_widget_show(label);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1917
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1918 entry = gtk_entry_new();
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1919 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1920 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PORT);
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1842
diff changeset
1921 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user);
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1922 if (user->proto_opt[USEROPT_PORT][0]) {
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1923 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]);
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1924 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]);
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1842
diff changeset
1925 } else
1875
c0a69f90d662 [gaim-migrate @ 1885]
Rob Flynn <gaim@robflynn.com>
parents: 1866
diff changeset
1926 gtk_entry_set_text(GTK_ENTRY(entry), "6667");
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1842
diff changeset
1927
1842
1d137dde946f [gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1831
diff changeset
1928 gtk_widget_show(entry);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1929 }
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
1930
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1931 static char **irc_list_icon(int uc)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1932 {
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1933 return free_icon_xpm;
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1934 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1935
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1936 /* Send out a ping request to the specified user */
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1937 static void irc_send_ping(GtkObject * w, char *who)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1938 {
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1939 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w);
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1940 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1941 char buf[BUF_LEN];
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1942
1393
3b5c7f8bb2b5 [gaim-migrate @ 1403]
Rob Flynn <gaim@robflynn.com>
parents: 1304
diff changeset
1943 g_snprintf(buf, BUF_LEN, "PRIVMSG %s :%cPING %ld%c\n", who, '\001', time((time_t *)NULL), '\001');
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1944
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1945 write(idata->fd, buf, strlen(buf));
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1946 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1947
1673
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1948 /* Do a whois check on someone :-) */
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1949 static void irc_get_info(struct gaim_connection *gc, char *who)
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1950 {
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1951 struct irc_data *idata = (struct irc_data *)gc->proto_data;
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1952 char buf[BUF_LEN];
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1953
1831
1b61db419774 [gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1954 if (((who[0] == '@') || (who[0] == '+')) && (strlen(who)>1))
1673
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1955 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who+1);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1956 else
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1957 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1958 write(idata->fd, buf, strlen(buf));
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1959 }
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1960
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1961 static void irc_send_whois(GtkObject * w, char *who)
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1962 {
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1963 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1964 irc_get_info(gc, who);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1965 }
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1966
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1443
diff changeset
1967 static void irc_buddy_menu(GtkWidget * menu, struct gaim_connection *gc, char *who)
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1968 {
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1969 GtkWidget *button;
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1970
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1971 button = gtk_menu_item_new_with_label("Ping");
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
1972 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_ping), who);
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1973 gtk_object_set_user_data(GTK_OBJECT(button), gc);
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1974 gtk_menu_append(GTK_MENU(menu), button);
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1975 gtk_widget_show(button);
1673
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1976
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1977 button = gtk_menu_item_new_with_label("Whois");
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1978 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_whois), who);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1979 gtk_object_set_user_data(GTK_OBJECT(button), gc);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1980 gtk_menu_append(GTK_MENU(menu), button);
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
1981 gtk_widget_show(button);
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1982 }
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1983
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
1984
1676
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1985 static void irc_set_away(struct gaim_connection *gc, char *state, char *msg)
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1986 {
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1987 struct irc_data *idata = (struct irc_data *)gc->proto_data;
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1988 char buf[BUF_LEN];
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1989
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1990 if (msg)
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1991 g_snprintf(buf, BUF_LEN, "AWAY :%s\n", msg);
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1992 else
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1993 g_snprintf(buf, BUF_LEN, "AWAY\n");
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1994
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1995 write(idata->fd, buf, strlen(buf));
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1996 }
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
1997
1678
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
1998 static void irc_fake_buddy(struct gaim_connection *gc, char *who)
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
1999 {
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2000 /* Heh, there is no buddy list. We fake it.
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2001 * I just need this here so the add and remove buttons will
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2002 * show up */
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2003 }
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2004
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2005
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2006
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2007 static struct prpl *my_protocol = NULL;
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2008
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
2009 static void irc_init(struct prpl *ret)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
2010 {
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
2011 ret->protocol = PROTO_IRC;
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
2012 ret->name = irc_name;
1178
4291c96c5096 [gaim-migrate @ 1188]
Rob Flynn <gaim@robflynn.com>
parents: 1134
diff changeset
2013 ret->list_icon = irc_list_icon;
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1443
diff changeset
2014 ret->buddy_menu = irc_buddy_menu;
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1056
diff changeset
2015 ret->user_opts = irc_user_opts;
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
2016 ret->login = irc_login;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
2017 ret->close = irc_close;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
2018 ret->send_im = irc_send_im;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
2019 ret->join_chat = irc_join_chat;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
2020 ret->chat_leave = irc_chat_leave;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
2021 ret->chat_send = irc_chat_send;
1673
0ded38ffc7c8 [gaim-migrate @ 1683]
Rob Flynn <gaim@robflynn.com>
parents: 1672
diff changeset
2022 ret->get_info = irc_get_info;
1676
a3d857c8984e [gaim-migrate @ 1686]
Rob Flynn <gaim@robflynn.com>
parents: 1675
diff changeset
2023 ret->set_away = irc_set_away;
1678
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2024 ret->add_buddy = irc_fake_buddy;
1573a65fd0cd [gaim-migrate @ 1688]
Rob Flynn <gaim@robflynn.com>
parents: 1676
diff changeset
2025 ret->remove_buddy = irc_fake_buddy;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2026
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2027 my_protocol = ret;
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2028 }
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2029
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
2030 char *gaim_plugin_init(GModule * handle)
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
2031 {
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1394
diff changeset
2032 load_protocol(irc_init, sizeof(struct prpl));
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2033 return NULL;
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2034 }
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2035
1266
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
2036 void gaim_plugin_remove()
aac04affc65d [gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1265
diff changeset
2037 {
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2038 struct prpl *p = find_prpl(PROTO_IRC);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2039 if (p == my_protocol)
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2040 unload_protocol(p);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1046
diff changeset
2041 }