aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-31 23:38:50 -0400
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-31 23:38:50 -0400
commitd860a8ddf5039f7208bff4c179bc9fe1549da6da (patch)
treecb96dfcc222e78bd23d25f480b94f2c69470e373
parent81e04e162bdc4517b2f357fd16dfd76f68245464 (diff)
Restored "account" root command and restored enough stuff to be able to
send messages. Also started moving stuff out from nogaim.* into bee_* files.
-rw-r--r--irc.c2
-rw-r--r--irc.h5
-rw-r--r--irc_commands.c18
-rw-r--r--irc_im.c31
-rw-r--r--protocols/bee.h12
-rw-r--r--protocols/bee_user.c184
-rw-r--r--protocols/nogaim.c182
-rw-r--r--protocols/nogaim.h13
-rw-r--r--root_commands.c39
-rw-r--r--unix.c2
10 files changed, 262 insertions, 226 deletions
diff --git a/irc.c b/irc.c
index 4eaa55a8..de9b4a04 100644
--- a/irc.c
+++ b/irc.c
@@ -93,6 +93,8 @@ irc_t *irc_new( int fd )
irc_connection_list = g_slist_append( irc_connection_list, irc );
b = irc->b = bee_new();
+ b->ui_data = irc;
+ b->ui = &irc_ui_funcs;
s = set_add( &b->set, "away_devoice", "true", NULL/*set_eval_away_devoice*/, irc );
s = set_add( &b->set, "buddy_sendbuffer", "false", set_eval_bool, irc );
diff --git a/irc.h b/irc.h
index d3714a4a..b5aef53a 100644
--- a/irc.h
+++ b/irc.h
@@ -74,7 +74,6 @@ typedef struct irc
char umode[8];
struct query *queries;
- struct account *accounts;
GSList *file_transfers;
GSList *users, *channels;
@@ -112,7 +111,7 @@ typedef struct irc_user
guint sendbuf_timer;
//int sendbuf_flags;
- //struct user *b;
+ struct bee_user *bu;
const struct irc_user_funcs *f;
} irc_user_t;
@@ -152,6 +151,8 @@ struct irc_channel_funcs
gboolean (*privmsg)( irc_channel_t *iu, const char *msg );
};
+extern const struct bee_ui_funcs irc_ui_funcs;
+
/* irc.c */
extern GSList *irc_connection_list;
diff --git a/irc_commands.c b/irc_commands.c
index 858b5bdd..03d05417 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -308,6 +308,13 @@ static void irc_cmd_privmsg( irc_t *irc, char **cmd )
#endif
}
+static void irc_cmd_nickserv( irc_t *irc, char **cmd )
+{
+ /* [SH] This aliases the NickServ command to PRIVMSG root */
+ /* [TV] This aliases the NS command to PRIVMSG root as well */
+ root_command( irc, cmd + 1 );
+}
+
#if 0
@@ -517,13 +524,6 @@ static void irc_cmd_away( irc_t *irc, char **cmd )
set_setstr( &irc->set, "away", u->away );
}
-static void irc_cmd_nickserv( irc_t *irc, char **cmd )
-{
- /* [SH] This aliases the NickServ command to PRIVMSG root */
- /* [TV] This aliases the NS command to PRIVMSG root as well */
- root_command( irc, cmd + 1 );
-}
-
static void irc_cmd_version( irc_t *irc, char **cmd )
{
irc_send_num( irc, 351, "bitlbee-%s. %s :%s/%s ", BITLBEE_VERSION, irc->myhost, ARCH, CPU );
@@ -577,6 +577,8 @@ static const command_t irc_commands[] = {
{ "mode", 1, irc_cmd_mode, IRC_CMD_LOGGED_IN },
{ "who", 0, irc_cmd_who, IRC_CMD_LOGGED_IN },
{ "privmsg", 1, irc_cmd_privmsg, IRC_CMD_LOGGED_IN },
+ { "nickserv", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN },
+ { "ns", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN },
#if 0
{ "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN },
{ "invite", 2, irc_cmd_invite, IRC_CMD_LOGGED_IN },
@@ -586,8 +588,6 @@ static const command_t irc_commands[] = {
{ "watch", 1, irc_cmd_watch, IRC_CMD_LOGGED_IN },
{ "topic", 1, irc_cmd_topic, IRC_CMD_LOGGED_IN },
{ "away", 0, irc_cmd_away, IRC_CMD_LOGGED_IN },
- { "nickserv", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN },
- { "ns", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN },
{ "version", 0, irc_cmd_version, IRC_CMD_LOGGED_IN },
{ "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN },
{ "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
diff --git a/irc_im.c b/irc_im.c
index 9f64981d..07b478fb 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -25,8 +25,10 @@
#include "bitlbee.h"
+
+/* IM->IRC callbacks */
+
static const struct irc_user_funcs irc_user_im_funcs;
-static const struct bee_ui_funcs irc_ui_funcs;
static gboolean bee_irc_user_new( bee_t *bee, bee_user_t *bu )
{
@@ -36,7 +38,8 @@ static gboolean bee_irc_user_new( bee_t *bee, bee_user_t *bu )
memset( nick, 0, MAX_NICK_LENGTH + 1 );
strcpy( nick, nick_get( bu->ic->acc, bu->handle ) );
- iu = irc_user_new( (irc_t*) bee->ui_data, nick );
+ bu->ui_data = iu = irc_user_new( (irc_t*) bee->ui_data, nick );
+ iu->bu = bu;
if( ( s = strchr( bu->handle, '@' ) ) )
{
@@ -65,11 +68,33 @@ static gboolean bee_irc_user_new( bee_t *bee, bee_user_t *bu )
return TRUE;
}
+static gboolean bee_irc_user_free( bee_t *bee, bee_user_t *bu )
+{
+ return irc_user_free( bee->ui_data, bu->ui_data );
+}
+static gboolean bee_irc_user_status( bee_t *bee, bee_user_t *bu, bee_user_t *old )
+{
+ return TRUE;
+}
-static const struct bee_ui_funcs irc_ui_funcs = {
+const struct bee_ui_funcs irc_ui_funcs = {
bee_irc_user_new,
+ bee_irc_user_free,
+ bee_irc_user_status,
};
+
+/* IRC->IM calls */
+
+static gboolean bee_irc_user_privmsg( irc_user_t *iu, const char *msg )
+{
+ if( iu->bu )
+ return bee_user_msg( iu->irc->b, iu->bu, msg, 0 );
+ else
+ return FALSE;
+}
+
static const struct irc_user_funcs irc_user_im_funcs = {
+ bee_irc_user_privmsg,
};
diff --git a/protocols/bee.h b/protocols/bee.h
index e76e7988..c36a6b16 100644
--- a/protocols/bee.h
+++ b/protocols/bee.h
@@ -79,5 +79,17 @@ void bee_free( bee_t *b );
bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *handle );
int bee_user_free( bee_t *bee, struct im_connection *ic, const char *handle );
bee_user_t *bee_user_by_handle( bee_t *bee, struct im_connection *ic, const char *handle );
+int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags );
+
+/* Callbacks from IM modules to core: */
+/* Buddy activity */
+/* To manipulate the status of a handle.
+ * - flags can be |='d with OPT_* constants. You will need at least:
+ * OPT_LOGGED_IN and OPT_AWAY.
+ * - 'state' and 'message' can be NULL */
+G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message );
+/* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle );
+/* Call when a handle says something. 'flags' and 'sent_at may be just 0. */
+G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at );
#endif /* __BEE_H__ */
diff --git a/protocols/bee_user.c b/protocols/bee_user.c
index 4356c141..66e25faf 100644
--- a/protocols/bee_user.c
+++ b/protocols/bee_user.c
@@ -80,3 +80,187 @@ bee_user_t *bee_user_by_handle( bee_t *bee, struct im_connection *ic, const char
return NULL;
}
+
+int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags )
+{
+ char *buf = NULL;
+ int st;
+
+ if( ( bu->ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+ {
+ buf = escape_html( msg );
+ msg = buf;
+ }
+
+ st = bu->ic->acc->prpl->buddy_msg( bu->ic, bu->handle, msg, flags );
+ g_free( buf );
+
+ return st;
+}
+
+
+/* IM->UI callbacks */
+void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message )
+{
+ bee_t *bee = ic->bee;
+ bee_user_t *bu, *old;
+
+ if( !( bu = bee_user_by_handle( bee, ic, handle ) ) )
+ {
+ if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "add" ) == 0 )
+ {
+ bu = bee_user_new( bee, ic, handle );
+ }
+ else
+ {
+ if( set_getbool( &ic->bee->set, "debug" ) || g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 )
+ {
+ imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle );
+ imcb_log( ic, "flags = %d, state = %s, message = %s", flags,
+ state ? state : "NULL", message ? message : "NULL" );
+ }
+
+ return;
+ }
+ }
+
+ /* May be nice to give the UI something to compare against. */
+ old = g_memdup( bu, sizeof( bee_user_t ) );
+
+ /* TODO(wilmer): OPT_AWAY, or just state == NULL ? */
+ bu->flags = ( flags & OPT_LOGGED_IN ? BEE_USER_ONLINE : 0 ) |
+ ( flags & OPT_AWAY ? BEE_USER_AWAY : 0 );
+ bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state );
+ bu->status_msg = g_strdup( message );
+
+ if( bee->ui->user_status )
+ bee->ui->user_status( bee, bu, old );
+
+ g_free( old->status_msg );
+ g_free( old->status );
+ g_free( old );
+#if 0
+ oa = u->away != NULL;
+ oo = u->online;
+
+ g_free( u->away );
+ g_free( u->status_msg );
+ u->away = u->status_msg = NULL;
+
+ if( ( flags & OPT_LOGGED_IN ) && !u->online )
+ {
+ irc_spawn( ic->irc, u );
+ u->online = 1;
+ }
+ else if( !( flags & OPT_LOGGED_IN ) && u->online )
+ {
+ struct groupchat *c;
+
+ irc_kill( ic->irc, u );
+ u->online = 0;
+
+ /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
+ for( c = ic->groupchats; c; c = c->next )
+ remove_chat_buddy_silent( c, handle );
+ }
+
+ if( flags & OPT_AWAY )
+ {
+ if( state && message )
+ {
+ u->away = g_strdup_printf( "%s (%s)", state, message );
+ }
+ else if( state )
+ {
+ u->away = g_strdup( state );
+ }
+ else if( message )
+ {
+ u->away = g_strdup( message );
+ }
+ else
+ {
+ u->away = g_strdup( "Away" );
+ }
+ }
+ else
+ {
+ u->status_msg = g_strdup( message );
+ }
+
+ /* LISPy... */
+ if( ( set_getbool( &ic->bee->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */
+ ( u->online ) && /* Don't touch offline people */
+ ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */
+ ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */
+ {
+ char *from;
+
+ if( set_getbool( &ic->bee->set, "simulate_netsplit" ) )
+ {
+ from = g_strdup( ic->irc->myhost );
+ }
+ else
+ {
+ from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick,
+ ic->irc->myhost );
+ }
+ irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
+ u->away?'-':'+', u->nick );
+ g_free( from );
+ }
+#endif
+}
+
+void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
+{
+#if 0
+ bee_t *bee = ic->bee;
+ char *wrapped;
+ user_t *u;
+
+ u = user_findhandle( ic, handle );
+
+ if( !u )
+ {
+ char *h = set_getstr( &bee->set, "handle_unknown" );
+
+ if( g_strcasecmp( h, "ignore" ) == 0 )
+ {
+ if( set_getbool( &bee->set, "debug" ) )
+ imcb_log( ic, "Ignoring message from unknown handle %s", handle );
+
+ return;
+ }
+ else if( g_strncasecmp( h, "add", 3 ) == 0 )
+ {
+ int private = set_getbool( &bee->set, "private" );
+
+ if( h[3] )
+ {
+ if( g_strcasecmp( h + 3, "_private" ) == 0 )
+ private = 1;
+ else if( g_strcasecmp( h + 3, "_channel" ) == 0 )
+ private = 0;
+ }
+
+ imcb_add_buddy( ic, handle, NULL );
+ u = user_findhandle( ic, handle );
+ u->is_private = private;
+ }
+ else
+ {
+ imcb_log( ic, "Message from unknown handle %s:", handle );
+ u = user_find( irc, irc->mynick );
+ }
+ }
+
+ if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
+ ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
+ strip_html( msg );
+
+ wrapped = word_wrap( msg, 425 );
+ irc_msgfrom( irc, u->nick, wrapped );
+ g_free( wrapped );
+#endif
+}
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 2edc8e75..741bdb76 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -548,171 +548,6 @@ void imcb_ask_add( struct im_connection *ic, const char *handle, const char *rea
#endif
}
-void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message )
-{
- bee_t *bee = ic->bee;
- bee_user_t *bu, *old;
-
- if( !( bu = bee_user_by_handle( bee, ic, handle ) ) )
- {
- if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "add" ) == 0 )
- {
- bu = bee_user_new( bee, ic, handle );
- }
- else
- {
- if( set_getbool( &ic->bee->set, "debug" ) || g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 )
- {
- imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle );
- imcb_log( ic, "flags = %d, state = %s, message = %s", flags,
- state ? state : "NULL", message ? message : "NULL" );
- }
-
- return;
- }
- }
-
- /* May be nice to give the UI something to compare against. */
- old = g_memdup( bu, sizeof( bee_user_t ) );
-
- /* TODO(wilmer): OPT_AWAY, or just state == NULL ? */
- bu->flags = ( flags & OPT_LOGGED_IN ? BEE_USER_ONLINE : 0 ) |
- ( flags & OPT_AWAY ? BEE_USER_AWAY : 0 );
- bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state );
- bu->status_msg = g_strdup( message );
-
- if( bee->ui->user_status )
- bee->ui->user_status( bee, bu, old );
-
- g_free( old->status_msg );
- g_free( old->status );
- g_free( old );
-#if 0
- oa = u->away != NULL;
- oo = u->online;
-
- g_free( u->away );
- g_free( u->status_msg );
- u->away = u->status_msg = NULL;
-
- if( ( flags & OPT_LOGGED_IN ) && !u->online )
- {
- irc_spawn( ic->irc, u );
- u->online = 1;
- }
- else if( !( flags & OPT_LOGGED_IN ) && u->online )
- {
- struct groupchat *c;
-
- irc_kill( ic->irc, u );
- u->online = 0;
-
- /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
- for( c = ic->groupchats; c; c = c->next )
- remove_chat_buddy_silent( c, handle );
- }
-
- if( flags & OPT_AWAY )
- {
- if( state && message )
- {
- u->away = g_strdup_printf( "%s (%s)", state, message );
- }
- else if( state )
- {
- u->away = g_strdup( state );
- }
- else if( message )
- {
- u->away = g_strdup( message );
- }
- else
- {
- u->away = g_strdup( "Away" );
- }
- }
- else
- {
- u->status_msg = g_strdup( message );
- }
-
- /* LISPy... */
- if( ( set_getbool( &ic->bee->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */
- ( u->online ) && /* Don't touch offline people */
- ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */
- ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */
- {
- char *from;
-
- if( set_getbool( &ic->bee->set, "simulate_netsplit" ) )
- {
- from = g_strdup( ic->irc->myhost );
- }
- else
- {
- from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick,
- ic->irc->myhost );
- }
- irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
- u->away?'-':'+', u->nick );
- g_free( from );
- }
-#endif
-}
-
-void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
-{
-#if 0
- bee_t *bee = ic->bee;
- char *wrapped;
- user_t *u;
-
- u = user_findhandle( ic, handle );
-
- if( !u )
- {
- char *h = set_getstr( &bee->set, "handle_unknown" );
-
- if( g_strcasecmp( h, "ignore" ) == 0 )
- {
- if( set_getbool( &bee->set, "debug" ) )
- imcb_log( ic, "Ignoring message from unknown handle %s", handle );
-
- return;
- }
- else if( g_strncasecmp( h, "add", 3 ) == 0 )
- {
- int private = set_getbool( &bee->set, "private" );
-
- if( h[3] )
- {
- if( g_strcasecmp( h + 3, "_private" ) == 0 )
- private = 1;
- else if( g_strcasecmp( h + 3, "_channel" ) == 0 )
- private = 0;
- }
-
- imcb_add_buddy( ic, handle, NULL );
- u = user_findhandle( ic, handle );
- u->is_private = private;
- }
- else
- {
- imcb_log( ic, "Message from unknown handle %s:", handle );
- u = user_find( irc, irc->mynick );
- }
- }
-
- if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
- ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
- strip_html( msg );
-
- wrapped = word_wrap( msg, 425 );
- irc_msgfrom( irc, u->nick, wrapped );
- g_free( wrapped );
-#endif
-}
-
void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags )
{
#if 0
@@ -1034,23 +869,6 @@ char *set_eval_away_devoice( set_t *set, char *value )
/* The plan is to not allow straight calls to prpl functions anymore, but do
them all from some wrappers. We'll start to define some down here: */
-int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags )
-{
- char *buf = NULL;
- int st;
-
- if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
- {
- buf = escape_html( msg );
- msg = buf;
- }
-
- st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags );
- g_free( buf );
-
- return st;
-}
-
int imc_chat_msg( struct groupchat *c, char *msg, int flags )
{
char *buf = NULL;
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 4a334bf2..a93dc5d2 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -1,7 +1,7 @@
/********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
- * Copyright 2002-2004 Wilmer van der Gaast and others *
+ * Copyright 2002-2010 Wilmer van der Gaast and others *
\********************************************************************/
/*
@@ -285,16 +285,8 @@ G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *h
G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname );
G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick );
-/* Buddy activity */
-/* To manipulate the status of a handle.
- * - flags can be |='d with OPT_* constants. You will need at least:
- * OPT_LOGGED_IN and OPT_AWAY.
- * - 'state' and 'message' can be NULL */
-G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message );
-/* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle );
-/* Call when a handle says something. 'flags' and 'sent_at may be just 0. */
-G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at );
G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags );
+G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle );
G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle );
/* Groupchats */
@@ -319,7 +311,6 @@ G_MODULE_EXPORT void imcb_chat_free( struct groupchat *c );
/* Actions, or whatever. */
int imc_away_send_update( struct im_connection *ic );
-int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags );
int imc_chat_msg( struct groupchat *c, char *msg, int flags );
void imc_add_allow( struct im_connection *ic, char *handle );
diff --git a/root_commands.c b/root_commands.c
index 9b396379..75f3af81 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -220,6 +220,7 @@ static void cmd_drop( irc_t *irc, char **cmd )
break;
}
}
+#endif
struct cmd_account_del_data
{
@@ -232,7 +233,7 @@ 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 );
+ for( a = cad->irc->b->accounts; a && a != cad->a; a = a->next );
if( a == NULL )
{
@@ -244,7 +245,7 @@ void cmd_account_del_yes( void *data )
}
else
{
- account_del( cad->irc, a );
+ account_del( cad->irc->b, a );
irc_usermsg( cad->irc, "Account deleted" );
}
g_free( data );
@@ -285,7 +286,7 @@ static int cmd_set_real( irc_t *irc, char **cmd, cmd_set_findhead findhead, cmd_
{
set_name = set_full;
- head = &irc->set;
+ head = &irc->b->set;
}
else
{
@@ -356,7 +357,7 @@ static set_t **cmd_account_set_findhead( irc_t *irc, char *id )
{
account_t *a;
- if( ( a = account_get( irc, id ) ) )
+ if( ( a = account_get( irc->b, id ) ) )
return &a->set;
else
return NULL;
@@ -404,7 +405,7 @@ static void cmd_account( irc_t *irc, char **cmd )
return;
}
- a = account_add( irc, prpl, cmd[3], cmd[4] );
+ a = account_add( irc->b, prpl, cmd[3], cmd[4] );
if( cmd[5] )
{
irc_usermsg( irc, "Warning: Passing a servername/other flags to `account add' "
@@ -418,7 +419,7 @@ static void cmd_account( irc_t *irc, char **cmd )
{
MIN_ARGS( 2 );
- if( !( a = account_get( irc, cmd[2] ) ) )
+ if( !( a = account_get( irc->b, cmd[2] ) ) )
{
irc_usermsg( irc, "Invalid account" );
}
@@ -440,7 +441,7 @@ static void cmd_account( irc_t *irc, char **cmd )
"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, cad );
+ //query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad );
g_free( msg );
}
}
@@ -451,7 +452,7 @@ static void cmd_account( irc_t *irc, char **cmd )
if( strchr( irc->umode, 'b' ) )
irc_usermsg( irc, "Account list:" );
- for( a = irc->accounts; a; a = a->next )
+ for( a = irc->b->accounts; a; a = a->next )
{
char *con;
@@ -474,7 +475,7 @@ static void cmd_account( irc_t *irc, char **cmd )
{
if( cmd[2] )
{
- if( ( a = account_get( irc, cmd[2] ) ) )
+ if( ( a = account_get( irc->b, cmd[2] ) ) )
{
if( a->ic )
{
@@ -483,7 +484,7 @@ static void cmd_account( irc_t *irc, char **cmd )
}
else
{
- account_on( irc, a );
+ account_on( irc->b, a );
}
}
else
@@ -494,12 +495,13 @@ static void cmd_account( irc_t *irc, char **cmd )
}
else
{
- if ( irc->accounts ) {
+ if ( irc->b->accounts )
+ {
irc_usermsg( irc, "Trying to get all accounts connected..." );
- for( a = irc->accounts; a; a = a->next )
+ for( a = irc->b->accounts; a; a = a->next )
if( !a->ic && a->auto_connect )
- account_on( irc, a );
+ account_on( irc->b, a );
}
else
{
@@ -513,19 +515,19 @@ static void cmd_account( irc_t *irc, char **cmd )
{
irc_usermsg( irc, "Deactivating all active (re)connections..." );
- for( a = irc->accounts; a; a = a->next )
+ for( a = irc->b->accounts; a; a = a->next )
{
if( a->ic )
- account_off( irc, a );
+ account_off( irc->b, a );
else if( a->reconnect )
cancel_auto_reconnect( a );
}
}
- else if( ( a = account_get( irc, cmd[2] ) ) )
+ else if( ( a = account_get( irc->b, cmd[2] ) ) )
{
if( a->ic )
{
- account_off( irc, a );
+ account_off( irc->b, a );
}
else if( a->reconnect )
{
@@ -556,6 +558,7 @@ static void cmd_account( irc_t *irc, char **cmd )
}
}
+#if 0
static void cmd_add( irc_t *irc, char **cmd )
{
account_t *a;
@@ -1221,11 +1224,11 @@ static void cmd_transfer( irc_t *irc, char **cmd )
const command_t commands[] = {
{ "help", 0, cmd_help, 0 },
+ { "account", 1, cmd_account, 0 },
#if 0
{ "identify", 1, cmd_identify, 0 },
{ "register", 1, cmd_register, 0 },
{ "drop", 1, cmd_drop, 0 },
- { "account", 1, cmd_account, 0 },
{ "add", 2, cmd_add, 0 },
{ "info", 1, cmd_info, 0 },
{ "rename", 2, cmd_rename, 0 },
diff --git a/unix.c b/unix.c
index 647418fb..b916a4cc 100644
--- a/unix.c
+++ b/unix.c
@@ -61,7 +61,7 @@ int main( int argc, char *argv[] )
return( 1 );
b_main_init();
- //nogaim_init();
+ nogaim_init();
srand( time( NULL ) ^ getpid() );
global.helpfile = g_strdup( HELP_FILE );