aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-06-09 03:52:28 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-06-09 03:52:28 +0200
commitc4a1036214c5f5c1ce14e937e8cdabc9fdf2c068 (patch)
treec9efb246958cf81ed2d977f8d00499a136a1b23a
parente46e077ccbe5e3e13637618934a0f7979db6bc69 (diff)
parent783e9b76de9a8ec16e8229d7c476b16ba8011554 (diff)
Merge integration branch.
-rw-r--r--bitlbee.c16
-rw-r--r--bitlbee.conf7
-rw-r--r--bitlbee.h2
-rw-r--r--conf.c14
-rw-r--r--conf.h2
-rw-r--r--debian/changelog13
-rw-r--r--debian/control11
-rwxr-xr-xdebian/rules44
-rw-r--r--doc/user-guide/commands.xml10
-rw-r--r--irc.c14
-rw-r--r--lib/arc.h4
-rw-r--r--lib/proxy.c11
-rw-r--r--protocols/jabber/jabber_util.c8
-rw-r--r--protocols/msn/msn.h2
-rw-r--r--protocols/msn/msn_util.c8
-rw-r--r--protocols/msn/ns.c24
-rw-r--r--protocols/nogaim.c17
-rw-r--r--protocols/nogaim.h3
-rw-r--r--protocols/oscar/oscar.c18
-rw-r--r--protocols/yahoo/yahoo.c8
-rw-r--r--query.c7
-rw-r--r--query.h8
-rw-r--r--root_commands.c60
23 files changed, 242 insertions, 69 deletions
diff --git a/bitlbee.c b/bitlbee.c
index 434d5595..ab142dc5 100644
--- a/bitlbee.c
+++ b/bitlbee.c
@@ -53,11 +53,11 @@ int bitlbee_daemon_init()
#endif
;
- i = getaddrinfo( global.conf->iface, global.conf->port, &hints, &addrinfo_bind );
+ i = getaddrinfo( global.conf->iface_in, global.conf->port, &hints, &addrinfo_bind );
if( i )
{
log_message( LOGLVL_ERROR, "Couldn't parse address `%s': %s",
- global.conf->iface, gai_strerror(i) );
+ global.conf->iface_in, gai_strerror(i) );
return -1;
}
@@ -224,12 +224,16 @@ gboolean bitlbee_io_current_client_write( gpointer data, gint fd, b_input_condit
if( st == size )
{
- g_free( irc->sendbuffer );
- irc->sendbuffer = NULL;
- irc->w_watch_source_id = 0;
-
if( irc->status & USTATUS_SHUTDOWN )
+ {
irc_free( irc );
+ }
+ else
+ {
+ g_free( irc->sendbuffer );
+ irc->sendbuffer = NULL;
+ irc->w_watch_source_id = 0;
+ }
return FALSE;
}
diff --git a/bitlbee.conf b/bitlbee.conf
index 99e8106d..c03a564f 100644
--- a/bitlbee.conf
+++ b/bitlbee.conf
@@ -34,6 +34,13 @@
# DaemonInterface = 0.0.0.0
# DaemonPort = 6667
+## ClientInterface:
+##
+## If for any reason, you want BitlBee to use a specific address/interface
+## for outgoing traffic (IM connections, HTTP(S), etc.), set it here.
+##
+# ClientInterface = 0.0.0.0
+
## AuthMode
##
## Open -- Accept connections from anyone, use NickServ for user authentication.
diff --git a/bitlbee.h b/bitlbee.h
index 18cb5f2e..d1722377 100644
--- a/bitlbee.h
+++ b/bitlbee.h
@@ -156,6 +156,8 @@ void root_command_string( irc_t *irc, user_t *u, char *command, int flags );
void root_command( irc_t *irc, char *command[] );
gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond );
+char *set_eval_root_nick( set_t *set, char *new_nick );
+
extern global_t global;
#endif
diff --git a/conf.c b/conf.c
index 339af618..8d6291ff 100644
--- a/conf.c
+++ b/conf.c
@@ -44,7 +44,8 @@ conf_t *conf_load( int argc, char *argv[] )
conf = g_new0( conf_t, 1 );
- conf->iface = NULL;
+ conf->iface_in = NULL;
+ conf->iface_out = NULL;
conf->port = g_strdup( "6667" );
conf->nofork = 0;
conf->verbose = 0;
@@ -81,7 +82,7 @@ conf_t *conf_load( int argc, char *argv[] )
{
if( opt == 'i' )
{
- conf->iface = g_strdup( optarg );
+ conf->iface_in = g_strdup( optarg );
}
else if( opt == 'p' )
{
@@ -201,14 +202,19 @@ static int conf_loadini( conf_t *conf, char *file )
}
else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 )
{
- g_free( conf->iface );
- conf->iface = g_strdup( ini->value );
+ g_free( conf->iface_in );
+ conf->iface_in = g_strdup( ini->value );
}
else if( g_strcasecmp( ini->key, "daemonport" ) == 0 )
{
g_free( conf->port );
conf->port = g_strdup( ini->value );
}
+ else if( g_strcasecmp( ini->key, "clientinterface" ) == 0 )
+ {
+ g_free( conf->iface_out );
+ conf->iface_out = g_strdup( ini->value );
+ }
else if( g_strcasecmp( ini->key, "authmode" ) == 0 )
{
if( g_strcasecmp( ini->value, "registered" ) == 0 )
diff --git a/conf.h b/conf.h
index d21ec577..c41fd096 100644
--- a/conf.h
+++ b/conf.h
@@ -31,7 +31,7 @@ typedef enum authmode { AUTHMODE_OPEN, AUTHMODE_CLOSED, AUTHMODE_REGISTERED } au
typedef struct conf
{
- char *iface;
+ char *iface_in, *iface_out;
char *port;
int nofork;
int verbose;
diff --git a/debian/changelog b/debian/changelog
index b964ee0e..202571d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,18 @@
+bitlbee (1.2-5) UNRELEASED; urgency=low
+
+ * Add Homepage and Vcs-Bzr fields.
+
+ -- Jelmer Vernooij <jelmer@samba.org> Sun, 11 May 2008 14:18:16 +0200
+
bitlbee (1.2-4) unstable; urgency=low
- * Not a real release, just a placeholder for the changelog.
* Fixed init script to use the BITLBEE_OPTS variable, not an undefined
- DAEMON_OPT.
+ DAEMON_OPT. (Closes: #474583)
* Added dependency information to the init script. (Closes: #472567)
+ * Added bitlbee-dev package. Patch from RISKO Gergely <risko@debian.org>
+ with some small modifications. (Closes: #473480)
- -- Wilmer van der Gaast <wilmer@gaast.net> Sat, 29 Mar 2008 21:10:33 +0000
+ -- Wilmer van der Gaast <wilmer@gaast.net> Wed, 07 May 2008 22:40:40 -0700
bitlbee (1.2-3) unstable; urgency=low
diff --git a/debian/control b/debian/control
index 8383391b..47eb9a72 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,8 @@ Priority: optional
Maintainer: Wilmer van der Gaast <wilmer@gaast.net>
Standards-Version: 3.5.9
Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf
+Homepage: http://www.bitlbee.org/
+Vcs-Bzr: http://code.bitlbee.org/bitlbee/
Package: bitlbee
Architecture: any
@@ -11,3 +13,12 @@ Depends: ${shlibs:Depends}, adduser, net-tools, ${debconf-depends}, debianutils
Description: An IRC to other chat networks gateway
This program can be used as an IRC server which forwards everything you
say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo.
+
+Package: bitlbee-dev
+Architecture: all
+Depends: bitlbee (= ${binary:Version})
+Description: An IRC to other chat networks gateway
+ This program can be used as an IRC server which forwards everything you
+ say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo.
+ .
+ This package holds development stuff for compiling plug-ins.
diff --git a/debian/rules b/debian/rules
index 252fb742..67cb79a3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,21 +12,21 @@ endif
build-arch: build-arch-stamp
build-arch-stamp:
- if [ ! -d debian ]; then exit 1; fi
+ [ -d debian ]
./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent
$(MAKE)
# $(MAKE) -C doc/ all
touch build-arch-stamp
clean:
- if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi
- rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files
+ [ "`whoami`" = "root" -a -d debian ]
+ rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files debian/bitlbee-dev
-$(MAKE) distclean
# -$(MAKE) -C doc/ clean
install-arch: build-arch
- if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi
+ [ "`whoami`" = "root" -a -d debian ]
mkdir -p debian/bitlbee/DEBIAN/
$(MAKE) install install-etc DESTDIR=`pwd`/debian/bitlbee
@@ -34,8 +34,15 @@ install-arch: build-arch
cp doc/user-guide/user-guide.txt debian/bitlbee/usr/share/doc/bitlbee/
cp doc/user-guide/user-guide.html debian/bitlbee/usr/share/doc/bitlbee/
+install-indep: install-arch
+ [ "`whoami`" = "root" -a -d debian ]
+ mkdir -p debian/bitlbee-dev/DEBIAN/
+ $(MAKE) install-dev DESTDIR=`pwd`/debian/bitlbee-dev
+
+ mkdir -p debian/bitlbee-dev/usr/share/doc/bitlbee-dev/
+
binary-arch: build-arch install-arch
- if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi
+ [ "`whoami`" = "root" -a -d debian ]
chmod 755 debian/post* debian/pre* debian/config debian/bitlbee.init
@@ -51,7 +58,7 @@ binary-arch: build-arch install-arch
gzip -9 doc/bitlbee/changelog.Debian doc/bitlbee/changelog doc/bitlbee/user-guide.txt \
doc/bitlbee/examples/* man/man8/bitlbee.8 man/man5/bitlbee.conf.5
- chown -R root.root debian/bitlbee/
+ chown -R root:root debian/bitlbee/
find debian/bitlbee/usr/share/ -type d -exec chmod 755 {} \;
find debian/bitlbee/usr/share/ -type f -exec chmod 644 {} \;
@@ -76,11 +83,26 @@ endif
dpkg --build debian/bitlbee ..
-debug-build:
- BITLBEE_VERSION=\"`date +%Y%m%d`-`hostname`-debug\" debian/rules clean binary DEBUG=1
+binary-indep: install-indep
+ [ "`whoami`" = "root" -a -d debian ]
+
+ chown -R root.root debian/bitlbee-dev/
+ find debian/bitlbee-dev/usr/share/ -type d -exec chmod 755 {} \;
+ find debian/bitlbee-dev/usr/share/ -type f -exec chmod 644 {} \;
+
+ cp debian/changelog debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian
+ gzip -9 debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian
+ cp debian/copyright debian/bitlbee-dev/usr/share/doc/bitlbee-dev/copyright
+
+ cd debian/bitlbee-dev; \
+ find usr -type f -exec md5sum {} \; > DEBIAN/md5sums
+
+ dpkg-gencontrol -ldebian/changelog -isp -pbitlbee-dev -Pdebian/bitlbee-dev
+
+ dpkg --build debian/bitlbee-dev ..
-binary: binary-arch
+binary: binary-arch binary-indep
build: build-arch
-install: install-arch
+install: install-arch install-indep
-.PHONY: build-arch build clean binary-arch binary install-arch install
+.PHONY: build-arch build clean binary-arch binary install-arch install binary-indep install-indep
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml
index c45727b9..6d77f8cd 100644
--- a/doc/user-guide/commands.xml
+++ b/doc/user-guide/commands.xml
@@ -588,6 +588,16 @@
</description>
</bitlbee-setting>
+ <bitlbee-setting name="root_nick" type="string" scope="global">
+ <default>root</default>
+
+ <description>
+ <para>
+ Normally the "bot" that takes all your BitlBee commands is called "root". If you don't like this name, you can rename it to anything else using the <emphasis>rename</emphasis> command, or by changing this setting.
+ </para>
+ </description>
+ </bitlbee-setting>
+
<bitlbee-setting name="save_on_quit" type="boolean" scope="global">
<default>true</default>
diff --git a/irc.c b/irc.c
index 585cf232..a6220140 100644
--- a/irc.c
+++ b/irc.c
@@ -150,6 +150,7 @@ irc_t *irc_new( int fd )
set_add( &irc->set, "password", NULL, passchange, irc );
set_add( &irc->set, "private", "true", set_eval_bool, irc );
set_add( &irc->set, "query_order", "lifo", NULL, irc );
+ set_add( &irc->set, "root_nick", irc->mynick, set_eval_root_nick, irc );
set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc );
set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc );
set_add( &irc->set, "strip_html", "true", NULL, irc );
@@ -198,12 +199,14 @@ void irc_abort( irc_t *irc, int immed, char *format, ... )
irc->status |= USTATUS_SHUTDOWN;
if( irc->sendbuffer && !immed )
{
- /* We won't read from this socket anymore. Instead, we'll connect a timer
- to it that should shut down the connection in a second, just in case
- bitlbee_.._write doesn't do it first. */
+ /* Set up a timeout event that should shut down the connection
+ in a second, just in case ..._write doesn't do it first. */
b_event_remove( irc->r_watch_source_id );
- irc->r_watch_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc );
+ irc->r_watch_source_id = 0;
+
+ b_event_remove( irc->ping_source_id );
+ irc->ping_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc );
}
else
{
@@ -273,7 +276,8 @@ void irc_free( irc_t * irc )
if( irc->ping_source_id > 0 )
b_event_remove( irc->ping_source_id );
- b_event_remove( irc->r_watch_source_id );
+ if( irc->r_watch_source_id > 0 )
+ b_event_remove( irc->r_watch_source_id );
if( irc->w_watch_source_id > 0 )
b_event_remove( irc->w_watch_source_id );
diff --git a/lib/arc.h b/lib/arc.h
index 58f30d3d..816fa612 100644
--- a/lib/arc.h
+++ b/lib/arc.h
@@ -30,6 +30,10 @@ struct arc_state
unsigned char i, j;
};
+#ifndef G_GNUC_MALLOC
+#define G_GNUC_MALLOC
+#endif
+
G_GNUC_MALLOC struct arc_state *arc_keymaker( unsigned char *key, int kl, int cycles );
unsigned char arc_getbyte( struct arc_state *st );
int arc_encode( char *clear, int clear_len, unsigned char **crypt, char *password, int pad_to );
diff --git a/lib/proxy.c b/lib/proxy.c
index 53b89d64..91493557 100644
--- a/lib/proxy.c
+++ b/lib/proxy.c
@@ -113,6 +113,7 @@ static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition
static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb)
{
struct sockaddr_in *sin;
+ struct sockaddr_in me;
int fd = -1;
if (!(sin = gaim_gethostbyname(host, port))) {
@@ -127,6 +128,16 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB
sock_make_nonblocking(fd);
+ if( global.conf->iface_out )
+ {
+ me.sin_family = AF_INET;
+ me.sin_port = 0;
+ me.sin_addr.s_addr = inet_addr( global.conf->iface_out );
+
+ if( bind( fd, (struct sockaddr *) &me, sizeof( me ) ) != 0 )
+ event_debug( "bind( %d, \"%s\" ) failure\n", fd, global.conf->iface_out );
+ }
+
event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd);
if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0 && !sockerr_again()) {
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c
index 6e872040..518624f6 100644
--- a/protocols/jabber/jabber_util.c
+++ b/protocols/jabber/jabber_util.c
@@ -245,8 +245,10 @@ struct jabber_buddy_ask_data
char *realname;
};
-static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla )
+static void jabber_buddy_ask_yes( void *data )
{
+ struct jabber_buddy_ask_data *bla = data;
+
presence_send_request( bla->ic, bla->handle, "subscribed" );
if( imcb_find_buddy( bla->ic, bla->handle ) == NULL )
@@ -256,8 +258,10 @@ static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla
g_free( bla );
}
-static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla )
+static void jabber_buddy_ask_no( void *data )
{
+ struct jabber_buddy_ask_data *bla = data;
+
presence_send_request( bla->ic, bla->handle, "subscribed" );
g_free( bla->handle );
diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h
index c8f4f4c6..63759303 100644
--- a/protocols/msn/msn.h
+++ b/protocols/msn/msn.h
@@ -28,7 +28,7 @@
#define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r"
#define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r"
-#ifdef DEBUG
+#ifdef DEBUG_MSN
#define debug( text... ) imcb_log( ic, text );
#else
#define debug( text... )
diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c
index fae2877d..58ad22f8 100644
--- a/protocols/msn/msn_util.c
+++ b/protocols/msn/msn_util.c
@@ -89,8 +89,10 @@ struct msn_buddy_ask_data
char *realname;
};
-static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla )
+static void msn_buddy_ask_yes( void *data )
{
+ struct msn_buddy_ask_data *bla = data;
+
msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname );
if( imcb_find_buddy( bla->ic, bla->handle ) == NULL )
@@ -101,8 +103,10 @@ static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla )
g_free( bla );
}
-static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla )
+static void msn_buddy_ask_no( void *data )
{
+ struct msn_buddy_ask_data *bla = data;
+
msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname );
g_free( bla->handle );
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index ff7da6ed..ffaa90a7 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -177,7 +177,15 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
}
debug( "Connecting to a new switchboard with key %s", cmd[5] );
- sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW );
+
+ if( ( sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ) ) == NULL )
+ {
+ /* Although this isn't strictly fatal for the NS connection, it's
+ definitely something serious (we ran out of file descriptors?). */
+ imcb_error( ic, "Could not create new switchboard" );
+ imc_logout( ic, TRUE );
+ return( 0 );
+ }
if( md->msgq )
{
@@ -467,8 +475,18 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] );
- sb = msn_sb_create( ic, server, port, cmd[4], session );
- sb->who = g_strdup( cmd[5] );
+ if( ( sb = msn_sb_create( ic, server, port, cmd[4], session ) ) == NULL )
+ {
+ /* Although this isn't strictly fatal for the NS connection, it's
+ definitely something serious (we ran out of file descriptors?). */
+ imcb_error( ic, "Could not create new switchboard" );
+ imc_logout( ic, TRUE );
+ return( 0 );
+ }
+ else
+ {
+ sb->who = g_strdup( cmd[5] );
+ }
}
else if( strcmp( cmd[0], "ADD" ) == 0 )
{
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 3ce15166..7466e93a 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -342,7 +342,8 @@ void imc_logout( struct im_connection *ic, int allow_reconnect )
/* dialogs.c */
-void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont )
+void imcb_ask( struct im_connection *ic, char *msg, void *data,
+ query_callback doit, query_callback dont )
{
query_add( ic->irc, ic, msg, doit, dont, data );
}
@@ -494,18 +495,20 @@ struct show_got_added_data
char *handle;
};
-void show_got_added_no( gpointer w, struct show_got_added_data *data )
+void show_got_added_no( void *data )
{
- g_free( data->handle );
+ g_free( ((struct show_got_added_data*)data)->handle );
g_free( data );
}
-void show_got_added_yes( gpointer w, struct show_got_added_data *data )
+void show_got_added_yes( void *data )
{
- data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL );
- /* imcb_add_buddy( data->ic, NULL, data->handle, data->handle ); */
+ struct show_got_added_data *sga = data;
- return show_got_added_no( w, data );
+ sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL );
+ /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */
+
+ return show_got_added_no( data );
}
void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname )
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index dde0dd2f..68d5bc90 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -41,6 +41,7 @@
#include "bitlbee.h"
#include "account.h"
#include "proxy.h"
+#include "query.h"
#include "md5.h"
#define BUF_LEN MSG_LEN
@@ -279,7 +280,7 @@ G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G
* - 'data' can be your custom struct - it will be passed to the callbacks.
* - 'doit' or 'dont' will be called depending of the answer of the user.
*/
-G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );
+G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont );
G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname );
/* Buddy management */
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 9e5de70a..7738c31f 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -1083,8 +1083,8 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
return 1;
}
-void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv);
-void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv);
+void oscar_accept_chat(void *data);
+void oscar_reject_chat(void *data);
static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
struct im_connection *ic = sess->aux_data;
@@ -1118,7 +1118,8 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
return 1;
}
-static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
+static void gaim_icq_authgrant(void *data_) {
+ struct icq_auth *data = data_;
char *uin, message;
struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
@@ -1133,7 +1134,8 @@ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
g_free(data);
}
-static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) {
+static void gaim_icq_authdeny(void *data_) {
+ struct icq_auth *data = data_;
char *uin, *message;
struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
@@ -2587,15 +2589,19 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
return NULL;
}
-void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv)
+void oscar_accept_chat(void *data)
{
+ struct aim_chat_invitation * inv = data;
+
oscar_chat_join(inv->ic, inv->name, NULL, NULL);
g_free(inv->name);
g_free(inv);
}
-void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv)
+void oscar_reject_chat(void *data)
{
+ struct aim_chat_invitation * inv = data;
+
g_free(inv->name);
g_free(inv);
}
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index 36579d66..ab30df4d 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -796,16 +796,20 @@ int ext_yahoo_connect(const char *host, int port)
return -1;
}
-static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv )
+static void byahoo_accept_conf( void *data )
{
+ struct byahoo_conf_invitation *inv = data;
+
yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
imcb_chat_add_buddy( inv->c, inv->ic->acc->user );
g_free( inv->name );
g_free( inv );
}
-static void byahoo_reject_conf( gpointer w, struct byahoo_conf_invitation *inv )
+static void byahoo_reject_conf( void *data )
{
+ struct byahoo_conf_invitation *inv = data;
+
yahoo_conference_decline( inv->yid, NULL, inv->members, inv->name, "User rejected groupchat" );
imcb_chat_free( inv->c );
g_free( inv->name );
diff --git a/query.c b/query.c
index 6f9eb77f..e8f69572 100644
--- a/query.c
+++ b/query.c
@@ -29,7 +29,8 @@
static void query_display( irc_t *irc, query_t *q );
static query_t *query_default( irc_t *irc );
-query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data )
+query_t *query_add( irc_t *irc, struct im_connection *ic, char *question,
+ query_callback yes, query_callback no, void *data )
{
query_t *q = g_new0( query_t, 1 );
@@ -143,7 +144,7 @@ void query_answer( irc_t *irc, query_t *q, int ans )
imcb_log( q->ic, "Accepted: %s", q->question );
else
irc_usermsg( irc, "Accepted: %s", q->question );
- q->yes( NULL, q->data );
+ q->yes( q->data );
}
else
{
@@ -151,7 +152,7 @@ void query_answer( irc_t *irc, query_t *q, int ans )
imcb_log( q->ic, "Rejected: %s", q->question );
else
irc_usermsg( irc, "Rejected: %s", q->question );
- q->no( NULL, q->data );
+ q->no( q->data );
}
q->data = NULL;
diff --git a/query.h b/query.h
index b64642c2..e0ca32ec 100644
--- a/query.h
+++ b/query.h
@@ -26,17 +26,19 @@
#ifndef _QUERY_H
#define _QUERY_H
+typedef void (*query_callback) ( void *data );
+
typedef struct query
{
struct im_connection *ic;
char *question;
- void (* yes) ( gpointer w, void *data );
- void (* no) ( gpointer w, void *data );
+ query_callback yes, no;
void *data;
struct query *next;
} query_t;
-query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data );
+query_t *query_add( irc_t *irc, struct im_connection *ic, char *question,
+ query_callback yes, query_callback no, void *data );
void query_del( irc_t *irc, query_t *q );
void query_del_by_conn( irc_t *irc, struct im_connection *ic );
void query_answer( irc_t *irc, query_t *q, int ans );
diff --git a/root_commands.c b/root_commands.c
index 9a60b5af..f55c4b5e 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -203,24 +203,38 @@ static void cmd_drop( irc_t *irc, char **cmd )
}
}
-void cmd_account_del_yes( gpointer w, void *data )
+struct cmd_account_del_data
{
- account_t *a = data;
- irc_t *irc = a->irc;
+ account_t *a;
+ irc_t *irc;
+};
+
+void cmd_account_del_yes( void *data )
+{
+ struct cmd_account_del_data *cad = data;
+ account_t *a;
+
+ for( a = cad->irc->accounts; a && a != cad->a; a = a->next );
- if( a->ic )
+ if( a == NULL )
{
- irc_usermsg( irc, "Account is still logged in, can't delete" );
+ irc_usermsg( cad->irc, "Account already deleted" );
+ }
+ else if( a->ic )
+ {
+ irc_usermsg( cad->irc, "Account is still logged in, can't delete" );
}
else
{
- account_del( irc, a );
- irc_usermsg( irc, "Account deleted" );
+ account_del( cad->irc, a );
+ irc_usermsg( cad->irc, "Account deleted" );
}
+ g_free( data );
}
-void cmd_account_del_no( gpointer w, void *data )
+void cmd_account_del_no( void *data )
{
+ g_free( data );
}
static void cmd_account( irc_t *irc, char **cmd )
@@ -277,14 +291,19 @@ static void cmd_account( irc_t *irc, char **cmd )
}
else
{
+ struct cmd_account_del_data *cad;
char *msg;
+ cad = g_malloc( sizeof( struct cmd_account_del_data ) );
+ cad->a = a;
+ cad->irc = irc;
+
msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will "
"also forget all your saved nicknames. If you want "
"to change your username/password, use the `account "
"set' command. Are you sure you want to delete this "
"account?", a->prpl->name, a->user );
- query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, a );
+ query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad );
g_free( msg );
}
}
@@ -403,6 +422,12 @@ static void cmd_account( irc_t *irc, char **cmd )
else
acc_handle = g_strdup( cmd[2] );
+ if( !acc_handle )
+ {
+ irc_usermsg( irc, "Not enough parameters given (need %d)", 3 );
+ return;
+ }
+
if( ( tmp = strchr( acc_handle, '/' ) ) )
{
*tmp = 0;
@@ -583,6 +608,9 @@ static void cmd_rename( irc_t *irc, char **cmd )
{
g_free( irc->mynick );
irc->mynick = g_strdup( cmd[2] );
+
+ if( strcmp( cmd[0], "set_rename" ) != 0 )
+ set_setstr( &irc->set, "root_nick", cmd[2] );
}
else if( u->send_handler == buddy_send_handler )
{
@@ -593,6 +621,20 @@ static void cmd_rename( irc_t *irc, char **cmd )
}
}
+char *set_eval_root_nick( set_t *set, char *new_nick )
+{
+ irc_t *irc = set->data;
+
+ if( strcmp( irc->mynick, new_nick ) != 0 )
+ {
+ char *cmd[] = { "set_rename", irc->mynick, new_nick, NULL };
+
+ cmd_rename( irc, cmd );
+ }
+
+ return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : NULL;
+}
+
static void cmd_remove( irc_t *irc, char **cmd )
{
user_t *u;