source: protocols/nogaim.h @ 1cda4f3

Last change on this file since 1cda4f3 was b1bd100, checked in by Jelmer Vernooij <jelmer@…>, at 2006-05-25T16:09:15Z

[merge] integration

  • Property mode set to 100644
File size: 9.2 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 OPT_CONN_HTML 0x00000001
57#define OPT_LOGGED_IN 0x00010000
58#define GAIM_AWAY_CUSTOM "Custom"
59
60/* ok. now the fun begins. first we create a connection structure */
[192b80a]61struct gaim_connection
62{
[b7d3cc34]63        struct prpl *prpl;
64        guint32 flags;
65       
[192b80a]66        /* each connection then can have its own protocol-specific data */
67        void *proto_data;
68       
[b7d3cc34]69        /* all connections need an input watcher */
70        int inpa;
[192b80a]71        guint keepalive;
[b7d3cc34]72       
73        /* buddy list stuff. there is still a global groups for the buddy list, but
74         * we need to maintain our own set of buddies, and our own permit/deny lists */
75        GSList *permit;
76        GSList *deny;
77        int permdeny;
78       
79        struct aim_user *user;
80       
81        char username[64];
82        char displayname[128];
83        char password[32];
84       
85        char *away;
86       
87        int evil;
88        gboolean wants_to_die; /* defaults to FALSE */
89       
90        /* BitlBee */
91        irc_t *irc;
92       
93        struct conversation *conversations;
94};
95
96/* struct buddy_chat went away and got merged with this. */
97struct conversation {
98        struct gaim_connection *gc;
99
100        /* stuff used just for chat */
101        GList *in_room;
102        GList *ignored;
103        int id;
104       
105        /* BitlBee */
106        struct conversation *next;
107        char *channel;
108        char *title;
109        char joined;
110        void *data;
111};
112
113struct buddy {
114        char name[80];
115        char show[BUDDY_ALIAS_MAXLEN];
116        int present;
117        int evil;
118        time_t signon;
119        time_t idle;
120        int uc;
121        guint caps; /* woohoo! */
122        void *proto_data; /* what a hack */
123        struct gaim_connection *gc; /* the connection it belongs to */
124};
125
126struct aim_user {
127        char username[64];
128        char alias[SELF_ALIAS_LEN]; 
129        char password[32];
130        char user_info[2048];
131        int options;
[7b23afd]132        struct prpl *prpl;
[b7d3cc34]133        /* prpls can use this to save information about the user,
134         * like which server to connect to, etc */
135        char proto_opt[7][256];
136
137        struct gaim_connection *gc;
138        irc_t *irc;
139};
140
[7b23afd]141struct ft
142{
143        const char *filename;
144       
145        /* Total number of bytes in file */
146        size_t total_bytes;
147       
148        /* Current number of bytes received */
149        size_t cur_bytes;
150};
151
152struct ft_request
153{
154        const char *filename;
155        struct gaim_connection *gc;
156};
157
158typedef void (*ft_recv_handler) (struct ft *, void *data, size_t len);
159
[b7d3cc34]160struct prpl {
161        int options;
[7b23afd]162        const char *name;
[b7d3cc34]163
164        void (* login)          (struct aim_user *);
[192b80a]165        void (* keepalive)      (struct gaim_connection *);
[b7d3cc34]166        void (* close)          (struct gaim_connection *);
[192b80a]167       
[b7d3cc34]168        int  (* send_im)        (struct gaim_connection *, char *who, char *message, int len, int away);
169        void (* set_away)       (struct gaim_connection *, char *state, char *message);
170        void (* get_away)       (struct gaim_connection *, char *who);
[192b80a]171        int  (* send_typing)    (struct gaim_connection *, char *who, int typing);
172       
[b7d3cc34]173        void (* add_buddy)      (struct gaim_connection *, char *name);
[192b80a]174        void (* group_buddy)    (struct gaim_connection *, char *who, char *old_group, char *new_group);
[b7d3cc34]175        void (* remove_buddy)   (struct gaim_connection *, char *name, char *group);
176        void (* add_permit)     (struct gaim_connection *, char *name);
177        void (* add_deny)       (struct gaim_connection *, char *name);
178        void (* rem_permit)     (struct gaim_connection *, char *name);
179        void (* rem_deny)       (struct gaim_connection *, char *name);
180        void (* set_permit_deny)(struct gaim_connection *);
[192b80a]181       
182        void (* set_info)       (struct gaim_connection *, char *info);
183        void (* get_info)       (struct gaim_connection *, char *who);
184        void (* alias_buddy)    (struct gaim_connection *, char *who);  /* save/store buddy's alias on server list/roster */
185       
186        /* Group chat stuff. */
[b7d3cc34]187        void (* join_chat)      (struct gaim_connection *, GList *data);
188        void (* chat_invite)    (struct gaim_connection *, int id, char *who, char *message);
189        void (* chat_leave)     (struct gaim_connection *, int id);
190        int  (* chat_send)      (struct gaim_connection *, int id, char *message);
191        int  (* chat_open)      (struct gaim_connection *, char *who);
[192b80a]192       
193        /* DIE! */
[b7d3cc34]194        char *(* get_status_string) (struct gaim_connection *gc, int stat);
[192b80a]195       
196        GList *(* away_states)(struct gaim_connection *gc);
197       
198        /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */
[9cb9868]199        int (* cmp_buddynames) (const char *who1, const char *who2);
[b7d3cc34]200};
201
202#define UC_UNAVAILABLE  1
203
204/* JABBER */
205#define UC_AWAY (0x02 | UC_UNAVAILABLE)
206#define UC_CHAT  0x04
207#define UC_XA   (0x08 | UC_UNAVAILABLE)
208#define UC_DND  (0x10 | UC_UNAVAILABLE)
209
210G_MODULE_EXPORT GSList *get_connections();
[7b23afd]211G_MODULE_EXPORT struct prpl *find_protocol(const char *name);
212G_MODULE_EXPORT void register_protocol(struct prpl *);
[b7d3cc34]213
214/* nogaim.c */
[226fce1]215int bim_set_away( struct gaim_connection *gc, char *away );
216int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags );
217int bim_chat_msg( struct gaim_connection *gc, int id, char *msg );
[b7d3cc34]218
[da3b536]219void bim_add_allow( struct gaim_connection *gc, char *handle );
220void bim_rem_allow( struct gaim_connection *gc, char *handle );
221void bim_add_block( struct gaim_connection *gc, char *handle );
222void bim_rem_block( struct gaim_connection *gc, char *handle );
[b7d3cc34]223
224void nogaim_init();
225char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value );
226
227gboolean auto_reconnect( gpointer data );
228void cancel_auto_reconnect( struct account *a );
229
230/* multi.c */
231G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( struct aim_user *user );
232G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );
233G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );
234G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );
235G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg );
[a9ca7dd]236G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
[b7d3cc34]237G_MODULE_EXPORT void account_online( struct gaim_connection *gc );
238G_MODULE_EXPORT void signoff( struct gaim_connection *gc );
239
240/* dialogs.c */
241G_MODULE_EXPORT void do_error_dialog( struct gaim_connection *gc, char *msg, char *title );
242G_MODULE_EXPORT void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont );
243
244/* list.c */
245G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname );
246G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle );
247G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc );
248
249G_MODULE_EXPORT void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname );
250
251/* buddy_chat.c */
252G_MODULE_EXPORT void add_chat_buddy( struct conversation *b, char *handle );
253G_MODULE_EXPORT void remove_chat_buddy( struct conversation *b, char *handle, char *reason );
254
255/* prpl.c */
[e6d6047]256G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname );
[b7d3cc34]257
258/* server.c */                   
259G_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 );
260G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
[e7f46c5]261G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
[b7d3cc34]262G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
263G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle );
264G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime );
265G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id );
266
267struct conversation *conv_findchannel( char *channel );
268
269#endif
Note: See TracBrowser for help on using the repository browser.