1 | /********************************************************************\ |
---|
2 | * BitlBee -- An IRC to other IM-networks gateway * |
---|
3 | * * |
---|
4 | * Copyright 2002-2004 Wilmer van der Gaast and others * |
---|
5 | \********************************************************************/ |
---|
6 | |
---|
7 | /* The big hairy IRCd part of the project */ |
---|
8 | |
---|
9 | /* |
---|
10 | This program is free software; you can redistribute it and/or modify |
---|
11 | it under the terms of the GNU General Public License as published by |
---|
12 | the Free Software Foundation; either version 2 of the License, or |
---|
13 | (at your option) any later version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, |
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | GNU General Public License for more details. |
---|
19 | |
---|
20 | You should have received a copy of the GNU General Public License with |
---|
21 | the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; |
---|
22 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, |
---|
23 | Suite 330, Boston, MA 02111-1307 USA |
---|
24 | */ |
---|
25 | |
---|
26 | #ifndef _IRC_H |
---|
27 | #define _IRC_H |
---|
28 | |
---|
29 | #define IRC_MAX_LINE 512 |
---|
30 | #define IRC_MAX_ARGS 8 |
---|
31 | |
---|
32 | #define IRC_LOGIN_TIMEOUT 60 |
---|
33 | #define IRC_PING_STRING "PinglBee" |
---|
34 | |
---|
35 | #define UMODES "ias" |
---|
36 | #define UMODES_PRIV "Ro" |
---|
37 | #define CMODES "nt" |
---|
38 | #define CMODE "t" |
---|
39 | #define UMODE "s" |
---|
40 | |
---|
41 | typedef enum |
---|
42 | { |
---|
43 | USTATUS_OFFLINE, |
---|
44 | USTATUS_AUTHORIZED, |
---|
45 | USTATUS_LOGGED_IN, |
---|
46 | USTATUS_IDENTIFIED |
---|
47 | } irc_status_t; |
---|
48 | |
---|
49 | typedef struct channel |
---|
50 | { |
---|
51 | char *name; |
---|
52 | } channel_t; |
---|
53 | |
---|
54 | typedef struct irc |
---|
55 | { |
---|
56 | int fd; |
---|
57 | irc_status_t status; |
---|
58 | double last_pong; |
---|
59 | int pinging; |
---|
60 | char *sendbuffer; |
---|
61 | char *readbuffer; |
---|
62 | int quit; |
---|
63 | |
---|
64 | int sentbytes; |
---|
65 | time_t oldtime; |
---|
66 | |
---|
67 | char *nick; |
---|
68 | char *user; |
---|
69 | char *host; |
---|
70 | char *realname; |
---|
71 | char *password; |
---|
72 | |
---|
73 | char umode[8]; |
---|
74 | |
---|
75 | char *myhost; |
---|
76 | char *mynick; |
---|
77 | |
---|
78 | char *channel; |
---|
79 | int c_id; |
---|
80 | |
---|
81 | char is_private; /* Not too nice... */ |
---|
82 | char *last_target; |
---|
83 | |
---|
84 | struct query *queries; |
---|
85 | struct account *accounts; |
---|
86 | |
---|
87 | struct __USER *users; |
---|
88 | GHashTable *userhash; |
---|
89 | GHashTable *watches; |
---|
90 | struct __NICK *nicks; |
---|
91 | struct help *help; |
---|
92 | struct set *set; |
---|
93 | |
---|
94 | GIOChannel *io_channel; |
---|
95 | gint r_watch_source_id; |
---|
96 | gint w_watch_source_id; |
---|
97 | gint ping_source_id; |
---|
98 | } irc_t; |
---|
99 | |
---|
100 | #include "user.h" |
---|
101 | #include "nick.h" |
---|
102 | |
---|
103 | extern GSList *irc_connection_list; |
---|
104 | |
---|
105 | irc_t *irc_new( int fd ); |
---|
106 | void irc_free( irc_t *irc ); |
---|
107 | |
---|
108 | int irc_exec( irc_t *irc, char **cmd ); |
---|
109 | int irc_process( irc_t *irc ); |
---|
110 | int irc_process_line( irc_t *irc, char *line ); |
---|
111 | |
---|
112 | void irc_vawrite( irc_t *irc, char *format, va_list params ); |
---|
113 | void irc_write( irc_t *irc, char *format, ... ); |
---|
114 | void irc_write_all( int now, char *format, ... ); |
---|
115 | void irc_reply( irc_t *irc, int code, char *format, ... ); |
---|
116 | G_MODULE_EXPORT int irc_usermsg( irc_t *irc, char *format, ... ); |
---|
117 | char **irc_tokenize( char *buffer ); |
---|
118 | |
---|
119 | void irc_login( irc_t *irc ); |
---|
120 | void irc_motd( irc_t *irc ); |
---|
121 | void irc_names( irc_t *irc, char *channel ); |
---|
122 | void irc_topic( irc_t *irc, char *channel ); |
---|
123 | void irc_umode_set( irc_t *irc, char *s, int allow_priv ); |
---|
124 | void irc_who( irc_t *irc, char *channel ); |
---|
125 | void irc_spawn( irc_t *irc, user_t *u ); |
---|
126 | void irc_join( irc_t *irc, user_t *u, char *channel ); |
---|
127 | void irc_part( irc_t *irc, user_t *u, char *channel ); |
---|
128 | void irc_kick( irc_t *irc, user_t *u, char *channel, user_t *kicker ); |
---|
129 | void irc_kill( irc_t *irc, user_t *u ); |
---|
130 | void irc_invite( irc_t *irc, char *nick, char *channel ); |
---|
131 | void irc_whois( irc_t *irc, char *nick ); |
---|
132 | int irc_away( irc_t *irc, char *away ); |
---|
133 | void irc_setpass( irc_t *irc, const char *pass ); /* USE WITH CAUTION! */ |
---|
134 | |
---|
135 | int irc_send( irc_t *irc, char *nick, char *s, int flags ); |
---|
136 | int irc_privmsg( irc_t *irc, user_t *u, char *type, char *to, char *prefix, char *msg ); |
---|
137 | int irc_msgfrom( irc_t *irc, char *nick, char *msg ); |
---|
138 | int irc_noticefrom( irc_t *irc, char *nick, char *msg ); |
---|
139 | |
---|
140 | int buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ); |
---|
141 | |
---|
142 | #endif |
---|