source: protocols/nogaim.h @ 266fe2f

Last change on this file since 266fe2f was c99af3a, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-04-13T07:30:11Z

Removed account_offline(), we have signoff() already.

  • Property mode set to 100644
File size: 8.6 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
54#define WEBSITE "http://www.bitlee.org/"
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
141struct prpl {
142        int options;
[7b23afd]143        const char *name;
[b7d3cc34]144
145        void (* login)          (struct aim_user *);
[192b80a]146        void (* keepalive)      (struct gaim_connection *);
[b7d3cc34]147        void (* close)          (struct gaim_connection *);
[192b80a]148       
[b7d3cc34]149        int  (* send_im)        (struct gaim_connection *, char *who, char *message, int len, int away);
150        void (* set_away)       (struct gaim_connection *, char *state, char *message);
151        void (* get_away)       (struct gaim_connection *, char *who);
[192b80a]152        int  (* send_typing)    (struct gaim_connection *, char *who, int typing);
153       
[b7d3cc34]154        void (* add_buddy)      (struct gaim_connection *, char *name);
[192b80a]155        void (* group_buddy)    (struct gaim_connection *, char *who, char *old_group, char *new_group);
[b7d3cc34]156        void (* remove_buddy)   (struct gaim_connection *, char *name, char *group);
157        void (* add_permit)     (struct gaim_connection *, char *name);
158        void (* add_deny)       (struct gaim_connection *, char *name);
159        void (* rem_permit)     (struct gaim_connection *, char *name);
160        void (* rem_deny)       (struct gaim_connection *, char *name);
161        void (* set_permit_deny)(struct gaim_connection *);
[192b80a]162       
163        void (* set_info)       (struct gaim_connection *, char *info);
164        void (* get_info)       (struct gaim_connection *, char *who);
165        void (* alias_buddy)    (struct gaim_connection *, char *who);  /* save/store buddy's alias on server list/roster */
166       
167        /* Group chat stuff. */
[b7d3cc34]168        void (* join_chat)      (struct gaim_connection *, GList *data);
169        void (* chat_invite)    (struct gaim_connection *, int id, char *who, char *message);
170        void (* chat_leave)     (struct gaim_connection *, int id);
171        int  (* chat_send)      (struct gaim_connection *, int id, char *message);
172        int  (* chat_open)      (struct gaim_connection *, char *who);
[192b80a]173       
174        /* DIE! */
[b7d3cc34]175        char *(* get_status_string) (struct gaim_connection *gc, int stat);
[192b80a]176       
177        GList *(* away_states)(struct gaim_connection *gc);
178       
179        /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */
[9cb9868]180        int (* cmp_buddynames) (const char *who1, const char *who2);
[b7d3cc34]181};
182
183#define UC_UNAVAILABLE  1
184
185/* JABBER */
186#define UC_AWAY (0x02 | UC_UNAVAILABLE)
187#define UC_CHAT  0x04
188#define UC_XA   (0x08 | UC_UNAVAILABLE)
189#define UC_DND  (0x10 | UC_UNAVAILABLE)
190
191G_MODULE_EXPORT GSList *get_connections();
[7b23afd]192G_MODULE_EXPORT struct prpl *find_protocol(const char *name);
193G_MODULE_EXPORT void register_protocol(struct prpl *);
[b7d3cc34]194
195/* nogaim.c */
196int serv_send_im(irc_t *irc, user_t *u, char *msg, int flags);
197int serv_send_chat(irc_t *irc, struct gaim_connection *gc, int id, char *msg );
198
199void nogaim_init();
200int proto_away( struct gaim_connection *gc, char *away );
201char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value );
202
203gboolean auto_reconnect( gpointer data );
204void cancel_auto_reconnect( struct account *a );
205
206/* multi.c */
207G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( struct aim_user *user );
208G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );
209G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );
210G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );
211G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg );
212G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... );
213G_MODULE_EXPORT void account_online( struct gaim_connection *gc );
214G_MODULE_EXPORT void signoff( struct gaim_connection *gc );
215
216/* dialogs.c */
217G_MODULE_EXPORT void do_error_dialog( struct gaim_connection *gc, char *msg, char *title );
218G_MODULE_EXPORT void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont );
219
220/* list.c */
221G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname );
222G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle );
223G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc );
224
225G_MODULE_EXPORT void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname );
226
227/* buddy_chat.c */
228G_MODULE_EXPORT void add_chat_buddy( struct conversation *b, char *handle );
229G_MODULE_EXPORT void remove_chat_buddy( struct conversation *b, char *handle, char *reason );
230
231/* prpl.c */
[e6d6047]232G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname );
[b7d3cc34]233
234/* server.c */                   
235G_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 );
236G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
[e7f46c5]237G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
[b7d3cc34]238G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
239G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle );
240G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime );
241G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id );
242
243struct conversation *conv_findchannel( char *channel );
244
245#endif
Note: See TracBrowser for help on using the repository browser.