annotate plugins/irc.c @ 1019:1c253f8a117c

[gaim-migrate @ 1029] Burp committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Mon, 23 Oct 2000 08:33:22 +0000
parents bbd0d51b7d14
children 90e8714bf95b
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 *
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 2000, Rob Flynn <rob@tgflinux.com>
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 #ifdef HAVE_CONFIG_H
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 #include "../config.h"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #endif
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <netdb.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <gtk/gtk.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <unistd.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <errno.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <netinet/in.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #include <arpa/inet.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include <string.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <stdlib.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include <stdio.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <time.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <sys/socket.h>
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #include <sys/stat.h>
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"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 #include "aim.h"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 #include "gnome_applet_mgr.h"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include "pixmaps/cancel.xpm"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 #include "pixmaps/ok.xpm"
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
49 /* FIXME: We shouldn't have hard coded servers and ports :-) */
1019
1c253f8a117c [gaim-migrate @ 1029]
Rob Flynn <gaim@robflynn.com>
parents: 1017
diff changeset
50 #define IRC_SERVER "irc.undernet.org"
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
51 #define IRC_PORT 6667
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
52
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
53 #define IRC_BUF_LEN 4096
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
54
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
55 static int chat_id = 0;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
56
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
57 struct irc_channel {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
58 int id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
59 gchar *name;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
60 };
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
61
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
62 struct irc_data {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
63 int fd;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
64
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
65 GList *channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
66 };
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
67
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
68 static char *irc_name() {
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
69 return "IRC";
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
70 }
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
71
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
72 char *name() {
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
73 return "IRC";
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
74 }
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
75
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
76 char *description() {
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
77 return "Allows gaim to use the IRC protocol";
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
78 }
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
79
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
80 void irc_join_chat( struct gaim_connection *gc, int id, char *name) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
81 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
82 gchar *buf = (gchar *)g_malloc(IRC_BUF_LEN+1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
83
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
84 g_snprintf(buf, IRC_BUF_LEN, "JOIN %s\n", name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
85 write(idata->fd, buf, strlen(buf));
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
86
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
87 g_free(buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
88 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
89
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
90 void irc_send_im( struct gaim_connection *gc, char *who, char *message, int away) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
91
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
92 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
93 gchar *buf = (gchar *)g_malloc(IRC_BUF_LEN + 1);
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 /* Before we actually send this, we should check to see if they're trying
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
96 * To issue a /me command and handle it properly. */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
97
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
98 if ( (g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message)>4)) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
99 /* We have /me!! We have /me!! :-) */
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 gchar *temp = (gchar *)g_malloc(IRC_BUF_LEN+1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
102 strcpy(temp, message+4);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
103 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%cACTION %s%c\n", who, '\001', temp, '\001');
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
104 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
105 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
106 else
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
107 {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
108 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
109 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
110
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
111 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
112
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
113 g_free(buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
114 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
115
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
116 int find_id_by_name(struct gaim_connection *gc, char *name) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
117 gchar *temp = (gchar *)g_malloc(IRC_BUF_LEN + 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
118 GList *templist;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
119 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
120
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
121 templist = ((struct irc_data *)gc->proto_data)->channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
122
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
123 while (templist) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
124 channel = (struct irc_channel *)templist->data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
125
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
126 g_snprintf(temp, IRC_BUF_LEN, "#%s", channel->name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
127
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
128 if (g_strcasecmp(temp, name) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
129 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
130 return channel->id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
131 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
132
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
133 templist = templist -> next;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
134 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
135
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
136 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
137
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
138 /* Return -1 if we have no ID */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
139 return -1;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
140 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
141
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
142 struct irc_channel * find_channel_by_name(struct gaim_connection *gc, char *name) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
143 gchar *temp = (gchar *)g_malloc(IRC_BUF_LEN + 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
144 GList *templist;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
145 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
146
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
147 templist = ((struct irc_data *)gc->proto_data)->channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
148
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
149 while (templist) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
150 channel = (struct irc_channel *)templist->data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
151
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
152 g_snprintf(temp, IRC_BUF_LEN, "%s", channel->name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
153
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
154 if (g_strcasecmp(temp, name) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
155 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
156 return channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
157 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
158
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
159 templist = templist -> next;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
160 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
161
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
162 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
163
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
164 /* If we found nothing, return nothing :-) */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
165 return NULL;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
166 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
167
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
168 struct irc_channel * find_channel_by_id (struct gaim_connection *gc, int id) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
169 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
170 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
171
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
172 GList *temp;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
173
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
174 temp = idata->channels;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
175
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
176 while (temp) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
177 channel = (struct irc_channel *)temp->data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
178
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
179 if (channel->id == id) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
180 /* We've found our man */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
181 return channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
182 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
183
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
184 temp = temp->next;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
185 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
186
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
187
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
188 /* If we didnt find one, return NULL */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
189 return NULL;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
190 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
191
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
192 void irc_chat_send( struct gaim_connection *gc, int id, char *message) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
193
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
194 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
195 struct irc_channel *channel = g_new0(struct irc_channel, 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
196 gchar *buf = (gchar *)g_malloc(IRC_BUF_LEN + 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
197
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
198 /* First lets get our current channel */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
199 channel = find_channel_by_id(gc, id);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
200
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
201
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
202 if (!channel) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
203 /* If for some reason we've lost our channel, let's bolt */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
204 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
205 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
206
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
207
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
208 /* Before we actually send this, we should check to see if they're trying
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
209 * To issue a /me command and handle it properly. */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
210
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
211 if ( (g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message)>4)) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
212 /* We have /me!! We have /me!! :-) */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
213
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
214 gchar *temp = (gchar *)g_malloc(IRC_BUF_LEN+1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
215 strcpy(temp, message+4);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
216 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%cACTION %s%c\n", channel->name, '\001', temp, '\001');
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
217 g_free(temp);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
218 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
219 else
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 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%s\n", channel->name, message);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
222 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
223
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
224 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
225
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
226 /* Since AIM expects us to receive the message we send, we gotta fake it */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
227 serv_got_chat_in(gc, id, gc->username, 0, message);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
228
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
229 g_free(buf);
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
230 }
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
231
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
232 struct conversation * find_conversation_by_id( struct gaim_connection * gc, int id) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
233 struct irc_data *idata = (struct irc_data *)gc->proto_data;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
234 GSList *bc = gc->buddy_chats;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
235 struct conversation *b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
236
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
237 while (bc) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
238 b = (struct conversation *)bc->data;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
239 if (id == b->id) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
240 break;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
241 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
242 bc = bc->next;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
243 b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
244 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
245
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
246 if (!b) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
247 return NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
248 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
249
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
250 return b;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
251 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
252
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
253 struct conversation * find_conversation_by_name( struct gaim_connection * gc, char *name) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
254 struct irc_data *idata = (struct irc_data *)gc->proto_data;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
255 GSList *bc = gc->buddy_chats;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
256 struct conversation *b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
257
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
258 while (bc) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
259 b = (struct conversation *)bc->data;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
260
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
261 if (g_strcasecmp(name, b->name) == 0) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
262 break;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
263 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
264 bc = bc->next;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
265 b = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
266 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
267
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
268 if (!b) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
269 return NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
270 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
271
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
272 return b;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
273 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
274
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
275
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
276
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
277 void irc_callback ( struct gaim_connection * gc ) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
278
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
279 int i = 0;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
280 char c;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
281 gchar buf[4096];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
282 gchar **buf2;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
283 int status;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
284 struct irc_data *idata;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
285
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
286 idata = (struct irc_data *)gc->proto_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 do {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
289 status = recv(idata->fd, &c, 1, 0);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
290
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
291 if (!status)
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
292 {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
293 exit(1);
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 buf[i] = c;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
296 i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
297 } while (c != '\n');
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
298
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
299 buf[i] = '\0';
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
300
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
301 /* And remove that damned trailing \n */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
302 g_strchomp(buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
303
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
304 /* For now, lets display everything to the console too. Im such
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
305 * a bitch */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
306 printf("IRC:'%'s\n", buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
307
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
308
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
309 /* 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
310 * a channel */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
311
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
312 if (((strstr(buf, " 353 ")) && (!strstr(buf, "PRIVMSG")) &&
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
313 (!strstr(buf, "NOTICE")))) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
314 gchar u_host[255];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
315 gchar u_command[32];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
316 gchar u_channel[128];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
317 gchar u_names[IRC_BUF_LEN + 1];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
318 struct conversation *convo = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
319 int j;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
320
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
321 for (j = 0, i = 0; buf[i] != ' '; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
322 u_host[j] = buf[i];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
323 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
324
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
325 u_host[j] = '\0'; i++;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
326
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
327 for (j = 0; buf[i] != ' '; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
328 u_command[j] = buf[i];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
329 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
330
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
331 u_command[j] = '\0'; i++;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
332
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
333 for (j = 0; buf[i] != '#'; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
334 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
335 i++;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
336
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
337 for (j = 0; buf[i] != ':'; j++, i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
338 u_channel[j] = buf[i];
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
339 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
340
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
341 u_channel[j-1] = '\0'; i++;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
342
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
343 while ((buf[i] == ' ') || (buf[i] == ':')) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
344 i++;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
345 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
346
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
347 strcpy(u_names, buf + i);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
348
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
349 buf2 = g_strsplit(u_names, " ", 0);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
350
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
351 /* Let's get our conversation window */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
352 convo = find_conversation_by_name(gc, u_channel);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
353
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
354 if (!convo) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
355 return;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
356 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
357
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
358 /* Now that we've parsed the hell out of this big
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
359 * mess, let's try to split up the names properly */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
360
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
361 for (i = 0; buf2[i] != NULL; i++) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
362 /* We shouldnt play with ourselves */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
363 if (g_strcasecmp(buf2[i], gc->username) != 0) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
364 /* Add the person to the list */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
365 add_chat_buddy(convo, buf2[i]);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
366 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
367 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
368
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
369 return;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
370
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
371 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
372
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
373
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
374 if ( (strstr(buf, " JOIN ")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
375
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
376 gchar u_channel[128];
1012
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
377 gchar u_nick[128];
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
378
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
379 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
380 int id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
381 int j;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
382
1012
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
383 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
384 u_nick[j] = buf[i];
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
385 }
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
386
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
387 u_nick[j] = '\0'; i++;
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
388
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
389 for (j = 0; buf[i] != '#'; j++, i++) {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
390 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
391
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
392 i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
393
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
394 strcpy(u_channel, buf+i);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
395
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
396 /* Looks like we're going to join the channel for real
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
397 * now. Let's create a valid channel structure and add
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
398 * it to our list. Let's make sure that
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
399 * we are not already in a channel first */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
400
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
401 channel = find_channel_by_name(gc, u_channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
402
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
403 if (!channel) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
404 chat_id++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
405
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
406 channel = g_new0(struct irc_channel, 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
407
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
408 channel->id = chat_id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
409 channel->name = strdup(u_channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
410
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
411 idata->channels = g_list_append(idata->channels, channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
412
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
413 printf("Started channel with ID %d\n", chat_id);
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
414 serv_got_joined_chat(gc, chat_id, u_channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
415 } else {
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
416 struct conversation *convo = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
417
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
418 /* Someone else joined. Find their conversation
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
419 * window */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
420 convo = find_conversation_by_id(gc, channel->id);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
421
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
422 /* And add their name to it */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
423 add_chat_buddy(convo, u_nick);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
424
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
425 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
426
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
427 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
428 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
429
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
430 if ( (strstr(buf, " PART ")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
431
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
432 gchar u_channel[128];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
433 gchar u_nick[128];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
434
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
435 struct irc_channel *channel = g_new0(struct irc_channel, 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
436 int id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
437 int j;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
438 GList *test = NULL;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
439
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
440 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
441 u_nick[j] = buf[i];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
442 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
443 u_nick[j] = '\0';
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
444
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
445 i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
446
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
447 for (j = 0; buf[i] != '#'; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
448 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
449
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
450 i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
451
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
452 strcpy(u_channel, buf+i);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
453
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
454
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
455 /* Now, lets check to see if it was US that was leaving.
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
456 * 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
457 * old channel stuff. Otherwise,
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
458 * we should just print that someone left */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
459
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
460 channel = find_channel_by_name(gc, u_channel);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
461
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
462 if (!channel) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
463 return;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
464 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
465
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
466 if (g_strcasecmp(u_nick, gc->username) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
467
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
468 /* Looks like we're going to leave the channel for
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
469 * real now. Let's create a valid channel structure
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
470 * and add it to our list */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
471
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
472 serv_got_chat_left(gc, channel->id);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
473
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
474 idata->channels = g_list_remove(idata->channels, channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
475 g_free(channel);
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
476 } else {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
477 struct conversation *convo = NULL;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
478
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
479 /* Find their conversation window */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
480 convo = find_conversation_by_id(gc, channel->id);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
481
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
482 if (!convo) {
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
483 /* Some how the window doesn't exist.
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
484 * Let's get out of here */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
485 return ;
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
486 }
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
487
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
488 /* And remove their name */
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
489 remove_chat_buddy(convo, u_nick);
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
490
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
491 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
492
1014
bc4f6a535bd9 [gaim-migrate @ 1024]
Rob Flynn <gaim@robflynn.com>
parents: 1012
diff changeset
493 /* Go Home! */
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
494 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
495 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
496
1012
7e8dcc609b30 [gaim-migrate @ 1022]
Rob Flynn <gaim@robflynn.com>
parents: 1011
diff changeset
497 if ( (strstr(buf, " PRIVMSG ")) && (buf[0] == ':')) {
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
498 gchar u_nick[128];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
499 gchar u_host[255];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
500 gchar u_command[32];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
501 gchar u_channel[128];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
502 gchar u_message[IRC_BUF_LEN];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
503 int j;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
504 int msgcode = 0;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
505
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
506 for (j = 0, i = 1; buf[i] != '!'; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
507 u_nick[j] = buf[i];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
508 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
509
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
510 u_nick[j] = '\0'; i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
511
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
512 for (j = 0; buf[i] != ' '; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
513 u_host[j] = buf[i];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
514 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
515
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
516 u_host[j] = '\0'; i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
517
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
518 for (j = 0; buf[i] != ' '; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
519 u_command[j] = buf[i];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
520 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
521
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
522 u_command[j] = '\0'; i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
523
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
524 for (j = 0; buf[i] != ':'; j++, i++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
525 u_channel[j] = buf[i];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
526 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
527
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
528 u_channel[j-1] = '\0'; i++;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
529
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
530
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
531 /* Now that everything is parsed, the rest of this baby must be our message */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
532 strncpy(u_message, buf + i, IRC_BUF_LEN);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
533
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
534 /* Now, lets check the message to see if there's anything special in it */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
535 if (u_message[0] == '\001') {
1017
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
536 if (g_strncasecmp(u_message, "\001VERSION", 8) == 0) {
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
537 /* Looks like we have a version request. Let
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
538 * us handle it thusly */
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
539
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
540 g_snprintf(buf, IRC_BUF_LEN, "NOTICE %s :%cVERSION GAIM %s:The Pimpin Penguin AIM Clone:www.marko.net/gaim%c\n", u_nick, '\001', VERSION, '\001');
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
541
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
542 write(idata->fd, buf, strlen(buf));
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
543
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
544 /* And get the heck out of dodge */
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
545 return;
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
546 }
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
547
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
548 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) {
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
549 /* Someone's triyng to ping us. Let's respond */
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
550 gchar u_arg[24];
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
551
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
552 strcpy(u_arg, u_message + 6);
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
553 u_arg[strlen(u_arg)-1] = '\0';
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
554
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
555 g_snprintf(buf, IRC_BUF_LEN, "NOTICE %s :%cPING %s%c\n", u_nick, '\001', u_arg, '\001');
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
556
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
557 write(idata->fd, buf, strlen(buf));
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
558
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
559 /* And get the heck out of dodge */
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
560 return;
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
561 }
bbd0d51b7d14 [gaim-migrate @ 1027]
Rob Flynn <gaim@robflynn.com>
parents: 1014
diff changeset
562
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
563 if (g_strncasecmp(u_message, "\001ACTION ", 8) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
564 /* Looks like we have an action. Let's parse it a little */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
565 strcpy(buf, u_message);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
566
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
567 strcpy(u_message, "/me ");
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
568 for (j = 4, i = 8; buf[i] != '\001'; i++, j++) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
569 u_message[j] = buf[i];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
570 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
571 u_message[j] = '\0';
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
572 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
573 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
574
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
575
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
576 /* Let's check to see if we have a channel on our hands */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
577 if (u_channel[0] == '#') {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
578 /* Yup. We have a channel */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
579 int id;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
580
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
581 id = find_id_by_name(gc, u_channel);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
582 if (id != -1) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
583 serv_got_chat_in(gc, id, u_nick, 0, u_message);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
584 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
585 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
586 else {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
587 /* Nope. Let's treat it as a private message */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
588 serv_got_im(gc, u_nick, u_message, 0);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
589 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
590
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
591 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
592 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
593
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
594 /* 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
595
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
596 if (strncmp(buf, "PING :", 6) == 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
597 buf2 = g_strsplit(buf, ":", 1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
598
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
599 /* Let's build a new response */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
600 g_snprintf(buf, IRC_BUF_LEN, "PONG :%s\n", buf2[1]);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
601 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
602
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
603 /* And clean up after ourselves */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
604 g_strfreev(buf2);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
605
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
606 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
607 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
608
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
609 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
610
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
611 void irc_handler(gpointer data, gint source, GdkInputCondition condition) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
612 irc_callback(data);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
613 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
614
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
615 void irc_close(struct gaim_connection *gc) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
616 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
617 gchar *buf = (gchar *)g_malloc(IRC_BUF_LEN);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
618
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
619 g_snprintf(buf, IRC_BUF_LEN, "QUIT :GAIM [www.marko.net/gaim]\n");
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
620 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
621
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
622 g_free(buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
623 close(idata->fd);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
624 g_free(gc->proto_data);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
625 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
626
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
627 void irc_chat_leave(struct gaim_connection *gc, int id) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
628 struct irc_data *idata = (struct irc_data *)gc->proto_data;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
629 struct irc_channel *channel;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
630 gchar *buf = (gchar *)g_malloc(IRC_BUF_LEN+1);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
631
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
632 channel = find_channel_by_id(gc, id);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
633
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
634 if (!channel) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
635 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
636 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
637
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
638 g_snprintf(buf, IRC_BUF_LEN, "PART #%s\n", channel->name);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
639 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
640
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
641 g_free(buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
642 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
643
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
644 void irc_login(struct aim_user *user) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
645 int fd;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
646 struct hostent *host;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
647 struct sockaddr_in site;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
648 char buf[4096];
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
649
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
650 struct gaim_connection *gc = new_gaim_conn(PROTO_IRC, user->username, user->password);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
651 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
652 char c;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
653 int i;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
654 int status;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
655
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
656 set_login_progress(gc, 1, buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
657
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
658 while (gtk_events_pending())
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
659 gtk_main_iteration();
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
660
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
661 host = gethostbyname(IRC_SERVER);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
662 if (!host) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
663 hide_login_progress(gc, "Unable to resolve hostname");
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
664 destroy_gaim_conn(gc);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
665 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
666 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
667
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
668 site.sin_family = AF_INET;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
669 site.sin_addr.s_addr = *(long *)(host->h_addr);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
670 site.sin_port = htons(IRC_PORT);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
671
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
672 fd = socket(AF_INET, SOCK_STREAM, 0);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
673 if (fd < 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
674 hide_login_progress(gc, "Unable to create socket");
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
675 destroy_gaim_conn(gc);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
676 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
677 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
678
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
679 if (connect(fd, (struct sockaddr *)&site, sizeof(site)) < 0) {
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
680 hide_login_progress(gc, "Unable to connect.");
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
681 destroy_gaim_conn(gc);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
682 return;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
683 }
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
684
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
685 idata->fd = fd;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
686
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
687 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
688 set_login_progress(gc, 2, buf);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
689
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
690 /* This is where we will attempt to sign on */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
691
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
692 /* FIXME: This should be their servername, not their username. im just lazy right now */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
693
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
694 g_snprintf(buf, 4096, "NICK %s\nUSER %s localhost %s :GAIM (www.marko.net/gaim)\n", gc->username, gc->username, gc->username);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
695 write(idata->fd, buf, strlen(buf));
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
696
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
697
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
698 /* Now lets sign ourselves on */
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
699 account_online(gc);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
700
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
701 if (mainwindow)
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
702 gtk_widget_hide(mainwindow);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
703
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
704 show_buddy_list();
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
705 refresh_buddy_window();
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
706
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
707 serv_finish_login(gc);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
708 gaim_setup(gc);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
709
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
710 gc->inpa = gdk_input_add(idata->fd, GDK_INPUT_READ, irc_handler, gc);
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
711 }
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
712
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
713 struct prpl *irc_init() {
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
714 struct prpl *ret = g_new0(struct prpl, 1);
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
715
1008
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
716 ret->protocol = PROTO_IRC;
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
717 ret->name = irc_name;
1b99caffcd98 [gaim-migrate @ 1018]
Rob Flynn <gaim@robflynn.com>
parents: 987
diff changeset
718 ret->login = irc_login;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
719 ret->close = irc_close;
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
720 ret->send_im = irc_send_im;
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
721 ret->set_info = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
722 ret->get_info = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
723 ret->set_away = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
724 ret->get_away_msg = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
725 ret->set_dir = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
726 ret->get_dir = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
727 ret->dir_search = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
728 ret->set_idle = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
729 ret->change_passwd = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
730 ret->add_buddy = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
731 ret->add_buddies = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
732 ret->remove_buddy = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
733 ret->add_permit = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
734 ret->add_deny = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
735 ret->warn = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
736 ret->accept_chat = NULL;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
737 ret->join_chat = irc_join_chat;
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
738 ret->chat_invite = NULL;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
739 ret->chat_leave = irc_chat_leave;
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
740 ret->chat_whisper = NULL;
1011
4867280dbdc7 [gaim-migrate @ 1021]
Rob Flynn <gaim@robflynn.com>
parents: 1008
diff changeset
741 ret->chat_send = irc_chat_send;
987
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
742 ret->keepalive = NULL;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
743
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
744 return ret;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
745 }
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
746
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
747 int gaim_plugin_init(void *handle) {
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
748 protocols = g_slist_append(protocols, irc_init());
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
749 return 0;
cf6662982b40 [gaim-migrate @ 997]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
750 }