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"
|
6333
|
29
|
|
30 #define IRC_DEFAULT_SERVER "irc.freenode.net"
|
|
31 #define IRC_DEFAULT_PORT 6667
|
|
32
|
|
33 #define IRC_DEFAULT_CHARSET "UTF-8"
|
|
34 #define IRC_DEFAULT_ALIAS "gaim"
|
|
35
|
|
36 #define IRC_INITIAL_BUFSIZE 1024
|
|
37
|
8351
|
38
|
6333
|
39 enum { IRC_USEROPT_SERVER, IRC_USEROPT_PORT, IRC_USEROPT_CHARSET };
|
|
40 enum irc_state { IRC_STATE_NEW, IRC_STATE_ESTABLISHED };
|
|
41
|
|
42 struct irc_conn {
|
|
43 GaimAccount *account;
|
|
44 GHashTable *msgs;
|
|
45 GHashTable *cmds;
|
|
46 char *server;
|
|
47 int fd;
|
|
48 guint timer;
|
|
49 GHashTable *buddies;
|
|
50
|
|
51 char *inbuf;
|
|
52 int inbuflen;
|
|
53 int inbufused;
|
|
54
|
|
55 GString *motd;
|
|
56 GString *names;
|
|
57 char *nameconv;
|
|
58 struct _whois {
|
|
59 char *nick;
|
|
60 char *away;
|
|
61 char *userhost;
|
|
62 char *name;
|
|
63 char *server;
|
|
64 char *serverinfo;
|
|
65 char *channels;
|
|
66 int ircop;
|
|
67 int identified;
|
|
68 int idle;
|
|
69 time_t signon;
|
|
70 } whois;
|
8114
|
71 GaimRoomlist *roomlist;
|
9440
|
72
|
|
73 gboolean quitting;
|
6333
|
74 };
|
|
75
|
|
76 struct irc_buddy {
|
|
77 char *name;
|
|
78 gboolean online;
|
|
79 gboolean flag;
|
|
80 };
|
|
81
|
|
82 typedef int (*IRCCmdCallback) (struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
83
|
|
84 int irc_send(struct irc_conn *irc, const char *buf);
|
|
85 gboolean irc_blist_timeout(struct irc_conn *irc);
|
|
86
|
|
87 char *irc_mirc2html(const char *string);
|
8529
|
88 char *irc_mirc2txt(const char *string);
|
6333
|
89
|
9130
|
90 void irc_register_commands(void);
|
6333
|
91 void irc_msg_table_build(struct irc_conn *irc);
|
|
92 void irc_parse_msg(struct irc_conn *irc, char *input);
|
|
93 char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice);
|
|
94 char *irc_format(struct irc_conn *irc, const char *format, ...);
|
|
95
|
|
96 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
97 void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
98 void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
99 void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
100 void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
101 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
102 void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
103 void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
104 void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
105 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
106 void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
107 void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
8114
|
108 void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
109 void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
110 void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
111 void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
112 void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
113 void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args);
|
7877
|
114 void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
115 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6718
|
116 void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
117 void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
118 void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
119 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
120 void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
121 void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
122 void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
123 void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
124 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6714
|
125 void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args);
|
6333
|
126 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
127 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
128 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
129 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
130 void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
131
|
|
132 void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args);
|
|
133
|
|
134 void irc_cmd_table_build(struct irc_conn *irc);
|
|
135
|
|
136 int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
137 int irc_cmd_away(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
138 int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
139 int irc_cmd_invite(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
140 int irc_cmd_join(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
141 int irc_cmd_kick(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
8114
|
142 int irc_cmd_list(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
6333
|
143 int irc_cmd_mode(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
144 int irc_cmd_names(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
145 int irc_cmd_nick(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
146 int irc_cmd_op(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
147 int irc_cmd_privmsg(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
148 int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
149 int irc_cmd_ping(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
150 int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
151 int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
152 int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
153 int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
154 int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
155 int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
156 int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
|
|
157
|
9466
|
158 void irc_dccsend_send_file(GaimConnection *gc, const char *who, const char *file);
|
8351
|
159 void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg);
|
6333
|
160 #endif /* _GAIM_IRC_H */
|