source: protocols/nogaim.h @ 84e9cea

Last change on this file since 84e9cea was 85e9644, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-06-07T13:36:19Z

Merging Jelmer's storage tree (with LDAP support).

  • Property mode set to 100644
File size: 8.9 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/*
8 * nogaim
9 *
10 * Gaim without gaim - for BitlBee
11 *
12 * This file contains functions called by the Gaim IM-modules. It contains
13 * some struct and type definitions from Gaim.
14 *
15 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
16 *                          (and possibly other members of the Gaim team)
[9e08d5d]17 * Copyright 2002-2004 Wilmer van der Gaast <wilmer@gaast.net>
[b7d3cc34]18 */
19
20/*
21  This program is free software; you can redistribute it and/or modify
22  it under the terms of the GNU General Public License as published by
23  the Free Software Foundation; either version 2 of the License, or
24  (at your option) any later version.
25
26  This program is distributed in the hope that it will be useful,
27  but WITHOUT ANY WARRANTY; without even the implied warranty of
28  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  GNU General Public License for more details.
30
31  You should have received a copy of the GNU General Public License with
32  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
33  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
34  Suite 330, Boston, MA  02111-1307  USA
35*/
36
37#ifndef _NOGAIM_H
38#define _NOGAIM_H
39
40#include "bitlbee.h"
41#include "proxy.h"
42#include "md5.h"
43#include "sha.h"
44
45
46#define BUF_LEN MSG_LEN
47#define BUF_LONG ( BUF_LEN * 2 )
48#define MSG_LEN 2048
49#define BUF_LEN MSG_LEN
50
51#define SELF_ALIAS_LEN 400
52#define BUDDY_ALIAS_MAXLEN 388   /* because MSN names can be 387 characters */
53
[1c8a7a2]54#define WEBSITE "http://www.bitlbee.org/"
[b7d3cc34]55#define IM_FLAG_AWAY 0x0020
56#define GAIM_AWAY_CUSTOM "Custom"
57
[fb62f81f]58#define OPT_CONN_HTML   0x00000001
59#define OPT_LOGGED_IN   0x00010000
60#define OPT_LOGGING_OUT 0x00020000
61
[b7d3cc34]62/* ok. now the fun begins. first we create a connection structure */
[192b80a]63struct gaim_connection
64{
[b7d3cc34]65        struct prpl *prpl;
66        guint32 flags;
67       
[192b80a]68        /* each connection then can have its own protocol-specific data */
69        void *proto_data;
70       
[b7d3cc34]71        /* all connections need an input watcher */
72        int inpa;
[192b80a]73        guint keepalive;
[b7d3cc34]74       
75        /* buddy list stuff. there is still a global groups for the buddy list, but
76         * we need to maintain our own set of buddies, and our own permit/deny lists */
77        GSList *permit;
78        GSList *deny;
79        int permdeny;
80       
81        struct aim_user *user;
82       
83        char username[64];
84        char displayname[128];
85        char password[32];
86       
87        char *away;
88       
89        int evil;
90        gboolean wants_to_die; /* defaults to FALSE */
91       
92        /* BitlBee */
93        irc_t *irc;
94       
95        struct conversation *conversations;
96};
97
98/* struct buddy_chat went away and got merged with this. */
99struct conversation {
100        struct gaim_connection *gc;
101
102        /* stuff used just for chat */
103        GList *in_room;
104        GList *ignored;
105        int id;
106       
107        /* BitlBee */
108        struct conversation *next;
109        char *channel;
110        char *title;
111        char joined;
112        void *data;
113};
114
115struct buddy {
116        char name[80];
117        char show[BUDDY_ALIAS_MAXLEN];
118        int present;
119        int evil;
120        time_t signon;
121        time_t idle;
122        int uc;
123        guint caps; /* woohoo! */
124        void *proto_data; /* what a hack */
125        struct gaim_connection *gc; /* the connection it belongs to */
126};
127
128struct aim_user {
129        char username[64];
130        char alias[SELF_ALIAS_LEN]; 
131        char password[32];
132        char user_info[2048];
133        int options;
[7b23afd]134        struct prpl *prpl;
[b7d3cc34]135        /* prpls can use this to save information about the user,
136         * like which server to connect to, etc */
137        char proto_opt[7][256];
138
139        struct gaim_connection *gc;
140        irc_t *irc;
141};
142
143struct prpl {
144        int options;
[7b23afd]145        const char *name;
[b7d3cc34]146
147        void (* login)          (struct aim_user *);
[192b80a]148        void (* keepalive)      (struct gaim_connection *);
[b7d3cc34]149        void (* close)          (struct gaim_connection *);
[192b80a]150       
[b7d3cc34]151        int  (* send_im)        (struct gaim_connection *, char *who, char *message, int len, int away);
152        void (* set_away)       (struct gaim_connection *, char *state, char *message);
153        void (* get_away)       (struct gaim_connection *, char *who);
[192b80a]154        int  (* send_typing)    (struct gaim_connection *, char *who, int typing);
155       
[b7d3cc34]156        void (* add_buddy)      (struct gaim_connection *, char *name);
[192b80a]157        void (* group_buddy)    (struct gaim_connection *, char *who, char *old_group, char *new_group);
[b7d3cc34]158        void (* remove_buddy)   (struct gaim_connection *, char *name, char *group);
159        void (* add_permit)     (struct gaim_connection *, char *name);
160        void (* add_deny)       (struct gaim_connection *, char *name);
161        void (* rem_permit)     (struct gaim_connection *, char *name);
162        void (* rem_deny)       (struct gaim_connection *, char *name);
163        void (* set_permit_deny)(struct gaim_connection *);
[192b80a]164       
165        void (* set_info)       (struct gaim_connection *, char *info);
166        void (* get_info)       (struct gaim_connection *, char *who);
167        void (* alias_buddy)    (struct gaim_connection *, char *who);  /* save/store buddy's alias on server list/roster */
168       
169        /* Group chat stuff. */
[b7d3cc34]170        void (* join_chat)      (struct gaim_connection *, GList *data);
171        void (* chat_invite)    (struct gaim_connection *, int id, char *who, char *message);
172        void (* chat_leave)     (struct gaim_connection *, int id);
173        int  (* chat_send)      (struct gaim_connection *, int id, char *message);
174        int  (* chat_open)      (struct gaim_connection *, char *who);
[192b80a]175       
176        /* DIE! */
[b7d3cc34]177        char *(* get_status_string) (struct gaim_connection *gc, int stat);
[192b80a]178       
179        GList *(* away_states)(struct gaim_connection *gc);
180       
181        /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */
[9cb9868]182        int (* cmp_buddynames) (const char *who1, const char *who2);
[b7d3cc34]183};
184
185#define UC_UNAVAILABLE  1
186
187/* JABBER */
188#define UC_AWAY (0x02 | UC_UNAVAILABLE)
189#define UC_CHAT  0x04
190#define UC_XA   (0x08 | UC_UNAVAILABLE)
191#define UC_DND  (0x10 | UC_UNAVAILABLE)
192
193G_MODULE_EXPORT GSList *get_connections();
[7b23afd]194G_MODULE_EXPORT struct prpl *find_protocol(const char *name);
195G_MODULE_EXPORT void register_protocol(struct prpl *);
[b7d3cc34]196
197/* nogaim.c */
[226fce1]198int bim_set_away( struct gaim_connection *gc, char *away );
199int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags );
200int bim_chat_msg( struct gaim_connection *gc, int id, char *msg );
[b7d3cc34]201
[da3b536]202void bim_add_allow( struct gaim_connection *gc, char *handle );
203void bim_rem_allow( struct gaim_connection *gc, char *handle );
204void bim_add_block( struct gaim_connection *gc, char *handle );
205void bim_rem_block( struct gaim_connection *gc, char *handle );
[b7d3cc34]206
207void nogaim_init();
208char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value );
209
[ba9edaa]210gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
[b7d3cc34]211void cancel_auto_reconnect( struct account *a );
212
213/* multi.c */
214G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( struct aim_user *user );
215G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );
216G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );
217G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );
218G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg );
[a9ca7dd]219G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
[b7d3cc34]220G_MODULE_EXPORT void account_online( struct gaim_connection *gc );
221G_MODULE_EXPORT void signoff( struct gaim_connection *gc );
222
223/* dialogs.c */
224G_MODULE_EXPORT void do_error_dialog( struct gaim_connection *gc, char *msg, char *title );
225G_MODULE_EXPORT void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont );
226
227/* list.c */
228G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname );
229G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle );
230G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc );
231
232G_MODULE_EXPORT void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname );
233
234/* buddy_chat.c */
235G_MODULE_EXPORT void add_chat_buddy( struct conversation *b, char *handle );
236G_MODULE_EXPORT void remove_chat_buddy( struct conversation *b, char *handle, char *reason );
237
238/* prpl.c */
[e6d6047]239G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname );
[b7d3cc34]240
241/* server.c */                   
242G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
243G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
[e7f46c5]244G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
[b7d3cc34]245G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
246G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle );
247G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime );
248G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id );
249
250struct conversation *conv_findchannel( char *channel );
251
252#endif
Note: See TracBrowser for help on using the repository browser.