source: protocols/nogaim.h @ 9544acb

Last change on this file since 9544acb was 5b52a48, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-07-03T21:22:45Z

Implemented per-account nick lists instead of per-protocol nick lists.
nick_t is dead, instead nicks are just saves in a per-account_t GLib
hash table. While doing this, the import_buddies command finally died
and text_save() disappeared, because the old file format can't handle
most of the new features in this branch anyway.

Still have to implement support for the new nick lists in text_load()!

  • Property mode set to 100644
File size: 8.6 KB
Line 
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)
17 * Copyright 2002-2004 Wilmer van der Gaast <wilmer@gaast.net>
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 "account.h"
42#include "proxy.h"
43#include "md5.h"
44#include "sha.h"
45
46
47#define BUF_LEN MSG_LEN
48#define BUF_LONG ( BUF_LEN * 2 )
49#define MSG_LEN 2048
50#define BUF_LEN MSG_LEN
51
52#define SELF_ALIAS_LEN 400
53#define BUDDY_ALIAS_MAXLEN 388   /* because MSN names can be 387 characters */
54
55#define WEBSITE "http://www.bitlbee.org/"
56#define IM_FLAG_AWAY 0x0020
57#define GAIM_AWAY_CUSTOM "Custom"
58
59#define OPT_CONN_HTML   0x00000001
60#define OPT_LOGGED_IN   0x00010000
61#define OPT_LOGGING_OUT 0x00020000
62
63/* ok. now the fun begins. first we create a connection structure */
64struct gaim_connection
65{
66        account_t *acc;
67        guint32 flags;
68       
69        /* each connection then can have its own protocol-specific data */
70        void *proto_data;
71       
72        /* all connections need an input watcher */
73        int inpa;
74        guint keepalive;
75       
76        /* buddy list stuff. there is still a global groups for the buddy list, but
77         * we need to maintain our own set of buddies, and our own permit/deny lists */
78        GSList *permit;
79        GSList *deny;
80        int permdeny;
81       
82        char username[64];
83        char displayname[128];
84        char password[32];
85       
86        char *away;
87       
88        int evil;
89        gboolean wants_to_die; /* defaults to FALSE */
90       
91        /* BitlBee */
92        irc_t *irc;
93       
94        struct conversation *conversations;
95};
96
97/* struct buddy_chat went away and got merged with this. */
98struct conversation {
99        struct gaim_connection *gc;
100
101        /* stuff used just for chat */
102        GList *in_room;
103        GList *ignored;
104        int id;
105       
106        /* BitlBee */
107        struct conversation *next;
108        char *channel;
109        char *title;
110        char joined;
111        void *data;
112};
113
114struct buddy {
115        char name[80];
116        char show[BUDDY_ALIAS_MAXLEN];
117        int present;
118        int evil;
119        time_t signon;
120        time_t idle;
121        int uc;
122        guint caps; /* woohoo! */
123        void *proto_data; /* what a hack */
124        struct gaim_connection *gc; /* the connection it belongs to */
125};
126
127struct prpl {
128        int options;
129        const char *name;
130
131        void (* acc_init)       (account_t *);
132        void (* login)          (account_t *);
133        void (* keepalive)      (struct gaim_connection *);
134        void (* close)          (struct gaim_connection *);
135       
136        int  (* send_im)        (struct gaim_connection *, char *who, char *message, int len, int away);
137        void (* set_away)       (struct gaim_connection *, char *state, char *message);
138        void (* get_away)       (struct gaim_connection *, char *who);
139        int  (* send_typing)    (struct gaim_connection *, char *who, int typing);
140       
141        void (* add_buddy)      (struct gaim_connection *, char *name);
142        void (* group_buddy)    (struct gaim_connection *, char *who, char *old_group, char *new_group);
143        void (* remove_buddy)   (struct gaim_connection *, char *name, char *group);
144        void (* add_permit)     (struct gaim_connection *, char *name);
145        void (* add_deny)       (struct gaim_connection *, char *name);
146        void (* rem_permit)     (struct gaim_connection *, char *name);
147        void (* rem_deny)       (struct gaim_connection *, char *name);
148        void (* set_permit_deny)(struct gaim_connection *);
149       
150        void (* set_info)       (struct gaim_connection *, char *info);
151        void (* get_info)       (struct gaim_connection *, char *who);
152        void (* alias_buddy)    (struct gaim_connection *, char *who);  /* save/store buddy's alias on server list/roster */
153       
154        /* Group chat stuff. */
155        void (* join_chat)      (struct gaim_connection *, GList *data);
156        void (* chat_invite)    (struct gaim_connection *, int id, char *who, char *message);
157        void (* chat_leave)     (struct gaim_connection *, int id);
158        int  (* chat_send)      (struct gaim_connection *, int id, char *message);
159        int  (* chat_open)      (struct gaim_connection *, char *who);
160       
161        /* DIE! */
162        char *(* get_status_string) (struct gaim_connection *gc, int stat);
163       
164        GList *(* away_states)(struct gaim_connection *gc);
165       
166        /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */
167        int (* handle_cmp) (const char *who1, const char *who2);
168};
169
170#define UC_UNAVAILABLE  1
171
172/* JABBER */
173#define UC_AWAY (0x02 | UC_UNAVAILABLE)
174#define UC_CHAT  0x04
175#define UC_XA   (0x08 | UC_UNAVAILABLE)
176#define UC_DND  (0x10 | UC_UNAVAILABLE)
177
178G_MODULE_EXPORT GSList *get_connections();
179G_MODULE_EXPORT struct prpl *find_protocol(const char *name);
180G_MODULE_EXPORT void register_protocol(struct prpl *);
181
182/* nogaim.c */
183int bim_set_away( struct gaim_connection *gc, char *away );
184int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags );
185int bim_chat_msg( struct gaim_connection *gc, int id, char *msg );
186
187void bim_add_allow( struct gaim_connection *gc, char *handle );
188void bim_rem_allow( struct gaim_connection *gc, char *handle );
189void bim_add_block( struct gaim_connection *gc, char *handle );
190void bim_rem_block( struct gaim_connection *gc, char *handle );
191
192void nogaim_init();
193char *set_eval_away_devoice( set_t *set, char *value );
194
195gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
196void cancel_auto_reconnect( struct account *a );
197
198/* multi.c */
199G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( account_t *acc );
200G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );
201G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );
202G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );
203G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg );
204G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
205G_MODULE_EXPORT void account_online( struct gaim_connection *gc );
206G_MODULE_EXPORT void signoff( struct gaim_connection *gc );
207
208/* dialogs.c */
209G_MODULE_EXPORT void do_error_dialog( struct gaim_connection *gc, char *msg, char *title );
210G_MODULE_EXPORT void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont );
211
212/* list.c */
213G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname );
214G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle );
215G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc );
216
217G_MODULE_EXPORT void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname );
218
219/* buddy_chat.c */
220G_MODULE_EXPORT void add_chat_buddy( struct conversation *b, char *handle );
221G_MODULE_EXPORT void remove_chat_buddy( struct conversation *b, char *handle, char *reason );
222
223/* prpl.c */
224G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname );
225
226/* server.c */                   
227G_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 );
228G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
229G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
230G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
231G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle );
232G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime );
233G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id );
234
235struct conversation *conv_findchannel( char *channel );
236
237#endif
Note: See TracBrowser for help on using the repository browser.