source: irc.h @ 1dd3470

Last change on this file since 1dd3470 was 673a54c, checked in by Sven Moritz Hallberg <pesco@…>, at 2009-03-12T19:33:28Z

pretty blind try at merging in the latest trunk

  • Property mode set to 100644
File size: 4.3 KB
RevLine 
[b7d3cc34]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
[764c7d1]29#include "otr.h"
30
[b7d3cc34]31#define IRC_MAX_LINE 512
[5a71d9c]32#define IRC_MAX_ARGS 16
[b7d3cc34]33
34#define IRC_LOGIN_TIMEOUT 60
35#define IRC_PING_STRING "PinglBee"
36
[aefa533e]37#define UMODES "abisw"
[238f828]38#define UMODES_PRIV "Ro"
[b7d3cc34]39#define CMODES "nt"
40#define CMODE "t"
41#define UMODE "s"
[39f93f0]42#define CTYPES "&#"
[b7d3cc34]43
44typedef enum
45{
[bd9b00f]46        USTATUS_OFFLINE = 0,
[79e826a]47        USTATUS_AUTHORIZED = 1,
48        USTATUS_LOGGED_IN = 2,
49        USTATUS_IDENTIFIED = 4,
50        USTATUS_SHUTDOWN = 8
[b7d3cc34]51} irc_status_t;
52
53typedef struct irc
54{
55        int fd;
56        irc_status_t status;
57        double last_pong;
58        int pinging;
59        char *sendbuffer;
60        char *readbuffer;
[f9756bd]61        GIConv iconv, oconv;
[b7d3cc34]62
63        int sentbytes;
64        time_t oldtime;
65
66        char *nick;
67        char *user;
68        char *host;
69        char *realname;
[a199d33]70        char *password; /* HACK: Used to save the user's password, but before
71                           logging in, this may contain a password we should
72                           send to identify after USER/NICK are received. */
[b7d3cc34]73
74        char umode[8];
75       
76        char *myhost;
77        char *mynick;
78
79        char *channel;
80        int c_id;
81
82        char is_private;                /* Not too nice... */
83        char *last_target;
84       
85        struct query *queries;
86        struct account *accounts;
[ad9feec]87        struct chat *chatrooms;
[b7d3cc34]88       
89        struct __USER *users;
90        GHashTable *userhash;
91        GHashTable *watches;
92        struct __NICK *nicks;
93        struct set *set;
94
95        gint r_watch_source_id;
96        gint w_watch_source_id;
97        gint ping_source_id;
[764c7d1]98       
[dc9797f]99        otr_t *otr;            /* OTR state and book keeping */
[b7d3cc34]100} irc_t;
101
102#include "user.h"
103
104extern GSList *irc_connection_list;
105
106irc_t *irc_new( int fd );
[a9ca7dd]107void irc_abort( irc_t *irc, int immed, char *format, ... ) G_GNUC_PRINTF( 3, 4 );
[b7d3cc34]108void irc_free( irc_t *irc );
109
[f73b969]110void irc_exec( irc_t *irc, char **cmd );
111void irc_process( irc_t *irc );
[0431ea1]112char **irc_parse_line( char *line );
[74c119d]113char *irc_build_line( char **cmd );
[b7d3cc34]114
115void irc_vawrite( irc_t *irc, char *format, va_list params );
[a9ca7dd]116void irc_write( irc_t *irc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
117void irc_write_all( int now, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
118void irc_reply( irc_t *irc, int code, char *format, ... ) G_GNUC_PRINTF( 3, 4 );
119G_MODULE_EXPORT int irc_usermsg( irc_t *irc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
[b7d3cc34]120char **irc_tokenize( char *buffer );
121
122void irc_login( irc_t *irc );
[edf9657]123int irc_check_login( irc_t *irc );
[b7d3cc34]124void irc_motd( irc_t *irc );
125void irc_names( irc_t *irc, char *channel );
126void irc_topic( irc_t *irc, char *channel );
[238f828]127void irc_umode_set( irc_t *irc, char *s, int allow_priv );
[b7d3cc34]128void irc_who( irc_t *irc, char *channel );
129void irc_spawn( irc_t *irc, user_t *u );
130void irc_join( irc_t *irc, user_t *u, char *channel );
131void irc_part( irc_t *irc, user_t *u, char *channel );
132void irc_kick( irc_t *irc, user_t *u, char *channel, user_t *kicker );
133void irc_kill( irc_t *irc, user_t *u );
134void irc_invite( irc_t *irc, char *nick, char *channel );
135void irc_whois( irc_t *irc, char *nick );
[7cad7b4]136void irc_setpass( irc_t *irc, const char *pass ); /* USE WITH CAUTION! */
[b7d3cc34]137
138int irc_send( irc_t *irc, char *nick, char *s, int flags );
139int irc_privmsg( irc_t *irc, user_t *u, char *type, char *to, char *prefix, char *msg );
140int irc_msgfrom( irc_t *irc, char *nick, char *msg );
141int irc_noticefrom( irc_t *irc, char *nick, char *msg );
142
[f73b969]143void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags );
[0e7ab64]144struct groupchat *irc_chat_by_channel( irc_t *irc, char *channel );
[b7d3cc34]145
146#endif
Note: See TracBrowser for help on using the repository browser.