diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-15 18:03:08 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-15 18:03:08 -0700 |
commit | 84b045d409f1e8da6d8bf379c6fef7236dcd9bcd (patch) | |
tree | 765681f302614273ac61e1560955a7307252097e | |
parent | c2fb38096ea4e75a680e57e103d4a4986aa84c75 (diff) |
s/imc/imcb/ for callback functions. Moved things aroundin nogaim.h a
little bit, grouping things by category instead of original Gaim 0.58
filename.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | irc.c | 6 | ||||
-rw-r--r-- | irc_commands.c | 2 | ||||
-rw-r--r-- | protocols/jabber/io.c | 30 | ||||
-rw-r--r-- | protocols/jabber/iq.c | 30 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 12 | ||||
-rw-r--r-- | protocols/jabber/jabber_util.c | 4 | ||||
-rw-r--r-- | protocols/jabber/presence.c | 6 | ||||
-rw-r--r-- | protocols/jabber/sasl.c | 14 | ||||
-rw-r--r-- | protocols/msn/msn.c | 14 | ||||
-rw-r--r-- | protocols/msn/msn_util.c | 8 | ||||
-rw-r--r-- | protocols/msn/ns.c | 70 | ||||
-rw-r--r-- | protocols/msn/sb.c | 6 | ||||
-rw-r--r-- | protocols/nogaim.c | 91 | ||||
-rw-r--r-- | protocols/nogaim.h | 86 | ||||
-rw-r--r-- | protocols/oscar/chat.c | 6 | ||||
-rw-r--r-- | protocols/oscar/chatnav.c | 10 | ||||
-rw-r--r-- | protocols/oscar/icq.c | 2 | ||||
-rw-r--r-- | protocols/oscar/im.c | 8 | ||||
-rw-r--r-- | protocols/oscar/info.c | 6 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 100 | ||||
-rw-r--r-- | protocols/oscar/rxqueue.c | 2 | ||||
-rw-r--r-- | protocols/oscar/search.c | 2 | ||||
-rw-r--r-- | protocols/oscar/service.c | 4 | ||||
-rw-r--r-- | protocols/oscar/txqueue.c | 8 | ||||
-rw-r--r-- | protocols/yahoo/yahoo.c | 28 | ||||
-rw-r--r-- | query.c | 8 | ||||
-rw-r--r-- | root_commands.c | 8 |
28 files changed, 277 insertions, 296 deletions
@@ -11,7 +11,7 @@ # Program variables objects = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o user.o headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ini.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h url.h user.h protocols/http_client.h protocols/md5.h protocols/nogaim.h protocols/proxy.h protocols/sha.h protocols/ssl_client.h -subdirs = protocols lib +subdirs = lib protocols # Expansion of variables subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) @@ -1036,7 +1036,7 @@ int irc_send( irc_t *irc, char *nick, char *s, int flags ) } else if( c && c->ic && c->ic->acc && c->ic->acc->prpl ) { - return( bim_chat_msg( c, s, 0 ) ); + return( imc_chat_msg( c, s, 0 ) ); } return( 0 ); @@ -1051,7 +1051,7 @@ static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_cond return FALSE; u->sendbuf[u->sendbuf_len-2] = 0; /* Cut off the last newline */ - bim_buddy_msg( u->ic, u->handle, u->sendbuf, u->sendbuf_flags ); + imc_buddy_msg( u->ic, u->handle, u->sendbuf, u->sendbuf_flags ); g_free( u->sendbuf ); u->sendbuf = NULL; @@ -1103,7 +1103,7 @@ void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ) } else { - bim_buddy_msg( u->ic, u->handle, msg, flags ); + imc_buddy_msg( u->ic, u->handle, msg, flags ); } } diff --git a/irc_commands.c b/irc_commands.c index d65cf720..016b6f84 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -462,7 +462,7 @@ static void irc_cmd_away( irc_t *irc, char **cmd ) struct im_connection *ic = a->ic; if( ic && ic->flags & OPT_LOGGED_IN ) - bim_set_away( ic, u->away ); + imc_set_away( ic, u->away ); } } diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index c64901f7..67deb3a6 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -116,7 +116,7 @@ static gboolean jabber_write_queue( struct im_connection *ic ) closesocket( jd->fd ); /* Shouldn't be necessary after errors? */ jd->fd = -1; - imc_error( ic, "Short write() to server" ); + imcb_error( ic, "Short write() to server" ); imc_logout( ic, TRUE ); return FALSE; } @@ -159,7 +159,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition /* Parse. */ if( xt_feed( jd->xt, buf, st ) < 0 ) { - imc_error( ic, "XML stream error" ); + imcb_error( ic, "XML stream error" ); imc_logout( ic, TRUE ); return FALSE; } @@ -202,7 +202,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition SASL and TLS. */ if( set_getbool( &ic->acc->set, "tls" ) ) { - imc_error( ic, "TLS is turned on for this " + imcb_error( ic, "TLS is turned on for this " "account, but is not supported by this server" ); imc_logout( ic, FALSE ); return FALSE; @@ -215,7 +215,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition } else { - imc_error( ic, "XML stream error" ); + imcb_error( ic, "XML stream error" ); imc_logout( ic, TRUE ); return FALSE; } @@ -226,7 +226,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition closesocket( jd->fd ); jd->fd = -1; - imc_error( ic, "Error while reading from server" ); + imcb_error( ic, "Error while reading from server" ); imc_logout( ic, TRUE ); return FALSE; } @@ -241,12 +241,12 @@ gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition c if( source == -1 ) { - imc_error( ic, "Could not connect to server" ); + imcb_error( ic, "Could not connect to server" ); imc_logout( ic, TRUE ); return FALSE; } - imc_log( ic, "Connected to server, logging in" ); + imcb_log( ic, "Connected to server, logging in" ); return jabber_start_stream( ic ); } @@ -262,12 +262,12 @@ gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition co already, set it to NULL here to prevent a double cleanup: */ jd->ssl = NULL; - imc_error( ic, "Could not connect to server" ); + imcb_error( ic, "Could not connect to server" ); imc_logout( ic, TRUE ); return FALSE; } - imc_log( ic, "Connected to server, logging in" ); + imcb_log( ic, "Connected to server, logging in" ); return jabber_start_stream( ic ); } @@ -296,7 +296,7 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data ) if( c && ( !trytls && !set_getbool( &ic->acc->set, "tls" ) ) ) { - imc_error( ic, "Server requires TLS connections, but TLS is turned off for this account" ); + imcb_error( ic, "Server requires TLS connections, but TLS is turned off for this account" ); imc_logout( ic, FALSE ); return XT_ABORT; @@ -326,7 +326,7 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data ) if( !trytls && set_getbool( &ic->acc->set, "tls" ) ) { - imc_error( ic, "TLS is turned on for this account, but is not supported by this server" ); + imcb_error( ic, "TLS is turned on for this account, but is not supported by this server" ); imc_logout( ic, FALSE ); return XT_ABORT; @@ -416,7 +416,7 @@ static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data ) } jd->w_inpa = jd->r_inpa = 0; - imc_log( ic, "Converting stream to TLS" ); + imcb_log( ic, "Converting stream to TLS" ); jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic ); @@ -452,7 +452,7 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data ) /* Tssk... */ if( type == NULL ) { - imc_error( ic, "Unknown stream error reported by server" ); + imcb_error( ic, "Unknown stream error reported by server" ); imc_logout( ic, allow_reconnect ); return XT_ABORT; } @@ -462,12 +462,12 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data ) infinite loop! */ if( strcmp( type, "conflict" ) == 0 ) { - imc_error( ic, "Account and resource used from a different location" ); + imcb_error( ic, "Account and resource used from a different location" ); allow_reconnect = FALSE; } else { - imc_error( ic, "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" ); + imcb_error( ic, "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" ); } imc_logout( ic, allow_reconnect ); diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index fc6f223d..53be819e 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -38,7 +38,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) if( !type ) { - imc_error( ic, "Received IQ packet without type." ); + imcb_error( ic, "Received IQ packet without type." ); imc_logout( ic, TRUE ); return XT_ABORT; } @@ -59,7 +59,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) entry = g_hash_table_lookup( jd->node_cache, s ); if( entry == NULL ) - imc_log( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s ); + imcb_log( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s ); else if( entry->func ) return entry->func( ic, node, entry->node ); } @@ -68,7 +68,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) if( !( c = xt_find_node( node->children, "query" ) ) || !( s = xt_find_attr( c, "xmlns" ) ) ) { - imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); + imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); return XT_HANDLED; } @@ -131,7 +131,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) if( !( c = xt_find_node( node->children, "query" ) ) || !( s = xt_find_attr( c, "xmlns" ) ) ) { - imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); + imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); return XT_HANDLED; } @@ -153,7 +153,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) } else { - imc_log( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" ); + imcb_log( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" ); xt_free_node( reply ); reply = jabber_make_error_packet( node, "not-allowed", "cancel" ); @@ -218,7 +218,7 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no if( !( query = xt_find_node( node->children, "query" ) ) ) { - imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); + imcb_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); imc_logout( ic, FALSE ); return XT_HANDLED; } @@ -257,7 +257,7 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no { xt_free_node( reply ); - imc_error( ic, "Can't find suitable authentication method" ); + imcb_error( ic, "Can't find suitable authentication method" ); imc_logout( ic, FALSE ); return XT_ABORT; } @@ -276,14 +276,14 @@ static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node if( !( type = xt_find_attr( node, "type" ) ) ) { - imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); + imcb_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); imc_logout( ic, FALSE ); return XT_HANDLED; } if( strcmp( type, "error" ) == 0 ) { - imc_error( ic, "Authentication failure" ); + imcb_error( ic, "Authentication failure" ); imc_logout( ic, FALSE ); return XT_ABORT; } @@ -310,7 +310,7 @@ xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, c = xt_find_node( c->children, "jid" ); if( c && c->text_len && ( s = strchr( c->text, '/' ) ) && strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 ) - imc_log( ic, "Server changed session resource string to `%s'", s + 1 ); + imcb_log( ic, "Server changed session resource string to `%s'", s + 1 ); jd->flags &= ~JFLAG_WAIT_BIND; } @@ -333,7 +333,7 @@ int jabber_get_roster( struct im_connection *ic ) struct xt_node *node; int st; - imc_log( ic, "Authenticated, requesting buddy list" ); + imcb_log( ic, "Authenticated, requesting buddy list" ); node = xt_new_node( "query", NULL, NULL ); xt_add_attr( node, "xmlns", XMLNS_ROSTER ); @@ -352,7 +352,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node * if( !( query = xt_find_node( node->children, "query" ) ) ) { - imc_log( ic, "WARNING: Received NULL roster packet" ); + imcb_log( ic, "WARNING: Received NULL roster packet" ); return XT_HANDLED; } @@ -396,7 +396,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node * } if( initial ) - imc_connected( ic ); + imcb_connected( ic ); return XT_HANDLED; } @@ -427,7 +427,7 @@ static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_no ( vc = xt_find_node( node->children, "vCard" ) ) == NULL ) { s = xt_find_attr( orig, "to" ); /* If this returns NULL something's wrong.. */ - imc_log( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" ); + imcb_log( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" ); return XT_HANDLED; } @@ -535,7 +535,7 @@ static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_no /* *sigh* */ - imc_log( ic, "%s", reply->str ); + imcb_log( ic, "%s", reply->str ); g_string_free( reply, TRUE ); return XT_HANDLED; diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index af294d90..e560fda0 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -58,7 +58,7 @@ static void jabber_init( account_t *acc ) static void jabber_login( account_t *acc ) { - struct im_connection *ic = imc_new( acc ); + struct im_connection *ic = imcb_new( acc ); struct jabber_data *jd = g_new0( struct jabber_data, 1 ); struct ns_srv_reply *srv = NULL; char *connect_to, *s; @@ -71,7 +71,7 @@ static void jabber_login( account_t *acc ) if( jd->server == NULL ) { - imc_error( ic, "Incomplete account name (format it like <username@jabberserver.name>)" ); + imcb_error( ic, "Incomplete account name (format it like <username@jabberserver.name>)" ); imc_logout( ic, FALSE ); return; } @@ -158,12 +158,12 @@ static void jabber_login( account_t *acc ) else connect_to = jd->server; - imc_log( ic, "Connecting" ); + imcb_log( ic, "Connecting" ); if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN || set_getint( &acc->set, "port" ) > JABBER_PORT_MAX ) { - imc_log( ic, "Incorrect port number, must be in the %d-%d range", + imcb_log( ic, "Incorrect port number, must be in the %d-%d range", JABBER_PORT_MIN, JABBER_PORT_MAX ); imc_logout( ic, FALSE ); return; @@ -185,7 +185,7 @@ static void jabber_login( account_t *acc ) if( jd->fd == -1 ) { - imc_error( ic, "Could not connect to server" ); + imcb_error( ic, "Could not connect to server" ); imc_logout( ic, TRUE ); } } @@ -284,7 +284,7 @@ static void jabber_get_info( struct im_connection *ic, char *who ) while( bud ) { - imc_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", + imcb_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", bud->full_jid, bud->priority, bud->away_state ? bud->away_state->full_name : "(none)", bud->away_message ? : "(none)" ); diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index cc237b03..949a7a4b 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -223,7 +223,7 @@ static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla presence_send_request( bla->ic, bla->handle, "subscribed" ); if( find_buddy( bla->ic, bla->handle ) == NULL ) - show_got_added( bla->ic, bla->handle, NULL ); + imcb_ask_add( bla->ic, bla->handle, NULL ); g_free( bla->handle ); g_free( bla ); @@ -246,7 +246,7 @@ void jabber_buddy_ask( struct im_connection *ic, char *handle ) bla->handle = g_strdup( handle ); buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list.", handle ); - do_ask_dialog( ic, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no ); + imcb_ask( ic, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no ); g_free( buf ); } diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c index 634948bf..4007c84e 100644 --- a/protocols/jabber/presence.c +++ b/protocols/jabber/presence.c @@ -40,7 +40,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) ) { if( set_getbool( &ic->irc->set, "debug" ) ) - imc_log( ic, "WARNING: Could not handle presence information from JID: %s", from ); + imcb_log( ic, "WARNING: Could not handle presence information from JID: %s", from ); return XT_HANDLED; } @@ -73,7 +73,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) if( jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) == NULL ) { if( set_getbool( &ic->irc->set, "debug" ) ) - imc_log( ic, "WARNING: Received presence information from unknown JID: %s", from ); + imcb_log( ic, "WARNING: Received presence information from unknown JID: %s", from ); return XT_HANDLED; } @@ -102,7 +102,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) else if( strcmp( type, "subscribed" ) == 0 ) { /* Not sure about this one, actually... */ - imc_log( ic, "%s just accepted your authorization request", from ); + imcb_log( ic, "%s just accepted your authorization request", from ); } else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 ) { diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index cbd40fb1..69199a8b 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -37,14 +37,14 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data ) /* Should abort this now, since we should already be doing IQ authentication. Strange things happen when you try to do both... */ - imc_log( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" ); + imcb_log( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" ); return XT_HANDLED; } s = xt_find_attr( node, "xmlns" ); if( !s || strcmp( s, XMLNS_SASL ) != 0 ) { - imc_log( ic, "Stream error while authenticating" ); + imcb_log( ic, "Stream error while authenticating" ); imc_logout( ic, FALSE ); return XT_ABORT; } @@ -62,7 +62,7 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data ) if( !sup_plain && !sup_digest ) { - imc_error( ic, "No known SASL authentication schemes supported" ); + imcb_error( ic, "No known SASL authentication schemes supported" ); imc_logout( ic, FALSE ); return XT_ABORT; } @@ -279,7 +279,7 @@ xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data ) goto silent_error; error: - imc_error( ic, "Incorrect SASL challenge received" ); + imcb_error( ic, "Incorrect SASL challenge received" ); imc_logout( ic, FALSE ); silent_error: @@ -303,19 +303,19 @@ xt_status sasl_pkt_result( struct xt_node *node, gpointer data ) s = xt_find_attr( node, "xmlns" ); if( !s || strcmp( s, XMLNS_SASL ) != 0 ) { - imc_log( ic, "Stream error while authenticating" ); + imcb_log( ic, "Stream error while authenticating" ); imc_logout( ic, FALSE ); return XT_ABORT; } if( strcmp( node->name, "success" ) == 0 ) { - imc_log( ic, "Authentication finished" ); + imcb_log( ic, "Authentication finished" ); jd->flags |= JFLAG_AUTHENTICATED | JFLAG_STREAM_RESTART; } else if( strcmp( node->name, "failure" ) == 0 ) { - imc_error( ic, "Authentication failure" ); + imcb_error( ic, "Authentication failure" ); imc_logout( ic, FALSE ); return XT_ABORT; } diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index 74a41322..676a8ad7 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -38,7 +38,7 @@ static void msn_init( account_t *acc ) static void msn_login( account_t *acc ) { - struct im_connection *ic = imc_new( acc ); + struct im_connection *ic = imcb_new( acc ); struct msn_data *md = g_new0( struct msn_data, 1 ); ic->proto_data = md; @@ -46,17 +46,17 @@ static void msn_login( account_t *acc ) if( strchr( acc->user, '@' ) == NULL ) { - imc_error( ic, "Invalid account name" ); + imcb_error( ic, "Invalid account name" ); imc_logout( ic, FALSE ); return; } - imc_log( ic, "Connecting" ); + imcb_log( ic, "Connecting" ); md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, ic ); if( md->fd < 0 ) { - imc_error( ic, "Could not connect to server" ); + imcb_error( ic, "Could not connect to server" ); imc_logout( ic, TRUE ); return; } @@ -95,7 +95,7 @@ static void msn_logout( struct im_connection *ic ) { m = l->data; - imc_log( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who ); + imcb_log( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who ); g_free( m->who ); g_free( m->text ); g_free( m ); @@ -227,7 +227,7 @@ static void msn_set_my_name( struct im_connection *ic, char *info ) static void msn_get_info(struct im_connection *ic, char *who) { /* Just make an URL and let the user fetch the info */ - imc_log( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who ); + imcb_log( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who ); } static void msn_add_buddy( struct im_connection *ic, char *who, char *group ) @@ -372,7 +372,7 @@ static char *msn_set_display_name( set_t *set, char *value ) if( strlen( value ) > 129 ) { - imc_log( ic, "Maximum name length exceeded" ); + imcb_log( ic, "Maximum name length exceeded" ); return NULL; } diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index 67e17b08..80f351a2 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -35,7 +35,7 @@ int msn_write( struct im_connection *ic, char *s, int len ) st = write( md->fd, s, len ); if( st != len ) { - imc_error( ic, "Short write() to main server" ); + imcb_error( ic, "Short write() to main server" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -45,7 +45,7 @@ int msn_write( struct im_connection *ic, char *s, int len ) int msn_logged_in( struct im_connection *ic ) { - imc_connected( ic ); + imcb_connected( ic ); return( 0 ); } @@ -94,7 +94,7 @@ static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla ) msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname ); if( find_buddy( bla->ic, bla->handle ) == NULL ) - show_got_added( bla->ic, bla->handle, NULL ); + imcb_ask_add( bla->ic, bla->handle, NULL ); g_free( bla->handle ); g_free( bla->realname ); @@ -122,7 +122,7 @@ void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname ) g_snprintf( buf, sizeof( buf ), "The user %s (%s) wants to add you to his/her buddy list.", handle, realname ); - do_ask_dialog( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no ); + imcb_ask( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no ); } char *msn_findheader( char *text, char *header, int len ) diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 77bb4939..ba428d82 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -46,7 +46,7 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) if( source == -1 ) { - imc_error( ic, "Could not connect to server" ); + imcb_error( ic, "Could not connect to server" ); imc_logout( ic, TRUE ); return FALSE; } @@ -75,7 +75,7 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) if( msn_write( ic, s, strlen( s ) ) ) { ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic ); - imc_log( ic, "Connected to server, waiting for reply" ); + imcb_log( ic, "Connected to server, waiting for reply" ); } return FALSE; @@ -88,7 +88,7 @@ static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition c if( msn_handler( md->handler ) == -1 ) /* Don't do this on ret == 0, it's already done then. */ { - imc_error( ic, "Error while reading from server" ); + imcb_error( ic, "Error while reading from server" ); imc_logout( ic, TRUE ); return FALSE; @@ -113,7 +113,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) { if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 ) { - imc_error( ic, "Unsupported protocol" ); + imcb_error( ic, "Unsupported protocol" ); imc_logout( ic, FALSE ); return( 0 ); } @@ -142,7 +142,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) server = strchr( cmd[3], ':' ); if( !server ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -150,7 +150,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) port = atoi( server + 1 ); server = cmd[3]; - imc_log( ic, "Transferring to other server" ); + imcb_log( ic, "Transferring to other server" ); md->fd = proxy_connect( server, port, msn_ns_connected, ic ); } @@ -161,7 +161,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) server = strchr( cmd[3], ':' ); if( !server ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -171,7 +171,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( strcmp( cmd[4], "CKI" ) != 0 ) { - imc_error( ic, "Unknown authentication method for switchboard" ); + imcb_error( ic, "Unknown authentication method for switchboard" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -203,7 +203,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) } else { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -215,7 +215,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) /* Time for some Passport black magic... */ if( !passport_get_id( msn_auth_got_passport_id, ic, ic->acc->user, ic->acc->pass, cmd[4] ) ) { - imc_error( ic, "Error while contacting Passport server" ); + imcb_error( ic, "Error while contacting Passport server" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -235,14 +235,14 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) s->value = g_strdup( cmd[4] ); } - imc_log( ic, "Authenticated, getting buddy list" ); + imcb_log( ic, "Authenticated, getting buddy list" ); g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId ); return( msn_write( ic, buf, strlen( buf ) ) ); } else { - imc_error( ic, "Unknown authentication type" ); + imcb_error( ic, "Unknown authentication type" ); imc_logout( ic, FALSE ); return( 0 ); } @@ -251,7 +251,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) { if( num_parts != 4 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -260,7 +260,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( md->handler->msglen <= 0 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -291,7 +291,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts != 4 && num_parts != 5 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -327,7 +327,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) { if( ic->flags & OPT_LOGGED_IN ) { - imc_log( ic, "Successfully transferred to different server" ); + imcb_log( ic, "Successfully transferred to different server" ); g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 ); return( msn_write( ic, buf, strlen( buf ) ) ); } @@ -343,7 +343,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts != 4 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -362,7 +362,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts != 3 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -384,7 +384,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts != 6 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -412,7 +412,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts != 5 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -437,7 +437,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts != 7 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -447,7 +447,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) server = strchr( cmd[2], ':' ); if( !server ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -457,7 +457,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( strcmp( cmd[3], "CKI" ) != 0 ) { - imc_error( ic, "Unknown authentication method for switchboard" ); + imcb_error( ic, "Unknown authentication method for switchboard" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -477,7 +477,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( strchr( cmd[4], '@' ) == NULL ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -500,16 +500,16 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 ) { - imc_error( ic, "Someone else logged in with your account" ); + imcb_error( ic, "Someone else logged in with your account" ); allow_reconnect = FALSE; } else if( cmd[1] && strcmp( cmd[1], "SSD" ) == 0 ) { - imc_error( ic, "Terminating session because of server shutdown" ); + imcb_error( ic, "Terminating session because of server shutdown" ); } else { - imc_error( ic, "Session terminated by remote server (reason unknown)" ); + imcb_error( ic, "Session terminated by remote server (reason unknown)" ); } imc_logout( ic, allow_reconnect ); @@ -519,7 +519,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) { if( num_parts != 5 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -547,13 +547,13 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) } else if( strcmp( cmd[0], "IPG" ) == 0 ) { - imc_error( ic, "Received IPG command, we don't handle them yet." ); + imcb_error( ic, "Received IPG command, we don't handle them yet." ); md->handler->msglen = atoi( cmd[1] ); if( md->handler->msglen <= 0 ) { - imc_error( ic, "Syntax error" ); + imcb_error( ic, "Syntax error" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -563,7 +563,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) int num = atoi( cmd[0] ); const struct msn_status_code *err = msn_status_by_number( num ); - imc_error( ic, "Error reported by MSN server: %s", err->text ); + imcb_error( ic, "Error reported by MSN server: %s", err->text ); if( err->flags & STATUS_FATAL ) { @@ -617,7 +617,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int if( mtype && strcmp( mtype, "1" ) == 0 ) { if( arg1 ) - imc_log( ic, "The server is going down for maintenance in %s minutes.", arg1 ); + imcb_log( ic, "The server is going down for maintenance in %s minutes.", arg1 ); } if( arg1 ) g_free( arg1 ); @@ -634,7 +634,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int if( inbox && folders ) { - imc_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); + imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); } } else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) @@ -644,7 +644,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int if( from && fromname ) { - imc_log( ic, "Received an e-mail message from %s <%s>.", fromname, from ); + imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from ); } } else if( g_strncasecmp( ct, "text/x-msmsgsactivemailnotification", 35 ) == 0 ) @@ -672,7 +672,7 @@ static void msn_auth_got_passport_id( struct passport_reply *rep ) if( key == NULL ) { - imc_error( ic, "Error during Passport authentication (%s)", + imcb_error( ic, "Error during Passport authentication (%s)", rep->error_string ? rep->error_string : "Unknown error" ); imc_logout( ic, TRUE ); } diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index f8413856..614fb79c 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -221,7 +221,7 @@ void msn_sb_destroy( struct msn_switchboard *sb ) } g_slist_free( sb->msgq ); - imc_log( ic, "Warning: Closing down MSN switchboard connection with " + imcb_log( ic, "Warning: Closing down MSN switchboard connection with " "unsent message to %s, you'll have to resend it.", sb->who ? sb->who : "(unknown)" ); } @@ -320,7 +320,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts ) if( strcmp( cmd[0], "XFR" ) == 0 ) { - imc_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" ); + imcb_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" ); imc_logout( ic, TRUE ); return( 0 ); } @@ -527,7 +527,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts ) int num = atoi( cmd[0] ); const struct msn_status_code *err = msn_status_by_number( num ); - imc_error( ic, "Error reported by switchboard server: %s", err->text ); + imcb_error( ic, "Error reported by switchboard server: %s", err->text ); if( err->flags & STATUS_SB_FATAL ) { diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 273cc6c8..6121d398 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -144,7 +144,7 @@ GSList *get_connections() { return connections; } /* multi.c */ -struct im_connection *imc_new( account_t *acc ) +struct im_connection *imcb_new( account_t *acc ) { struct im_connection *ic; @@ -203,7 +203,7 @@ static void serv_got_crap( struct im_connection *ic, char *format, ... ) g_free( text ); } -void imc_log( struct im_connection *ic, char *format, ... ) +void imcb_log( struct im_connection *ic, char *format, ... ) { va_list params; char *text; @@ -220,7 +220,7 @@ void imc_log( struct im_connection *ic, char *format, ... ) g_free( text ); } -void imc_error( struct im_connection *ic, char *format, ... ) +void imcb_error( struct im_connection *ic, char *format, ... ) { va_list params; char *text; @@ -247,7 +247,7 @@ static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond ) return TRUE; } -void imc_connected( struct im_connection *ic ) +void imcb_connected( struct im_connection *ic ) { user_t *u; @@ -259,14 +259,14 @@ void imc_connected( struct im_connection *ic ) u = user_find( ic->irc, ic->irc->nick ); - imc_log( ic, "Logged in" ); + imcb_log( ic, "Logged in" ); ic->keepalive = b_timeout_add( 60000, send_keepalive, ic ); ic->flags |= OPT_LOGGED_IN; /* Also necessary when we're not away, at least for some of the protocols. */ - bim_set_away( ic, u->away ); + imc_set_away( ic, u->away ); } gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ) @@ -299,7 +299,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) else ic->flags |= OPT_LOGGING_OUT; - imc_log( ic, "Signing off.." ); + imcb_log( ic, "Signing off.." ); b_event_remove( ic->keepalive ); ic->keepalive = 0; @@ -333,7 +333,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) { int delay = set_getint( &irc->set, "auto_reconnect_delay" ); - imc_log( ic, "Reconnecting in %d seconds..", delay ); + imcb_log( ic, "Reconnecting in %d seconds..", delay ); a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a ); } @@ -343,7 +343,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) /* dialogs.c */ -void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ) +void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ) { query_add( ic->irc, ic, msg, doit, dont, data ); } @@ -359,12 +359,12 @@ void add_buddy( struct im_connection *ic, char *group, char *handle, char *realn irc_t *irc = ic->irc; if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */ - imc_log( ic, "Receiving user add from handle: %s", handle ); + imcb_log( ic, "Receiving user add from handle: %s", handle ); if( user_findhandle( ic, handle ) ) { if( set_getbool( &irc->set, "debug" ) ) - imc_log( ic, "User already exists, ignoring add request: %s", handle ); + imcb_log( ic, "User already exists, ignoring add request: %s", handle ); return; @@ -447,7 +447,7 @@ void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname ) u->realname = g_strdup( realname ); if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) ) - imc_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); + imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); } } @@ -474,7 +474,7 @@ void show_got_added_yes( gpointer w, struct show_got_added_data *data ) return show_got_added_no( w, data ); } -void show_got_added( struct im_connection *ic, char *handle, const char *realname ) +void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ) { struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); char *s; @@ -511,8 +511,8 @@ void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int { if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 ) { - imc_log( ic, "serv_got_update() for handle %s:", handle ); - imc_log( ic, "loggedin = %d, type = %d", loggedin, type ); + imcb_log( ic, "serv_got_update() for handle %s:", handle ); + imcb_log( ic, "loggedin = %d, type = %d", loggedin, type ); } return; @@ -551,15 +551,6 @@ void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int { u->away = g_strdup( "Away" ); } - else if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "jabber" ) == 0 ) ) - { - if( type & UC_DND ) - u->away = g_strdup( "Do Not Disturb" ); - else if( type & UC_XA ) - u->away = g_strdup( "Extended Away" ); - else // if( type & UC_AWAY ) - u->away = g_strdup( "Away" ); - } else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string ) { u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) ); @@ -592,7 +583,7 @@ void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 fla if( g_strcasecmp( h, "ignore" ) == 0 ) { if( set_getbool( &irc->set, "debug" ) ) - imc_log( ic, "Ignoring message from unknown handle %s", handle ); + imcb_log( ic, "Ignoring message from unknown handle %s", handle ); return; } @@ -614,7 +605,7 @@ void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 fla } else { - imc_log( ic, "Message from unknown handle %s:", handle ); + imcb_log( ic, "Message from unknown handle %s:", handle ); u = user_find( irc, irc->mynick ); } } @@ -684,7 +675,7 @@ void serv_got_chat_left( struct groupchat *c ) GList *ir; if( set_getbool( &ic->irc->set, "debug" ) ) - imc_log( ic, "You were removed from conversation 0x%x", (int) c ); + imcb_log( ic, "You were removed from conversation 0x%x", (int) c ); if( c ) { @@ -732,7 +723,7 @@ void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, t if( c && u ) irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", msg ); else - imc_log( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg ); + imcb_log( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg ); } struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle ) @@ -754,7 +745,7 @@ struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle ) c->channel = g_strdup_printf( "&chat_%03d", ic->irc->c_id++ ); if( set_getbool( &ic->irc->set, "debug" ) ) - imc_log( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle ); + imcb_log( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle ); return c; } @@ -768,7 +759,7 @@ void add_chat_buddy( struct groupchat *b, char *handle ) int me = 0; if( set_getbool( &b->ic->irc->set, "debug" ) ) - imc_log( b->ic, "User %s added to conversation 0x%x", handle, (int) b ); + imcb_log( b->ic, "User %s added to conversation 0x%x", handle, (int) b ); /* It might be yourself! */ if( b->ic->acc->prpl->handle_cmp( handle, b->ic->acc->user ) == 0 ) @@ -802,7 +793,7 @@ void remove_chat_buddy( struct groupchat *b, char *handle, char *reason ) int me = 0; if( set_getbool( &b->ic->irc->set, "debug" ) ) - imc_log( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" ); + imcb_log( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" ); /* It might be yourself! */ if( g_strcasecmp( handle, b->ic->acc->user ) == 0 ) @@ -928,7 +919,7 @@ 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 bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags ) +int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags ) { char *buf = NULL; int st; @@ -945,7 +936,7 @@ int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags return st; } -int bim_chat_msg( struct groupchat *c, char *msg, int flags ) +int imc_chat_msg( struct groupchat *c, char *msg, int flags ) { char *buf = NULL; @@ -961,9 +952,9 @@ int bim_chat_msg( struct groupchat *c, char *msg, int flags ) return 1; } -static char *bim_away_alias_find( GList *gcm, char *away ); +static char *imc_away_alias_find( GList *gcm, char *away ); -int bim_set_away( struct im_connection *ic, char *away ) +int imc_set_away( struct im_connection *ic, char *away ) { GList *m, *ms; char *s; @@ -994,12 +985,12 @@ int bim_set_away( struct im_connection *ic, char *away ) } else { - s = bim_away_alias_find( ms, away ); + s = imc_away_alias_find( ms, away ); if( s ) { ic->acc->prpl->set_away( ic, s, away ); if( set_getbool( &ic->irc->set, "debug" ) ) - imc_log( ic, "Setting away state to %s", s ); + imcb_log( ic, "Setting away state to %s", s ); } else ic->acc->prpl->set_away( ic, GAIM_AWAY_CUSTOM, away ); @@ -1008,7 +999,7 @@ int bim_set_away( struct im_connection *ic, char *away ) return( 1 ); } -static char *bim_away_alias_list[8][5] = +static char *imc_away_alias_list[8][5] = { { "Away from computer", "Away", "Extended away", NULL }, { "NA", "N/A", "Not available", NULL }, @@ -1020,28 +1011,28 @@ static char *bim_away_alias_list[8][5] = { NULL } }; -static char *bim_away_alias_find( GList *gcm, char *away ) +static char *imc_away_alias_find( GList *gcm, char *away ) { GList *m; int i, j; - for( i = 0; *bim_away_alias_list[i]; i ++ ) + for( i = 0; *imc_away_alias_list[i]; i ++ ) { - for( j = 0; bim_away_alias_list[i][j]; j ++ ) - if( g_strncasecmp( away, bim_away_alias_list[i][j], strlen( bim_away_alias_list[i][j] ) ) == 0 ) + for( j = 0; imc_away_alias_list[i][j]; j ++ ) + if( g_strncasecmp( away, imc_away_alias_list[i][j], strlen( imc_away_alias_list[i][j] ) ) == 0 ) break; - if( !bim_away_alias_list[i][j] ) /* If we reach the end, this row */ + if( !imc_away_alias_list[i][j] ) /* If we reach the end, this row */ continue; /* is not what we want. Next! */ /* Now find an entry in this row which exists in gcm */ - for( j = 0; bim_away_alias_list[i][j]; j ++ ) + for( j = 0; imc_away_alias_list[i][j]; j ++ ) { m = gcm; while( m ) { - if( g_strcasecmp( bim_away_alias_list[i][j], m->data ) == 0 ) - return( bim_away_alias_list[i][j] ); + if( g_strcasecmp( imc_away_alias_list[i][j], m->data ) == 0 ) + return( imc_away_alias_list[i][j] ); m = m->next; } } @@ -1050,7 +1041,7 @@ static char *bim_away_alias_find( GList *gcm, char *away ) return( NULL ); } -void bim_add_allow( struct im_connection *ic, char *handle ) +void imc_add_allow( struct im_connection *ic, char *handle ) { if( g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL ) { @@ -1060,7 +1051,7 @@ void bim_add_allow( struct im_connection *ic, char *handle ) ic->acc->prpl->add_permit( ic, handle ); } -void bim_rem_allow( struct im_connection *ic, char *handle ) +void imc_rem_allow( struct im_connection *ic, char *handle ) { GSList *l; @@ -1073,7 +1064,7 @@ void bim_rem_allow( struct im_connection *ic, char *handle ) ic->acc->prpl->rem_permit( ic, handle ); } -void bim_add_block( struct im_connection *ic, char *handle ) +void imc_add_block( struct im_connection *ic, char *handle ) { if( g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL ) { @@ -1083,7 +1074,7 @@ void bim_add_block( struct im_connection *ic, char *handle ) ic->acc->prpl->add_deny( ic, handle ); } -void bim_rem_block( struct im_connection *ic, char *handle ) +void imc_rem_block( struct im_connection *ic, char *handle ) { GSList *l; diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 08df1750..cc2dcea4 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -149,7 +149,7 @@ struct prpl { void (* set_permit_deny)(struct im_connection *); /* Request profile info. Free-formatted stuff, the IM module gives back - this info via imc_log(). */ + this info via imcb_log(). */ void (* get_info) (struct im_connection *, char *who); void (* set_my_name) (struct im_connection *, char *name); void (* set_name) (struct im_connection *, char *who, char *name); @@ -174,67 +174,57 @@ struct prpl { #define UC_UNAVAILABLE 1 -/* JABBER */ -#define UC_AWAY (0x02 | UC_UNAVAILABLE) -#define UC_CHAT 0x04 -#define UC_XA (0x08 | UC_UNAVAILABLE) -#define UC_DND (0x10 | UC_UNAVAILABLE) - +/* im_api core stuff. */ +void nogaim_init(); G_MODULE_EXPORT GSList *get_connections(); G_MODULE_EXPORT struct prpl *find_protocol(const char *name); G_MODULE_EXPORT void register_protocol(struct prpl *); -/* nogaim.c */ -int bim_set_away( struct im_connection *ic, char *away ); -int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags ); -int bim_chat_msg( struct groupchat *c, char *msg, int flags ); - -void bim_add_allow( struct im_connection *ic, char *handle ); -void bim_rem_allow( struct im_connection *ic, char *handle ); -void bim_add_block( struct im_connection *ic, char *handle ); -void bim_rem_block( struct im_connection *ic, char *handle ); - -void nogaim_init(); -char *set_eval_away_devoice( set_t *set, char *value ); - -gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); -void cancel_auto_reconnect( struct account *a ); - -/* multi.c */ -G_MODULE_EXPORT struct im_connection *imc_new( account_t *acc ); -G_MODULE_EXPORT void imc_free( struct im_connection *ic ); -G_MODULE_EXPORT void imc_log( struct im_connection *ic, char *format, ... ); -G_MODULE_EXPORT void imc_error( struct im_connection *ic, char *format, ... ); -G_MODULE_EXPORT void imc_connected( struct im_connection *ic ); +/* Connection management. */ +G_MODULE_EXPORT struct im_connection *imcb_new( account_t *acc ); +G_MODULE_EXPORT void imcb_free( struct im_connection *ic ); +G_MODULE_EXPORT void imcb_connected( struct im_connection *ic ); G_MODULE_EXPORT void imc_logout( struct im_connection *ic, int allow_reconnect ); -/* dialogs.c */ -G_MODULE_EXPORT void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ); +/* Communicating with the user. */ +G_MODULE_EXPORT void imcb_log( struct im_connection *ic, char *format, ... ); +G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ); +G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ); +G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); -/* list.c */ -G_MODULE_EXPORT void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname ); -G_MODULE_EXPORT struct buddy *find_buddy( struct im_connection *ic, char *handle ); -G_MODULE_EXPORT void signoff_blocked( struct im_connection *ic ); - -G_MODULE_EXPORT void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname ); - -/* buddy_chat.c */ +/* Groupchats */ G_MODULE_EXPORT void add_chat_buddy( struct groupchat *b, char *handle ); G_MODULE_EXPORT void remove_chat_buddy( struct groupchat *b, char *handle, char *reason ); - -/* prpl.c */ -G_MODULE_EXPORT void show_got_added( struct im_connection *ic, char *handle, const char *realname ); - -/* server.c */ -G_MODULE_EXPORT void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps ); -G_MODULE_EXPORT void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len ); -G_MODULE_EXPORT void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type ); G_MODULE_EXPORT void serv_got_chat_invite( struct im_connection *ic, char *handle, char *who, char *msg, GList *data ); G_MODULE_EXPORT struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle ); G_MODULE_EXPORT void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime ); G_MODULE_EXPORT void serv_got_chat_left( struct groupchat *c ); - struct groupchat *chat_by_channel( char *channel ); struct groupchat *chat_by_id( int id ); +/* Buddy management */ +G_MODULE_EXPORT void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname ); +G_MODULE_EXPORT struct buddy *find_buddy( struct im_connection *ic, char *handle ); +G_MODULE_EXPORT void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname ); + +/* Buddy activity */ +G_MODULE_EXPORT void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps ); +G_MODULE_EXPORT void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len ); +G_MODULE_EXPORT void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type ); + +/* Actions, or whatever. */ +int imc_set_away( struct im_connection *ic, char *away ); +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 ); +void imc_rem_allow( struct im_connection *ic, char *handle ); +void imc_add_block( struct im_connection *ic, char *handle ); +void imc_rem_block( struct im_connection *ic, char *handle ); + +/* Misc. stuff */ +char *set_eval_away_devoice( set_t *set, char *value ); +gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); +void cancel_auto_reconnect( struct account *a ); + #endif diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index 82aa5421..fbf45693 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -53,7 +53,7 @@ aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name) if (cur->type != AIM_CONN_TYPE_CHAT) continue; if (!cur->priv) { - imc_error(sess->aux_data, "chat connection with no name!"); + imcb_error(sess->aux_data, "chat connection with no name!"); continue; } @@ -396,7 +396,7 @@ static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a detaillevel = aimbs_get8(bs); if (detaillevel != 0x02) { - imc_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment"); + imcb_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment"); return 1; } @@ -614,7 +614,7 @@ static int incomingmsg(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, channel = aimbs_get16(bs); if (channel != 0x0003) { - imc_error(sess->aux_data, "unknown channel!"); + imcb_error(sess->aux_data, "unknown channel!"); return 0; } diff --git a/protocols/oscar/chatnav.c b/protocols/oscar/chatnav.c index 05fdf6fa..d94d3c7b 100644 --- a/protocols/oscar/chatnav.c +++ b/protocols/oscar/chatnav.c @@ -285,7 +285,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t tlvlist = aim_readtlvchain(bs); if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) { - imc_error(sess->aux_data, "no bigblock in top tlv in create room response"); + imcb_error(sess->aux_data, "no bigblock in top tlv in create room response"); aim_freetlvchain(&tlvlist); return 0; @@ -300,7 +300,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t detaillevel = aimbs_get8(&bbbs); if (detaillevel != 0x02) { - imc_error(sess->aux_data, "unknown detaillevel in create room response"); + imcb_error(sess->aux_data, "unknown detaillevel in create room response"); aim_freetlvchain(&tlvlist); g_free(ck); return 0; @@ -366,12 +366,12 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai int ret = 0; if (!(snac2 = aim_remsnac(sess, snac->id))) { - imc_error(sess->aux_data, "received response to unknown request!"); + imcb_error(sess->aux_data, "received response to unknown request!"); return 0; } if (snac2->family != 0x000d) { - imc_error(sess->aux_data, "recieved response that maps to corrupt request!"); + imcb_error(sess->aux_data, "recieved response that maps to corrupt request!"); return 0; } @@ -388,7 +388,7 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai else if (snac2->type == 0x0008) /* create room */ ret = parseinfo_create(sess, mod, rx, snac, bs, snac2); else - imc_error(sess->aux_data, "unknown request subtype"); + imcb_error(sess->aux_data, "unknown request subtype"); if (snac2) g_free(snac2->data); diff --git a/protocols/oscar/icq.c b/protocols/oscar/icq.c index d3c7c182..f7c02e04 100644 --- a/protocols/oscar/icq.c +++ b/protocols/oscar/icq.c @@ -239,7 +239,7 @@ static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { aim_freetlvchain(&tl); - imc_error(sess->aux_data, "corrupt ICQ response\n"); + imcb_error(sess->aux_data, "corrupt ICQ response\n"); return 0; } diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index ac3d08d4..51d8ec74 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -936,7 +936,7 @@ static int outgoingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a channel = aimbs_get16(bs); if (channel != 0x01) { - imc_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel. Ignoring."); + imcb_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel. Ignoring."); return 0; } @@ -1344,7 +1344,7 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r args.extdata = aimbs_getraw(bs, args.extdatalen); } else { - // imc_error(sess->aux_data, "Unknown TLV encountered"); + // imcb_error(sess->aux_data, "Unknown TLV encountered"); } /* @@ -1516,7 +1516,7 @@ static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r */ cookie2 = aimbs_getraw(&bbs, 8); if (memcmp(cookie, cookie2, 8) != 0) - imc_error(sess->aux_data, "rend: warning cookies don't match!"); + imcb_error(sess->aux_data, "rend: warning cookies don't match!"); memcpy(args.cookie, cookie2, 8); g_free(cookie2); @@ -1782,7 +1782,7 @@ static int incomingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a } else { - imc_error(sess->aux_data, "ICBM received on an unsupported channel. Ignoring."); + imcb_error(sess->aux_data, "ICBM received on an unsupported channel. Ignoring."); return 0; } diff --git a/protocols/oscar/info.c b/protocols/oscar/info.c index d1ed2059..7cc1dbbc 100644 --- a/protocols/oscar/info.c +++ b/protocols/oscar/info.c @@ -473,7 +473,7 @@ int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t * * */ #ifdef DEBUG - // imc_error(sess->aux_data, G_STRLOC); + // imcb_error(sess->aux_data, G_STRLOC); #endif } @@ -634,7 +634,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim origsnac = aim_remsnac(sess, snac->id); if (!origsnac || !origsnac->data) { - imc_error(sess->aux_data, "major problem: no snac stored!"); + imcb_error(sess->aux_data, "major problem: no snac stored!"); return 0; } @@ -643,7 +643,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { - imc_error(sess->aux_data, "unknown infotype in request!"); + imcb_error(sess->aux_data, "unknown infotype in request!"); return 0; } diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index d95c7068..99f839e4 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -266,7 +266,7 @@ static gboolean oscar_callback(gpointer data, gint source, } else { if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { - imc_error(ic, _("Disconnected.")); + imcb_error(ic, _("Disconnected.")); imc_logout(ic, TRUE); } else if (conn->type == AIM_CONN_TYPE_CHAT) { struct chat_connection *c = find_oscar_chat_by_conn(ic, conn); @@ -276,7 +276,7 @@ static gboolean oscar_callback(gpointer data, gint source, c->inpa = 0; c->fd = -1; aim_conn_kill(odata->sess, &conn); - imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name); + imcb_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { if (odata->cnpa > 0) b_event_remove(odata->cnpa); @@ -287,7 +287,7 @@ static gboolean oscar_callback(gpointer data, gint source, odata->create_rooms = g_slist_remove(odata->create_rooms, cr); g_free(cr); - imc_error(sess->aux_data, _("Chat is currently unavailable")); + imcb_error(sess->aux_data, _("Chat is currently unavailable")); } aim_conn_kill(odata->sess, &conn); } else if (conn->type == AIM_CONN_TYPE_AUTH) { @@ -324,7 +324,7 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); if (source < 0) { - imc_error(ic, _("Couldn't connect to host")); + imcb_error(ic, _("Couldn't connect to host")); imc_logout(ic, TRUE); return FALSE; } @@ -352,7 +352,7 @@ static void oscar_init(account_t *acc) static void oscar_login(account_t *acc) { aim_session_t *sess; aim_conn_t *conn; - struct im_connection *ic = imc_new(acc); + struct im_connection *ic = imcb_new(acc); struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); if (isdigit(acc->user[0])) { @@ -379,23 +379,23 @@ static void oscar_login(account_t *acc) { conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); if (conn == NULL) { - imc_error(ic, _("Unable to login to AIM")); + imcb_error(ic, _("Unable to login to AIM")); imc_logout(ic, TRUE); return; } if (acc->server == NULL) { - imc_error(ic, "No servername specified"); + imcb_error(ic, "No servername specified"); imc_logout(ic, FALSE); return; } if (g_strcasecmp(acc->server, "login.icq.com") != 0 && g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { - imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); + imcb_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); } - imc_log(ic, _("Signon: %s"), ic->acc->user); + imcb_log(ic, _("Signon: %s"), ic->acc->user); aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); @@ -403,7 +403,7 @@ static void oscar_login(account_t *acc) { conn->status |= AIM_CONN_STATUS_INPROGRESS; conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); if (conn->fd < 0) { - imc_error(ic, _("Couldn't connect to host")); + imcb_error(ic, _("Couldn't connect to host")); imc_logout(ic, TRUE); return; } @@ -463,7 +463,7 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition bosconn = odata->conn; if (source < 0) { - imc_error(ic, _("Could Not Connect")); + imcb_error(ic, _("Could Not Connect")); imc_logout(ic, TRUE); return FALSE; } @@ -471,7 +471,7 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition aim_conn_completeconnect(sess, bosconn); ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); - imc_log(ic, _("Connection established, cookie sent")); + imcb_log(ic, _("Connection established, cookie sent")); return FALSE; } @@ -494,23 +494,23 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { switch (info->errorcode) { case 0x05: /* Incorrect nick/password */ - imc_error(ic, _("Incorrect nickname or password.")); + imcb_error(ic, _("Incorrect nickname or password.")); // plugin_event(event_error, (void *)980, 0, 0, 0); break; case 0x11: /* Suspended account */ - imc_error(ic, _("Your account is currently suspended.")); + imcb_error(ic, _("Your account is currently suspended.")); break; case 0x18: /* connecting too frequently */ - imc_error(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); + imcb_error(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; case 0x1c: /* client too old */ - imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); + imcb_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); break; default: - imc_error(ic, _("Authentication Failed")); + imcb_error(ic, _("Authentication Failed")); break; } od->killme = TRUE; @@ -522,7 +522,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); if (bosconn == NULL) { - imc_error(ic, _("Internal Error")); + imcb_error(ic, _("Internal Error")); od->killme = TRUE; return 0; } @@ -568,7 +568,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic); g_free(host); if (bosconn->fd < 0) { - imc_error(ic, _("Could Not Connect")); + imcb_error(ic, _("Could Not Connect")); od->killme = TRUE; return 0; } @@ -606,7 +606,7 @@ static gboolean damn_you(gpointer data, gint source, b_input_condition c) in = '\0'; } if (in != '\n') { - imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." + imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly."); b_event_remove(pos->inpa); closesocket(pos->fd); @@ -629,7 +629,7 @@ static gboolean straight_to_hell(gpointer data, gint source, b_input_condition c char buf[BUF_LONG]; if (source < 0) { - imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." + imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly."); if (pos->modname) g_free(pos->modname); @@ -707,7 +707,7 @@ int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { if (pos->modname) g_free(pos->modname); g_free(pos); - imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." + imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly."); } pos->fd = fd; @@ -1111,7 +1111,7 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ inv->exchange = *exch; inv->name = g_strdup(name); - do_ask_dialog( ic, txt, inv, oscar_accept_chat, oscar_reject_chat); + imcb_ask( ic, txt, inv, oscar_accept_chat, oscar_reject_chat); if (name) g_free(name); @@ -1129,7 +1129,7 @@ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); if(find_buddy(data->ic, uin) == NULL) - show_got_added(data->ic, uin, NULL); + imcb_ask_add(data->ic, uin, NULL); g_free(uin); g_free(data); @@ -1163,7 +1163,7 @@ static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) { dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given."); data->ic = ic; data->uin = uin; - do_ask_dialog(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); + imcb_ask(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); g_free(dialog_msg); } @@ -1206,11 +1206,11 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } break; case 0x0007: { /* Someone has denied you authorization */ - imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); } break; case 0x0008: { /* Someone has granted you authorization */ - imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); } break; case 0x0012: { @@ -1276,7 +1276,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { switch(reason) { case 0: /* Invalid (0) */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was invalid.") : _("You missed %d messages from %s because they were invalid."), @@ -1285,7 +1285,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 1: /* Message too large */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was too large.") : _("You missed %d messages from %s because they were too large."), @@ -1294,7 +1294,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 2: /* Rate exceeded */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because the rate limit has been exceeded.") : _("You missed %d messages from %s because the rate limit has been exceeded."), @@ -1303,7 +1303,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 3: /* Evil Sender */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was too evil.") : _("You missed %d messages from %s because they are too evil."), @@ -1312,7 +1312,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 4: /* Evil Receiver */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because you are too evil.") : _("You missed %d messages from %s because you are too evil."), @@ -1320,7 +1320,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { userinfo->sn); break; default: - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s for unknown reasons.") : _("You missed %d messages from %s for unknown reasons."), @@ -1340,7 +1340,7 @@ static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { reason = (guint16)va_arg(ap, unsigned int); va_end(ap); - imc_error(sess->aux_data, _("SNAC threw error: %s"), + imcb_error(sess->aux_data, _("SNAC threw error: %s"), reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); return 1; @@ -1356,7 +1356,7 @@ static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { destn = va_arg(ap, char *); va_end(ap); - imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn, + imcb_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); return 1; @@ -1372,7 +1372,7 @@ static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { destn = va_arg(ap, char *); va_end(ap); - imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn, + imcb_error(sess->aux_data, _("User information for %s unavailable: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); return 1; @@ -1389,7 +1389,7 @@ static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { va_end(ap); if (id < 4) - imc_error(sess->aux_data, _("Your connection may be lost.")); + imcb_error(sess->aux_data, _("Your connection may be lost.")); return 1; } @@ -1583,7 +1583,7 @@ static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { } else if (code == AIM_RATE_CODE_WARNING) { aim_conn_setlatency(fr->conn, windowsize/4); } else if (code == AIM_RATE_CODE_LIMIT) { - imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. " + imcb_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. " "Please wait 10 seconds and try again.")); aim_conn_setlatency(fr->conn, windowsize/2); } else if (code == AIM_RATE_CODE_CLEARLIMIT) { @@ -1788,11 +1788,11 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { } break; case 0x0007: { /* Someone has denied you authorization */ - imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); } break; case 0x0008: { /* Someone has granted you authorization */ - imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); } break; case 0x0012: { @@ -1905,7 +1905,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, } /* else... */ if (od->rights.maxawaymsglen == 0) - imc_error(ic, "oscar_set_away_aim called before locate rights received"); + imcb_error(ic, "oscar_set_away_aim called before locate rights received"); aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); @@ -1919,7 +1919,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, } if (strlen(message) > od->rights.maxawaymsglen) { - imc_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); + imcb_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); } ic->away = g_strndup(message, od->rights.maxawaymsglen); @@ -2083,7 +2083,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { aim_icq_reqofflinemsgs(sess); /* Now that we have a buddy list, we can tell BitlBee that we're online. */ - imc_connected(ic); + imcb_connected(ic); return 1; } @@ -2105,7 +2105,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) if( count & 1 ) { /* Hmm, the length should be even... */ - imc_error( sess->aux_data, "Received SSI ACK package with non-even length"); + imcb_error( sess->aux_data, "Received SSI ACK package with non-even length"); return( 0 ); } count >>= 1; @@ -2116,7 +2116,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) st = aimbs_get16( &fr->data ); if( st == 0x0E ) { - imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); + imcb_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); aim_ssi_auth_request( sess, fr->conn, list, "" ); aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); @@ -2302,7 +2302,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) g_string_sprintfa(str, "\n"); } - imc_log(ic, "%s\n%s", _("User Info"), str->str); + imcb_log(ic, "%s\n%s", _("User Info"), str->str); g_string_free(str, TRUE); return 1; @@ -2396,18 +2396,18 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...) idletime.tm_min = userinfo->idletime % 60; idletime.tm_sec = 0; strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime); - imc_log(ic, "%s: %s", _("Idle Time"), buff); + imcb_log(ic, "%s: %s", _("Idle Time"), buff); } if(text) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - imc_log(ic, "%s\n%s", _("User Info"), utf8); + imcb_log(ic, "%s\n%s", _("User Info"), utf8); } else { - imc_log(ic, _("No user info available.")); + imcb_log(ic, _("No user info available.")); } } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - imc_log(ic, "%s\n%s", _("Away Message"), utf8); + imcb_log(ic, "%s\n%s", _("Away Message"), utf8); } g_free(utf8); diff --git a/protocols/oscar/rxqueue.c b/protocols/oscar/rxqueue.c index b5a83be8..34f389af 100644 --- a/protocols/oscar/rxqueue.c +++ b/protocols/oscar/rxqueue.c @@ -391,7 +391,7 @@ int aim_get_command(aim_session_t *sess, aim_conn_t *conn) aim_bstream_rewind(&flaphdr); start = aimbs_get8(&flaphdr); - imc_error(sess->aux_data, "FLAP framing disrupted"); + imcb_error(sess->aux_data, "FLAP framing disrupted"); aim_conn_close(conn); return -1; } diff --git a/protocols/oscar/search.c b/protocols/oscar/search.c index c557e35f..3570e4df 100644 --- a/protocols/oscar/search.c +++ b/protocols/oscar/search.c @@ -38,7 +38,7 @@ static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_mo /* XXX the modules interface should have already retrieved this for us */ if (!(snac2 = aim_remsnac(sess, snac->id))) { - imc_error(sess->aux_data, "couldn't get snac"); + imcb_error(sess->aux_data, "couldn't get snac"); return 0; } diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index 69d53d00..3a180780 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -566,7 +566,7 @@ static int migrate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_ group = aimbs_get16(bs); - imc_error(sess->aux_data, "bifurcated migration unsupported"); + imcb_error(sess->aux_data, "bifurcated migration unsupported"); } tl = aim_readtlvchain(bs); @@ -893,7 +893,7 @@ int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guin aimbs_put32(&fr->data, 0xecf8427e); */ } else - imc_error(sess->aux_data, "WARNING: unknown hash request"); + imcb_error(sess->aux_data, "WARNING: unknown hash request"); } diff --git a/protocols/oscar/txqueue.c b/protocols/oscar/txqueue.c index bd8db49d..4416025a 100644 --- a/protocols/oscar/txqueue.c +++ b/protocols/oscar/txqueue.c @@ -29,7 +29,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g aim_frame_t *fr; if (!conn) { - imc_error(sess->aux_data, "no connection specified"); + imcb_error(sess->aux_data, "no connection specified"); return NULL; } @@ -45,7 +45,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g fr->hdr.flap.type = chan; } else - imc_error(sess->aux_data, "unknown framing"); + imcb_error(sess->aux_data, "unknown framing"); if (datalen > 0) { guint8 *data; @@ -79,7 +79,7 @@ static int aim_tx_enqueue__queuebased(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { - imc_error(sess->aux_data, "WARNING: enqueueing packet with no connection"); + imcb_error(sess->aux_data, "WARNING: enqueueing packet with no connection"); fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS); } @@ -119,7 +119,7 @@ static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { - imc_error(sess->aux_data, "packet has no connection"); + imcb_error(sess->aux_data, "packet has no connection"); aim_frame_destroy(fr); return 0; } diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index ae66b209..e380d0ae 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -122,13 +122,13 @@ static char *byahoo_strip( char *in ) static void byahoo_login( account_t *acc ) { - struct im_connection *ic = imc_new( acc ); + struct im_connection *ic = imcb_new( acc ); struct byahoo_data *yd = ic->proto_data = g_new0( struct byahoo_data, 1 ); yd->logged_in = FALSE; yd->current_status = YAHOO_STATUS_AVAILABLE; - imc_log( ic, "Connecting" ); + imcb_log( ic, "Connecting" ); yd->y2_id = yahoo_init( acc->user, acc->pass ); yahoo_login( yd->y2_id, yd->current_status ); } @@ -162,7 +162,7 @@ static void byahoo_logout( struct im_connection *ic ) static void byahoo_get_info(struct im_connection *ic, char *who) { /* Just make an URL and let the user fetch the info */ - imc_log(ic, "%s\n%s: %s%s", _("User Info"), + imcb_log(ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), yahoo_get_profile_url(), who); } @@ -509,7 +509,7 @@ void ext_yahoo_login_response( int id, int succ, char *url ) if( succ == YAHOO_LOGIN_OK ) { - imc_connected( ic ); + imcb_connected( ic ); yd->logged_in = TRUE; } @@ -537,9 +537,9 @@ void ext_yahoo_login_response( int id, int succ, char *url ) errstr = "Unknown error"; if( url && *url ) - imc_error( ic, "Error %d (%s). See %s for more information.", succ, errstr, url ); + imcb_error( ic, "Error %d (%s). See %s for more information.", succ, errstr, url ); else - imc_error( ic, "Error %d (%s)", succ, errstr ); + imcb_error( ic, "Error %d (%s)", succ, errstr ); imc_logout( ic, allow_reconnect ); } @@ -604,7 +604,7 @@ void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg, { struct im_connection *ic = byahoo_get_ic_by_id( id ); - imc_log( ic, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who ); + imcb_log( ic, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who ); } void ext_yahoo_typing_notify( int id, char *who, int stat ) @@ -624,21 +624,21 @@ void ext_yahoo_system_message( int id, char *msg ) { struct im_connection *ic = byahoo_get_ic_by_id( id ); - imc_log( ic, "Yahoo! system message: %s", msg ); + imcb_log( ic, "Yahoo! system message: %s", msg ); } void ext_yahoo_webcam_invite( int id, char *from ) { struct im_connection *ic = byahoo_get_ic_by_id( id ); - imc_log( ic, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from ); + imcb_log( ic, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from ); } void ext_yahoo_error( int id, char *err, int fatal ) { struct im_connection *ic = byahoo_get_ic_by_id( id ); - imc_error( ic, "%s", err ); + imcb_error( ic, "%s", err ); if( fatal ) imc_logout( ic, TRUE ); @@ -802,14 +802,14 @@ void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", room, who, msg ); - do_ask_dialog( ic, txt, inv, byahoo_accept_conf, byahoo_reject_conf ); + imcb_ask( ic, txt, inv, byahoo_accept_conf, byahoo_reject_conf ); } void ext_yahoo_conf_userdecline( int id, char *who, char *room, char *msg ) { struct im_connection *ic = byahoo_get_ic_by_id( id ); - imc_log( ic, "Invite to chatroom %s rejected by %s: %s", room, who, msg ); + imcb_log( ic, "Invite to chatroom %s rejected by %s: %s", room, who, msg ); } void ext_yahoo_conf_userjoin( int id, char *who, char *room ) @@ -892,9 +892,9 @@ void ext_yahoo_mail_notify( int id, char *from, char *subj, int cnt ) struct im_connection *ic = byahoo_get_ic_by_id( id ); if( from && subj ) - imc_log( ic, "Received e-mail message from %s with subject `%s'", from, subj ); + imcb_log( ic, "Received e-mail message from %s with subject `%s'", from, subj ); else if( cnt > 0 ) - imc_log( ic, "Received %d new e-mails", cnt ); + imcb_log( ic, "Received %d new e-mails", cnt ); } void ext_yahoo_webcam_invite_reply( int id, char *from, int accept ) @@ -121,7 +121,7 @@ void query_del_by_conn( irc_t *irc, struct im_connection *ic ) } if( count > 0 ) - imc_log( ic, "Flushed %d unanswered question(s) for this connection.", count ); + imcb_log( ic, "Flushed %d unanswered question(s) for this connection.", count ); q = query_default( irc ); if( q && q != def ) @@ -139,12 +139,12 @@ void query_answer( irc_t *irc, query_t *q, int ans ) } if( ans ) { - imc_log( q->ic, "Accepted: %s", q->question ); + imcb_log( q->ic, "Accepted: %s", q->question ); q->yes( NULL, q->data ); } else { - imc_log( q->ic, "Rejected: %s", q->question ); + imcb_log( q->ic, "Rejected: %s", q->question ); q->no( NULL, q->data ); } q->data = NULL; @@ -159,7 +159,7 @@ static void query_display( irc_t *irc, query_t *q ) { if( q->ic ) { - imc_log( q->ic, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question ); + imcb_log( q->ic, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question ); } else { diff --git a/root_commands.c b/root_commands.c index 0b3d6844..acbf579f 100644 --- a/root_commands.c +++ b/root_commands.c @@ -633,8 +633,8 @@ static void cmd_block( irc_t *irc, char **cmd ) } else { - bim_rem_allow( ic, cmd[2] ); - bim_add_block( ic, cmd[2] ); + imc_rem_allow( ic, cmd[2] ); + imc_add_block( ic, cmd[2] ); irc_usermsg( irc, "Buddy `%s' moved from your allow- to your block-list", cmd[2] ); } } @@ -692,8 +692,8 @@ static void cmd_allow( irc_t *irc, char **cmd ) } else { - bim_rem_block( ic, cmd[2] ); - bim_add_allow( ic, cmd[2] ); + imc_rem_block( ic, cmd[2] ); + imc_add_allow( ic, cmd[2] ); irc_usermsg( irc, "Buddy `%s' moved from your block- to your allow-list", cmd[2] ); } |