6333
|
1 /**
|
|
2 * @file irc.h
|
|
3 *
|
|
4 * gaim
|
|
5 *
|
|
6 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu>
|
|
7 *
|
|
8 * This program is free software; you can redistribute it and/or modify
|
|
9 * it under the terms of the GNU General Public License as published by
|
|
10 * the Free Software Foundation; either version 2 of the License, or
|
|
11 * (at your option) any later version.
|
|
12 *
|
|
13 * This program is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 * GNU General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU General Public License
|
|
19 * along with this program; if not, write to the Free Software
|
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21 */
|
|
22
|
|
23 #ifndef _GAIM_IRC_H
|
|
24 #define _GAIM_IRC_H
|
|
25
|
|
26 #include <glib.h>
|
|
27
|
8114
|
28 #include "roomlist.h"
|
10365
|
29 #include "sslconn.h"
|
6333
|
30
|
|
31 #define IRC_DEFAULT_SERVER "irc.freenode.net"
|
|
32 #define IRC_DEFAULT_PORT 6667
|
10365
|
33 #define IRC_DEFAULT_SSL_PORT 994
|
6333
|
34
|
|
35 #define IRC_DEFAULT_CHARSET "UTF-8"
|
|
36 #define IRC_DEFAULT_ALIAS "gaim"
|
|
37
|
11073
|
38 #define IRC_DEFAULT_QUIT "Download Gaim: " GAIM_WEBSITE
|
|
39
|
6333
|
40 #define IRC_INITIAL_BUFSIZE 1024
|
|
41
|
8351
|
42
|
6333
|
43 enum { IRC_USEROPT_SERVER, IRC_USEROPT_PORT, IRC_USEROPT_CHARSET };
|
|
44 enum irc_state { IRC_STATE_NEW, IRC_STATE_ESTABLISHED };
|
|
45
|
|
46 struct irc_conn {
|
|
47 GaimAccount *account;
|
|
48 GHashTable *msgs;
|
|
49 GHashTable *cmds;
|
|
50 char *server;
|
|
51 int fd;
|
|
52 guint timer;
|
|
53 GHashTable *buddies;
|
|
54
|
|
55 char *inbuf;
|
|
56 int inbuflen;
|
|
57 int inbufused;
|
|
58
|
|
59 GString *motd;
|
|
60 GString *names;
|
|
61 char *nameconv;
|
|
62 struct _whois {
|
|
63 char *nick;
|
|
64 char *away;
|
|
65 char *userhost;
|
|
66 char *name;
|
|
67 char *server;
|
|
68 char *serverinfo;
|
|
69 char *channels;
|
|
70 int ircop;
|
|
71 int identified;
|
|
72 int idle;
|
|
73 time_t signon;
|
|
74 } whois;
|
8114
|
75 GaimRoomlist *roomlist;
|
10365
|
76 GaimSslConnection *gsc;
|
9440
|
77
|
|
78 gboolean quitting;
|
6333
|
79 };
|
|
80
|
|
81 struct irc_buddy {
|
|
82 char *name;
|
|
83 gboolean online;
|
|
84 gboolean flag;
|
|
85 };
|
|
86
|
|
87 typedef int (*IRCCmdCallback) (struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
88
|
|
89 int irc_send(struct irc_conn *irc, const char *buf);
|
|
90 gboolean irc_blist_timeout(struct irc_conn *irc);
|
|
91
|
|
92 char *irc_mirc2html(const char *string);
|
8529
|
93 char *irc_mirc2txt(const char *string);
|
6333
|
94
|
10208
|
95 gboolean irc_ischannel(const char *string);
|
|
96
|
9130
|
97 void irc_register_commands(void);
|
6333
|
98 void irc_msg_table_build(struct irc_conn *irc);
|
|
99 void irc_parse_msg(struct irc_conn *irc, char *input);
|
|
100 char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice);
|
|
101 char *irc_format(struct irc_conn *irc, const char *format, ...);
|
|
102
|
|
103 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
104 void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
105 void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args);
|
10633
|
106 void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
10659
|
107 void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
108 void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
109 void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
110 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
111 void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
112 void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
113 void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
114 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
115 void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
116 void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
8114
|
117 void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
118 void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
119 void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
120 void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
121 void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
122 void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args);
|
7877
|
123 void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
124 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6718
|
125 void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
126 void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
127 void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
128 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
129 void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
130 void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
131 void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
132 void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
133 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6714
|
134 void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
135 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args);
|
10564
|
136 void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
137 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args);
|
10712
|
138 void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
139 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
140 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
141 void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
142
|
|
143 void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
144
|
|
145 void irc_cmd_table_build(struct irc_conn *irc);
|
|
146
|
|
147 int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
148 int irc_cmd_away(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
149 int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
150 int irc_cmd_invite(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
151 int irc_cmd_join(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
152 int irc_cmd_kick(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
8114
|
153 int irc_cmd_list(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
6333
|
154 int irc_cmd_mode(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
155 int irc_cmd_names(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
156 int irc_cmd_nick(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
157 int irc_cmd_op(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
158 int irc_cmd_privmsg(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
159 int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
160 int irc_cmd_ping(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
161 int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
162 int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
163 int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
164 int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
10564
|
165 int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
6333
|
166 int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
167 int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
168 int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
169
|
9466
|
170 void irc_dccsend_send_file(GaimConnection *gc, const char *who, const char *file);
|
8351
|
171 void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg);
|
6333
|
172 #endif /* _GAIM_IRC_H */
|