From 796da03f9f54f8fb193529288592571b371bf0cd Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 5 Oct 2009 00:28:11 +0100 Subject: Something that compiles and runs, but otherwise utterly useless. Added a protocols/purple/ module and included it in the build system. Already picks up all the supported protocols and adds them individually. --- protocols/nogaim.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index fd445324..8eae178d 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -117,6 +117,7 @@ void nogaim_init() extern void oscar_initmodule(); extern void byahoo_initmodule(); extern void jabber_initmodule(); + extern void purple_initmodule(); #ifdef WITH_MSN msn_initmodule(); @@ -133,6 +134,10 @@ void nogaim_init() #ifdef WITH_JABBER jabber_initmodule(); #endif + +#ifdef WITH_PURPLE + purple_initmodule(); +#endif #ifdef WITH_PLUGINS load_plugins(); -- cgit v1.2.3 From e248c7ff061e1582ed4c2919de6d615c1813e87a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 12 Oct 2009 23:23:49 +0100 Subject: Automatically try prpl-$proto if $proto doesn't exist, and disable native protocol modules if purple is enabled; they don't go together very well. --- protocols/nogaim.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 8eae178d..7e8782ac 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -101,12 +101,23 @@ void register_protocol (struct prpl *p) struct prpl *find_protocol(const char *name) { GList *gl; - for (gl = protocols; gl; gl = gl->next) + + for( gl = protocols; gl; gl = gl->next ) { struct prpl *proto = gl->data; - if(!g_strcasecmp(proto->name, name)) + + if( g_strcasecmp( proto->name, name ) == 0 ) return proto; + +#ifdef WITH_PURPLE + /* I know, hardcoding is evil, but that doesn't make it + impossible. :-) */ + if( g_strncasecmp( proto->name, "prpl-", 5 ) == 0 && + g_strcasecmp( proto->name + 5, name ) == 0 ) + return proto; +#endif } + return NULL; } -- cgit v1.2.3 From cd741d8e2bb0b7d08cf36d90f5332a639f190281 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 23 Nov 2009 23:23:37 +0000 Subject: Fixed compatibility with non-libpurple version: oscar is now recognized as a protocol name, and removed prpl- hack from nogaim.c. --- protocols/nogaim.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index c0d4a953..f80653ff 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -110,14 +110,6 @@ struct prpl *find_protocol(const char *name) if( g_strcasecmp( proto->name, name ) == 0 ) return proto; - -#ifdef WITH_PURPLE - /* I know, hardcoding is evil, but that doesn't make it - impossible. :-) */ - if( g_strncasecmp( proto->name, "prpl-", 5 ) == 0 && - g_strcasecmp( proto->name + 5, name ) == 0 ) - return proto; -#endif } return NULL; -- cgit v1.2.3 From 10a96f44efbeb6af09e2728926ce15b6bda12131 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 29 Mar 2010 08:25:01 -0400 Subject: Start restoring IM-related bits, added bee_user.c with basic functions and UI callbacks. --- protocols/nogaim.c | 59 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index c326e378..618616c7 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -198,8 +198,8 @@ static void serv_got_crap( struct im_connection *ic, char *format, ... ) text = g_strdup_vprintf( format, params ); va_end( params ); - if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) + if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || + ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) strip_html( text ); /* Try to find a different connection on the same protocol. */ @@ -264,7 +264,6 @@ void imcb_connected( struct im_connection *ic ) { irc_t *irc = ic->irc; struct chat *c; - user_t *u; /* MSN servers sometimes redirect you to a different server and do the whole login sequence again, so these "late" calls to this @@ -272,8 +271,6 @@ void imcb_connected( struct im_connection *ic ) if( ic->flags & OPT_LOGGED_IN ) return; - u = user_find( ic->irc, ic->irc->nick ); - imcb_log( ic, "Logged in" ); ic->keepalive = b_timeout_add( 60000, send_keepalive, ic ); @@ -286,6 +283,7 @@ void imcb_connected( struct im_connection *ic ) exponential backoff timer. */ ic->acc->auto_reconnect_delay = 0; + /* for( c = irc->chatrooms; c; c = c->next ) { if( c->acc != ic->acc ) @@ -294,6 +292,7 @@ void imcb_connected( struct im_connection *ic ) if( set_getbool( &c->set, "auto_join" ) ) chat_join( irc, c, NULL ); } + */ } gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ) @@ -359,7 +358,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) { /* Uhm... This is very sick. */ } - else if( allow_reconnect && set_getbool( &irc->set, "auto_reconnect" ) && + else if( allow_reconnect && set_getbool( &irc->b->set, "auto_reconnect" ) && set_getbool( &a->set, "auto_reconnect" ) && ( delay = account_reconnect_delay( a ) ) > 0 ) { @@ -390,7 +389,7 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g if( user_findhandle( ic, handle ) ) { - if( set_getbool( &irc->set, "debug" ) ) + if( set_getbool( &irc->b->set, "debug" ) ) imcb_log( ic, "User already exists, ignoring add request: %s", handle ); return; @@ -469,7 +468,7 @@ void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char u->realname = g_strdup( realname ); - if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) ) + if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->b->set, "display_namechanges" ) ) imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); } @@ -517,7 +516,7 @@ void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const c /* Some processing to make sure this string is a valid IRC nickname. */ nick_strip( newnick ); - if( set_getbool( &ic->irc->set, "lcnicks" ) ) + if( set_getbool( &ic->irc->b->set, "lcnicks" ) ) nick_lc( newnick ); if( strcmp( u->nick, newnick ) != 0 ) @@ -625,14 +624,14 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, if( !u ) { - if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 ) + if( g_strcasecmp( set_getstr( &ic->irc->b->set, "handle_unknown" ), "add" ) == 0 ) { imcb_add_buddy( ic, (char*) handle, NULL ); u = user_findhandle( ic, (char*) handle ); } else { - if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 ) + if( set_getbool( &ic->irc->b->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->b->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, @@ -692,14 +691,14 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, } /* LISPy... */ - if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ + if( ( set_getbool( &ic->irc->b->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->irc->set, "simulate_netsplit" ) ) + if( set_getbool( &ic->irc->b->set, "simulate_netsplit" ) ) { from = g_strdup( ic->irc->myhost ); } @@ -724,18 +723,18 @@ void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, ui if( !u ) { - char *h = set_getstr( &irc->set, "handle_unknown" ); + char *h = set_getstr( &irc->b->set, "handle_unknown" ); if( g_strcasecmp( h, "ignore" ) == 0 ) { - if( set_getbool( &irc->set, "debug" ) ) + if( set_getbool( &irc->b->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( &irc->set, "private" ); + int private = set_getbool( &irc->b->set, "private" ); if( h[3] ) { @@ -756,8 +755,8 @@ void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, ui } } - if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) + if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || + ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) strip_html( msg ); wrapped = word_wrap( msg, 425 ); @@ -769,7 +768,7 @@ void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags ) { user_t *u; - if( !set_getbool( &ic->irc->set, "typing_notice" ) ) + if( !set_getbool( &ic->irc->b->set, "typing_notice" ) ) return; if( ( u = user_findhandle( ic, handle ) ) ) @@ -800,7 +799,7 @@ struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) c->channel = g_strdup_printf( "&chat_%03d", ic->irc->c_id++ ); c->topic = g_strdup_printf( "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", c->title ); - if( set_getbool( &ic->irc->set, "debug" ) ) + if( set_getbool( &ic->irc->b->set, "debug" ) ) imcb_log( ic, "Creating new conversation: (id=%p,handle=%s)", c, handle ); return c; @@ -812,7 +811,7 @@ void imcb_chat_free( struct groupchat *c ) struct groupchat *l; GList *ir; - if( set_getbool( &ic->irc->set, "debug" ) ) + if( set_getbool( &ic->irc->b->set, "debug" ) ) imcb_log( ic, "You were removed from conversation %p", c ); if( c ) @@ -859,8 +858,8 @@ void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t fl u = user_findhandle( ic, who ); - if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) + if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || + ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) strip_html( msg ); wrapped = word_wrap( msg, 425 ); @@ -905,8 +904,8 @@ void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at else u = user_findhandle( ic, who ); - if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) + if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || + ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) strip_html( topic ); g_free( c->topic ); @@ -924,7 +923,7 @@ void imcb_chat_add_buddy( struct groupchat *b, const char *handle ) user_t *u = user_findhandle( b->ic, handle ); int me = 0; - if( set_getbool( &b->ic->irc->set, "debug" ) ) + if( set_getbool( &b->ic->irc->b->set, "debug" ) ) imcb_log( b->ic, "User %s added to conversation %p", handle, b ); /* It might be yourself! */ @@ -959,7 +958,7 @@ void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char user_t *u; int me = 0; - if( set_getbool( &b->ic->irc->set, "debug" ) ) + if( set_getbool( &b->ic->irc->b->set, "debug" ) ) imcb_log( b->ic, "User %s removed from conversation %p (%s)", handle, b, reason ? reason : "" ); /* It might be yourself! */ @@ -1017,7 +1016,7 @@ char *set_eval_away_devoice( set_t *set, char *value ) /* Horror.... */ - if( st != set_getbool( &irc->set, "away_devoice" ) ) + if( st != set_getbool( &irc->b->set, "away_devoice" ) ) { char list[80] = ""; user_t *u = irc->users; @@ -1106,7 +1105,7 @@ int imc_away_send_update( struct im_connection *ic ) char *away, *msg = NULL; away = set_getstr( &ic->acc->set, "away" ) ? - : set_getstr( &ic->irc->set, "away" ); + : set_getstr( &ic->irc->b->set, "away" ); if( away && *away ) { GList *m = ic->acc->prpl->away_states( ic ); @@ -1117,7 +1116,7 @@ int imc_away_send_update( struct im_connection *ic ) { away = NULL; msg = set_getstr( &ic->acc->set, "status" ) ? - : set_getstr( &ic->irc->set, "status" ); + : set_getstr( &ic->irc->b->set, "status" ); } ic->acc->prpl->set_away( ic, away, msg ); -- cgit v1.2.3 From 81e04e162bdc4517b2f357fd16dfd76f68245464 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 31 Mar 2010 22:32:25 -0400 Subject: nogaim.c is close to doing something useful again without speaking any IRC itself. --- protocols/nogaim.c | 247 +++++++++++++++++++++++------------------------------ 1 file changed, 108 insertions(+), 139 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 618616c7..2edc8e75 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -91,8 +91,6 @@ void load_plugins(void) } #endif -/* nogaim.c */ - GList *protocols = NULL; void register_protocol (struct prpl *p) @@ -124,7 +122,6 @@ struct prpl *find_protocol(const char *name) return NULL; } -/* nogaim.c */ void nogaim_init() { extern void msn_initmodule(); @@ -155,15 +152,13 @@ void nogaim_init() GSList *get_connections() { return connections; } -/* multi.c */ - struct im_connection *imcb_new( account_t *acc ) { struct im_connection *ic; ic = g_new0( struct im_connection, 1 ); - ic->irc = acc->irc; + ic->bee = acc->bee; ic->acc = acc; acc->ic = ic; @@ -177,7 +172,7 @@ void imc_free( struct im_connection *ic ) account_t *a; /* Destroy the pointer to this connection from the account list */ - for( a = ic->irc->accounts; a; a = a->next ) + for( a = ic->bee->accounts; a; a = a->next ) if( a->ic == ic ) { a->ic = NULL; @@ -198,20 +193,21 @@ static void serv_got_crap( struct im_connection *ic, char *format, ... ) text = g_strdup_vprintf( format, params ); va_end( params ); - if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) + 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( text ); /* Try to find a different connection on the same protocol. */ - for( a = ic->irc->accounts; a; a = a->next ) + for( a = ic->bee->accounts; a; a = a->next ) if( a->prpl == ic->acc->prpl && a->ic != ic ) break; /* If we found one, include the screenname in the message. */ if( a ) - irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); + /* FIXME(wilmer): ui_log callback or so */ + irc_usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); else - irc_usermsg( ic->irc, "%s - %s", ic->acc->prpl->name, text ); + irc_usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text ); g_free( text ); } @@ -262,9 +258,6 @@ static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond ) void imcb_connected( struct im_connection *ic ) { - irc_t *irc = ic->irc; - struct chat *c; - /* MSN servers sometimes redirect you to a different server and do the whole login sequence again, so these "late" calls to this function should be handled correctly. (IOW, ignored) */ @@ -300,7 +293,7 @@ gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ) account_t *a = data; a->reconnect = 0; - account_on( a->irc, a ); + account_on( a->bee, a ); return( FALSE ); /* Only have to run the timeout once */ } @@ -313,9 +306,9 @@ void cancel_auto_reconnect( account_t *a ) void imc_logout( struct im_connection *ic, int allow_reconnect ) { - irc_t *irc = ic->irc; - user_t *t, *u; + bee_t *bee = ic->bee; account_t *a; + GSList *l; int delay; /* Nested calls might happen sometimes, this is probably the best @@ -335,22 +328,17 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) g_free( ic->away ); ic->away = NULL; - u = irc->users; - while( u ) + for( l = bee->users; l; l = l->next ) { - if( u->ic == ic ) - { - t = u->next; - user_del( irc, u->nick ); - u = t; - } - else - u = u->next; + bee_user_t *bu = l->data; + + if( bu->ic == ic ) + bee_user_free( bee, ic, bu->handle ); } - query_del_by_conn( ic->irc, ic ); + //query_del_by_conn( ic->irc, ic ); - for( a = irc->accounts; a; a = a->next ) + for( a = bee->accounts; a; a = a->next ) if( a->ic == ic ) break; @@ -358,7 +346,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) { /* Uhm... This is very sick. */ } - else if( allow_reconnect && set_getbool( &irc->b->set, "auto_reconnect" ) && + else if( allow_reconnect && set_getbool( &bee->set, "auto_reconnect" ) && set_getbool( &a->set, "auto_reconnect" ) && ( delay = account_reconnect_delay( a ) ) > 0 ) { @@ -369,27 +357,21 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) imc_free( ic ); } - -/* dialogs.c */ - void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ) { - query_add( ic->irc, ic, msg, doit, dont, data ); + //query_add( ic->irc, ic, msg, doit, dont, data ); } - -/* list.c */ - void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group ) { - user_t *u; - char nick[MAX_NICK_LENGTH+1], *s; - irc_t *irc = ic->irc; + bee_user_t *bu; + //char nick[MAX_NICK_LENGTH+1], *s; + bee_t *bee = ic->bee; - if( user_findhandle( ic, handle ) ) + if( bee_user_by_handle( bee, ic, handle ) ) { - if( set_getbool( &irc->b->set, "debug" ) ) + if( set_getbool( &bee->set, "debug" ) ) imcb_log( ic, "User already exists, ignoring add request: %s", handle ); return; @@ -400,63 +382,13 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g even support groups so let's silently ignore this for now. */ } - memset( nick, 0, MAX_NICK_LENGTH + 1 ); - strcpy( nick, nick_get( ic->acc, handle ) ); - - u = user_add( ic->irc, nick ); - -// if( !realname || !*realname ) realname = nick; -// u->realname = g_strdup( realname ); - - if( ( s = strchr( handle, '@' ) ) ) - { - u->host = g_strdup( s + 1 ); - u->user = g_strndup( handle, s - handle ); - } - else if( ic->acc->server ) - { - u->host = g_strdup( ic->acc->server ); - u->user = g_strdup( handle ); - - /* s/ /_/ ... important for AOL screennames */ - for( s = u->user; *s; s ++ ) - if( *s == ' ' ) - *s = '_'; - } - else - { - u->host = g_strdup( ic->acc->prpl->name ); - u->user = g_strdup( handle ); - } - - u->ic = ic; - u->handle = g_strdup( handle ); - if( group ) u->group = g_strdup( group ); - u->send_handler = buddy_send_handler; - u->last_typing_notice = 0; -} - -struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle ) -{ - static struct buddy b[1]; - user_t *u; - - u = user_findhandle( ic, handle ); - - if( !u ) - return( NULL ); - - memset( b, 0, sizeof( b ) ); - strncpy( b->name, handle, 80 ); - strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN ); - b->present = u->online; - b->ic = u->ic; - - return( b ); + bu = bee_user_new( bee, ic, handle ); + bu->group = g_strdup( group ); } void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname ) { +#if 0 user_t *u = user_findhandle( ic, handle ); char *set; @@ -468,7 +400,7 @@ void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char u->realname = g_strdup( realname ); - if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->b->set, "display_namechanges" ) ) + if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->bee->set, "display_namechanges" ) ) imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); } @@ -488,20 +420,19 @@ void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char g_free( name ); } +#endif } void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group ) { - user_t *u; - - if( ( u = user_findhandle( ic, handle ) ) ) - user_del( ic->irc, u->nick ); + bee_user_free( ic->bee, ic, handle ); } /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM modules to suggest a nickname for a handle. */ void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick ) { +#if 0 user_t *u = user_findhandle( ic, handle ); char newnick[MAX_NICK_LENGTH+1], *orig_nick; @@ -516,7 +447,7 @@ void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const c /* Some processing to make sure this string is a valid IRC nickname. */ nick_strip( newnick ); - if( set_getbool( &ic->irc->b->set, "lcnicks" ) ) + if( set_getbool( &ic->bee->set, "lcnicks" ) ) nick_lc( newnick ); if( strcmp( u->nick, newnick ) != 0 ) @@ -533,6 +464,7 @@ void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const c g_free( orig_nick ); } } +#endif } @@ -564,6 +496,7 @@ static void imcb_ask_auth_cb_yes( void *data ) void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) { +#if 0 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); char *s, *realname_ = NULL; @@ -578,6 +511,7 @@ void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *re data->ic = ic; data->handle = g_strdup( handle ); query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); +#endif } @@ -598,6 +532,7 @@ static void imcb_ask_add_cb_yes( void *data ) void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) { +#if 0 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); char *s; @@ -610,28 +545,23 @@ void imcb_ask_add( struct im_connection *ic, const char *handle, const char *rea data->ic = ic; data->handle = g_strdup( handle ); query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); +#endif } - -/* server.c */ - void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message ) { - user_t *u; - int oa, oo; - - u = user_findhandle( ic, (char*) handle ); + bee_t *bee = ic->bee; + bee_user_t *bu, *old; - if( !u ) + if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) { - if( g_strcasecmp( set_getstr( &ic->irc->b->set, "handle_unknown" ), "add" ) == 0 ) + if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "add" ) == 0 ) { - imcb_add_buddy( ic, (char*) handle, NULL ); - u = user_findhandle( ic, (char*) handle ); + bu = bee_user_new( bee, ic, handle ); } else { - if( set_getbool( &ic->irc->b->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->b->set, "handle_unknown" ), "ignore" ) != 0 ) + 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, @@ -642,6 +572,22 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, } } + /* 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; @@ -691,14 +637,14 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, } /* LISPy... */ - if( ( set_getbool( &ic->irc->b->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ + 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->irc->b->set, "simulate_netsplit" ) ) + if( set_getbool( &ic->bee->set, "simulate_netsplit" ) ) { from = g_strdup( ic->irc->myhost ); } @@ -711,11 +657,13 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, 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 ) { - irc_t *irc = ic->irc; +#if 0 + bee_t *bee = ic->bee; char *wrapped; user_t *u; @@ -723,18 +671,18 @@ void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, ui if( !u ) { - char *h = set_getstr( &irc->b->set, "handle_unknown" ); + char *h = set_getstr( &bee->set, "handle_unknown" ); if( g_strcasecmp( h, "ignore" ) == 0 ) { - if( set_getbool( &irc->b->set, "debug" ) ) + 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( &irc->b->set, "private" ); + int private = set_getbool( &bee->set, "private" ); if( h[3] ) { @@ -755,20 +703,22 @@ void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, ui } } - if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) + 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 user_t *u; - if( !set_getbool( &ic->irc->b->set, "typing_notice" ) ) + if( !set_getbool( &ic->bee->set, "typing_notice" ) ) return; if( ( u = user_findhandle( ic, handle ) ) ) @@ -778,10 +728,17 @@ void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags ) g_snprintf( buf, 256, "\1TYPING %d\1", ( flags >> 8 ) & 3 ); irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf ); } +#endif +} + +struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle ) +{ + return bee_user_by_handle( ic->bee, ic, handle ); } struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) { +#if 0 struct groupchat *c; /* This one just creates the conversation structure, user won't see anything yet */ @@ -799,19 +756,21 @@ struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) c->channel = g_strdup_printf( "&chat_%03d", ic->irc->c_id++ ); c->topic = g_strdup_printf( "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", c->title ); - if( set_getbool( &ic->irc->b->set, "debug" ) ) + if( set_getbool( &ic->bee->set, "debug" ) ) imcb_log( ic, "Creating new conversation: (id=%p,handle=%s)", c, handle ); return c; +#endif } void imcb_chat_free( struct groupchat *c ) { +#if 0 struct im_connection *ic = c->ic; struct groupchat *l; GList *ir; - if( set_getbool( &ic->irc->b->set, "debug" ) ) + if( set_getbool( &ic->bee->set, "debug" ) ) imcb_log( ic, "You were removed from conversation %p", c ); if( c ) @@ -844,10 +803,12 @@ void imcb_chat_free( struct groupchat *c ) g_free( c->topic ); g_free( c ); } +#endif } void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at ) { +#if 0 struct im_connection *ic = c->ic; char *wrapped; user_t *u; @@ -858,8 +819,8 @@ void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t fl u = user_findhandle( ic, who ); - if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) + 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 ); @@ -872,10 +833,12 @@ void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t fl imcb_log( ic, "Message from/to conversation %s@%p (unknown conv/user): %s", who, c, wrapped ); } g_free( wrapped ); +#endif } void imcb_chat_log( struct groupchat *c, char *format, ... ) { +#if 0 irc_t *irc = c->ic->irc; va_list params; char *text; @@ -890,10 +853,12 @@ void imcb_chat_log( struct groupchat *c, char *format, ... ) irc_privmsg( irc, u, "PRIVMSG", c->channel, "System message: ", text ); g_free( text ); +#endif } void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at ) { +#if 0 struct im_connection *ic = c->ic; user_t *u = NULL; @@ -904,8 +869,8 @@ void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at else u = user_findhandle( ic, who ); - if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) || - ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) ) + 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( topic ); g_free( c->topic ); @@ -913,17 +878,16 @@ void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at if( c->joined && u ) irc_write( ic->irc, ":%s!%s@%s TOPIC %s :%s", u->nick, u->user, u->host, c->channel, topic ); +#endif } - -/* buddy_chat.c */ - void imcb_chat_add_buddy( struct groupchat *b, const char *handle ) { +#if 0 user_t *u = user_findhandle( b->ic, handle ); int me = 0; - if( set_getbool( &b->ic->irc->b->set, "debug" ) ) + if( set_getbool( &b->ic->bee->set, "debug" ) ) imcb_log( b->ic, "User %s added to conversation %p", handle, b ); /* It might be yourself! */ @@ -950,15 +914,17 @@ void imcb_chat_add_buddy( struct groupchat *b, const char *handle ) irc_join( b->ic->irc, u, b->channel ); b->in_room = g_list_append( b->in_room, g_strdup( handle ) ); } +#endif } /* This function is one BIG hack... :-( EREWRITE */ void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason ) { +#if 0 user_t *u; int me = 0; - if( set_getbool( &b->ic->irc->b->set, "debug" ) ) + if( set_getbool( &b->ic->bee->set, "debug" ) ) imcb_log( b->ic, "User %s removed from conversation %p (%s)", handle, b, reason ? reason : "" ); /* It might be yourself! */ @@ -978,10 +944,12 @@ void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char if( me || ( remove_chat_buddy_silent( b, handle ) && b->joined && u ) ) irc_part( b->ic->irc, u, b->channel ); +#endif } static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ) { +#if 0 GList *i; /* Find the handle in the room userlist and shoot it */ @@ -997,13 +965,14 @@ static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ) i = i->next; } +#endif - return( 0 ); + return 0; } /* Misc. BitlBee stuff which shouldn't really be here */ - +#if 0 char *set_eval_away_devoice( set_t *set, char *value ) { irc_t *irc = set->data; @@ -1058,7 +1027,7 @@ char *set_eval_away_devoice( set_t *set, char *value ) return value; } - +#endif @@ -1105,7 +1074,7 @@ int imc_away_send_update( struct im_connection *ic ) char *away, *msg = NULL; away = set_getstr( &ic->acc->set, "away" ) ? - : set_getstr( &ic->irc->b->set, "away" ); + : set_getstr( &ic->bee->set, "away" ); if( away && *away ) { GList *m = ic->acc->prpl->away_states( ic ); @@ -1116,7 +1085,7 @@ int imc_away_send_update( struct im_connection *ic ) { away = NULL; msg = set_getstr( &ic->acc->set, "status" ) ? - : set_getstr( &ic->irc->b->set, "status" ); + : set_getstr( &ic->bee->set, "status" ); } ic->acc->prpl->set_away( ic, away, msg ); -- cgit v1.2.3 From d860a8ddf5039f7208bff4c179bc9fe1549da6da Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 31 Mar 2010 23:38:50 -0400 Subject: Restored "account" root command and restored enough stuff to be able to send messages. Also started moving stuff out from nogaim.* into bee_* files. --- protocols/nogaim.c | 182 ----------------------------------------------------- 1 file changed, 182 deletions(-) (limited to 'protocols/nogaim.c') 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, "", 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; -- cgit v1.2.3 From fb117aee274bccfb6528288599ef81fe72191e12 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 1 Apr 2010 22:29:45 -0400 Subject: Cleaned lots of compiler warnings so I can get some signal again. --- protocols/nogaim.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 741bdb76..141ae9a3 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -37,8 +37,6 @@ #include "nogaim.h" #include "chat.h" -static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ); - GSList *connections; #ifdef WITH_PLUGINS @@ -474,6 +472,7 @@ struct imcb_ask_cb_data char *handle; }; +#if 0 static void imcb_ask_auth_cb_no( void *data ) { struct imcb_ask_cb_data *cbd = data; @@ -493,6 +492,7 @@ static void imcb_ask_auth_cb_yes( void *data ) g_free( cbd->handle ); g_free( cbd ); } +#endif void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) { @@ -515,6 +515,7 @@ void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *re } +#if 0 static void imcb_ask_add_cb_no( void *data ) { g_free( ((struct imcb_ask_cb_data*)data)->handle ); @@ -529,6 +530,7 @@ static void imcb_ask_add_cb_yes( void *data ) return imcb_ask_add_cb_no( data ); } +#endif void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) { @@ -596,6 +598,7 @@ struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) return c; #endif + return NULL; } void imcb_chat_free( struct groupchat *c ) @@ -782,9 +785,9 @@ void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char #endif } +#if 0 static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ) { -#if 0 GList *i; /* Find the handle in the room userlist and shoot it */ @@ -800,10 +803,10 @@ static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ) i = i->next; } -#endif return 0; } +#endif /* Misc. BitlBee stuff which shouldn't really be here */ -- cgit v1.2.3 From 1d3915951bfbcdfa1a7829a4082e90e154d4a486 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 4 Apr 2010 20:18:24 -0400 Subject: Get full names properly. Handling of nick_source setting and imcb_nick_hint() is probably still broken. --- protocols/nogaim.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 141ae9a3..1e00d5ab 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -364,7 +364,6 @@ void imcb_ask( struct im_connection *ic, char *msg, void *data, void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group ) { bee_user_t *bu; - //char nick[MAX_NICK_LENGTH+1], *s; bee_t *bee = ic->bee; if( bee_user_by_handle( bee, ic, handle ) ) @@ -384,41 +383,21 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g bu->group = g_strdup( group ); } -void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname ) +void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *fullname ) { -#if 0 - user_t *u = user_findhandle( ic, handle ); - char *set; + bee_t *bee = ic->bee; + bee_user_t *bu = bee_user_by_handle( bee, ic, handle ); - if( !u || !realname ) return; + if( !bu || !fullname ) return; - if( g_strcasecmp( u->realname, realname ) != 0 ) + if( strcmp( bu->fullname, fullname ) != 0 ) { - if( u->realname != u->nick ) g_free( u->realname ); - - u->realname = g_strdup( realname ); + g_free( bu->fullname ); + bu->fullname = g_strdup( fullname ); - if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->bee->set, "display_namechanges" ) ) - imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); + if( bee->ui->user_fullname ) + bee->ui->user_fullname( bee, bu ); } - - set = set_getstr( &ic->acc->set, "nick_source" ); - if( strcmp( set, "handle" ) != 0 ) - { - char *name = g_strdup( realname ); - - if( strcmp( set, "first_name" ) == 0 ) - { - int i; - for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {} - name[i] = '\0'; - } - - imcb_buddy_nick_hint( ic, handle, name ); - - g_free( name ); - } -#endif } void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group ) -- cgit v1.2.3 From 17a6ee93f4fbefe8b4356d884fdd95f4e72ce8cc Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Apr 2010 16:37:06 +0200 Subject: Including DCC stuff again, with a wonderful extra layer of abstraction. Some hooks are missing so sending files doesn't work yet. Receiving also still seems to have some issues. On the plus side, at least the MSN/Jabber modules work again. --- protocols/nogaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 1e00d5ab..4521eb32 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -390,7 +390,7 @@ void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char if( !bu || !fullname ) return; - if( strcmp( bu->fullname, fullname ) != 0 ) + if( !bu->fullname || strcmp( bu->fullname, fullname ) != 0 ) { g_free( bu->fullname ); bu->fullname = g_strdup( fullname ); -- cgit v1.2.3 From e00da6322b3a78509d83e8f2c01cfec90465eb9f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Apr 2010 21:10:12 +0200 Subject: Restored query/ask stuff. --- protocols/nogaim.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 4521eb32..cbfbe00a 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -358,7 +358,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ) { - //query_add( ic->irc, ic, msg, doit, dont, data ); + query_add( (irc_t *) ic->bee->ui_data, ic, msg, doit, dont, data ); } void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group ) @@ -451,7 +451,6 @@ struct imcb_ask_cb_data char *handle; }; -#if 0 static void imcb_ask_auth_cb_no( void *data ) { struct imcb_ask_cb_data *cbd = data; @@ -471,11 +470,9 @@ static void imcb_ask_auth_cb_yes( void *data ) g_free( cbd->handle ); g_free( cbd ); } -#endif void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) { -#if 0 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); char *s, *realname_ = NULL; @@ -489,12 +486,11 @@ void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *re data->ic = ic; data->handle = g_strdup( handle ); - query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); -#endif + query_add( (irc_t *) ic->bee->ui_data, ic, s, + imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); } -#if 0 static void imcb_ask_add_cb_no( void *data ) { g_free( ((struct imcb_ask_cb_data*)data)->handle ); @@ -509,24 +505,22 @@ static void imcb_ask_add_cb_yes( void *data ) return imcb_ask_add_cb_no( data ); } -#endif void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) { -#if 0 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); char *s; /* TODO: Make a setting for this! */ - if( user_findhandle( ic, handle ) != NULL ) + if( bee_user_by_handle( ic->bee, ic, handle ) != NULL ) return; s = g_strdup_printf( "The user %s is not in your buddy list yet. Do you want to add him/her now?", handle ); data->ic = ic; data->handle = g_strdup( handle ); - query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); -#endif + query_add( (irc_t *) ic->bee->ui_data, ic, s, + imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); } void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags ) -- cgit v1.2.3 From eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 12 Apr 2010 00:49:32 +0200 Subject: Fixed cleanup issues when turning off an account. Also fixed syntax of *_user_free(). --- protocols/nogaim.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index cbfbe00a..4dd60ea6 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -326,12 +326,15 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) g_free( ic->away ); ic->away = NULL; - for( l = bee->users; l; l = l->next ) + for( l = bee->users; l; ) { bee_user_t *bu = l->data; + GSList *next = l->next; if( bu->ic == ic ) - bee_user_free( bee, ic, bu->handle ); + bee_user_free( bee, bu ); + + l = next; } //query_del_by_conn( ic->irc, ic ); @@ -402,7 +405,7 @@ void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group ) { - bee_user_free( ic->bee, ic, handle ); + bee_user_free( ic->bee, bee_user_by_handle( ic->bee, ic, handle ) ); } /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM -- cgit v1.2.3 From 573dab069d2c35910b3cdede3374a5749cb20a89 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 13 Apr 2010 12:20:04 +0200 Subject: Incoming typing notifications. --- protocols/nogaim.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 4dd60ea6..f7db5c37 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -526,24 +526,6 @@ void imcb_ask_add( struct im_connection *ic, const char *handle, const char *rea imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); } -void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags ) -{ -#if 0 - user_t *u; - - if( !set_getbool( &ic->bee->set, "typing_notice" ) ) - return; - - if( ( u = user_findhandle( ic, handle ) ) ) - { - char buf[256]; - - g_snprintf( buf, 256, "\1TYPING %d\1", ( flags >> 8 ) & 3 ); - irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf ); - } -#endif -} - struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle ) { return bee_user_by_handle( ic->bee, ic, handle ); -- cgit v1.2.3 From aea8b68bd0e057441d671c008200e71dd046a211 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 6 May 2010 01:28:56 +0100 Subject: Starting to restore chatroom stuff. Only enough to create and be joined into a room. More will follow soon. --- protocols/nogaim.c | 270 ----------------------------------------------------- 1 file changed, 270 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 74ec0642..149e64f1 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -536,276 +536,6 @@ struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *han return bee_user_by_handle( ic->bee, ic, handle ); } -struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) -{ -#if 0 - struct groupchat *c; - - /* This one just creates the conversation structure, user won't see anything yet */ - - if( ic->groupchats ) - { - for( c = ic->groupchats; c->next; c = c->next ); - c = c->next = g_new0( struct groupchat, 1 ); - } - else - ic->groupchats = c = g_new0( struct groupchat, 1 ); - - c->ic = ic; - c->title = g_strdup( handle ); - c->channel = g_strdup_printf( "&chat_%03d", ic->irc->c_id++ ); - c->topic = g_strdup_printf( "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", c->title ); - - if( set_getbool( &ic->bee->set, "debug" ) ) - imcb_log( ic, "Creating new conversation: (id=%p,handle=%s)", c, handle ); - - return c; -#endif - return NULL; -} - -void imcb_chat_name_hint( struct groupchat *c, const char *name ) -{ -#if 0 - if( !c->joined ) - { - struct im_connection *ic = c->ic; - char stripped[MAX_NICK_LENGTH+1], *full_name; - - strncpy( stripped, name, MAX_NICK_LENGTH ); - stripped[MAX_NICK_LENGTH] = '\0'; - nick_strip( stripped ); - if( set_getbool( &ic->irc->set, "lcnicks" ) ) - nick_lc( stripped ); - - full_name = g_strdup_printf( "&%s", stripped ); - - if( stripped[0] && - nick_cmp( stripped, ic->irc->channel + 1 ) != 0 && - irc_chat_by_channel( ic->irc, full_name ) == NULL ) - { - g_free( c->channel ); - c->channel = full_name; - } - else - { - g_free( full_name ); - } - } -#endif -} - -void imcb_chat_free( struct groupchat *c ) -{ -#if 0 - struct im_connection *ic = c->ic; - struct groupchat *l; - GList *ir; - - if( set_getbool( &ic->bee->set, "debug" ) ) - imcb_log( ic, "You were removed from conversation %p", c ); - - if( c ) - { - if( c->joined ) - { - user_t *u, *r; - - r = user_find( ic->irc, ic->irc->mynick ); - irc_privmsg( ic->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" ); - - u = user_find( ic->irc, ic->irc->nick ); - irc_kick( ic->irc, u, c->channel, r ); - /* irc_part( ic->irc, u, c->channel ); */ - } - - /* Find the previous chat in the linked list. */ - for( l = ic->groupchats; l && l->next != c; l = l->next ); - - if( l ) - l->next = c->next; - else - ic->groupchats = c->next; - - for( ir = c->in_room; ir; ir = ir->next ) - g_free( ir->data ); - g_list_free( c->in_room ); - g_free( c->channel ); - g_free( c->title ); - g_free( c->topic ); - g_free( c ); - } -#endif -} - -void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at ) -{ -#if 0 - struct im_connection *ic = c->ic; - char *wrapped; - user_t *u; - - /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ - if( g_strcasecmp( who, ic->acc->user ) == 0 ) - return; - - u = user_findhandle( ic, who ); - - 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 ); - if( c && u ) - { - char *ts = NULL; - if( set_getbool( &ic->irc->set, "display_timestamps" ) ) - ts = format_timestamp( ic->irc, sent_at ); - irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? : "", wrapped ); - g_free( ts ); - } - else - { - imcb_log( ic, "Message from/to conversation %s@%p (unknown conv/user): %s", who, c, wrapped ); - } - g_free( wrapped ); -#endif -} - -void imcb_chat_log( struct groupchat *c, char *format, ... ) -{ -#if 0 - irc_t *irc = c->ic->irc; - va_list params; - char *text; - user_t *u; - - va_start( params, format ); - text = g_strdup_vprintf( format, params ); - va_end( params ); - - u = user_find( irc, irc->mynick ); - - irc_privmsg( irc, u, "PRIVMSG", c->channel, "System message: ", text ); - - g_free( text ); -#endif -} - -void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at ) -{ -#if 0 - struct im_connection *ic = c->ic; - user_t *u = NULL; - - if( who == NULL) - u = user_find( ic->irc, ic->irc->mynick ); - else if( g_strcasecmp( who, ic->acc->user ) == 0 ) - u = user_find( ic->irc, ic->irc->nick ); - else - u = user_findhandle( ic, who ); - - 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( topic ); - - g_free( c->topic ); - c->topic = g_strdup( topic ); - - if( c->joined && u ) - irc_write( ic->irc, ":%s!%s@%s TOPIC %s :%s", u->nick, u->user, u->host, c->channel, topic ); -#endif -} - -void imcb_chat_add_buddy( struct groupchat *b, const char *handle ) -{ -#if 0 - user_t *u = user_findhandle( b->ic, handle ); - int me = 0; - - if( set_getbool( &b->ic->bee->set, "debug" ) ) - imcb_log( b->ic, "User %s added to conversation %p", handle, b ); - - /* It might be yourself! */ - if( b->ic->acc->prpl->handle_cmp( handle, b->ic->acc->user ) == 0 ) - { - u = user_find( b->ic->irc, b->ic->irc->nick ); - if( !b->joined ) - irc_join( b->ic->irc, u, b->channel ); - b->joined = me = 1; - } - - /* Most protocols allow people to join, even when they're not in - your contact list. Try to handle that here */ - if( !u ) - { - imcb_add_buddy( b->ic, handle, NULL ); - u = user_findhandle( b->ic, handle ); - } - - /* Add the handle to the room userlist, if it's not 'me' */ - if( !me ) - { - if( b->joined ) - irc_join( b->ic->irc, u, b->channel ); - b->in_room = g_list_append( b->in_room, g_strdup( handle ) ); - } -#endif -} - -/* This function is one BIG hack... :-( EREWRITE */ -void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason ) -{ -#if 0 - user_t *u; - int me = 0; - - if( set_getbool( &b->ic->bee->set, "debug" ) ) - imcb_log( b->ic, "User %s removed from conversation %p (%s)", handle, b, reason ? reason : "" ); - - /* It might be yourself! */ - if( g_strcasecmp( handle, b->ic->acc->user ) == 0 ) - { - if( b->joined == 0 ) - return; - - u = user_find( b->ic->irc, b->ic->irc->nick ); - b->joined = 0; - me = 1; - } - else - { - u = user_findhandle( b->ic, handle ); - } - - if( me || ( remove_chat_buddy_silent( b, handle ) && b->joined && u ) ) - irc_part( b->ic->irc, u, b->channel ); -#endif -} - -#if 0 -static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ) -{ - GList *i; - - /* Find the handle in the room userlist and shoot it */ - i = b->in_room; - while( i ) - { - if( g_strcasecmp( handle, i->data ) == 0 ) - { - g_free( i->data ); - b->in_room = g_list_remove( b->in_room, i->data ); - return( 1 ); - } - - i = i->next; - } - - return 0; -} -#endif - /* Misc. BitlBee stuff which shouldn't really be here */ #if 0 -- cgit v1.2.3 From 7aadd714313ba3e966720e7565f72118b97bd551 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 9 May 2010 19:05:55 +0100 Subject: Keep track of contact groups in a slightly more efficient way. --- protocols/nogaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 149e64f1..5696a01e 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -388,7 +388,7 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g } bu = bee_user_new( bee, ic, handle ); - bu->group = g_strdup( group ); + bu->group = bee_group_by_name( bee, group, TRUE ); } void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *fullname ) -- cgit v1.2.3 From 4e608d6fee8ee39b871338524b6da00aa5a6e86b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 9 May 2010 22:56:39 +0100 Subject: Pick up group changes coming in during a session. Reflecting them in the session will be a bit more complicated. --- protocols/nogaim.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 5696a01e..51679f88 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -374,20 +374,9 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g bee_user_t *bu; bee_t *bee = ic->bee; - if( bee_user_by_handle( bee, ic, handle ) ) - { - if( set_getbool( &bee->set, "debug" ) ) - imcb_log( ic, "User already exists, ignoring add request: %s", handle ); - - return; - - /* Buddy seems to exist already. Let's ignore this request then... - Eventually subsequent calls to this function *should* be possible - when a buddy is in multiple groups. But for now BitlBee doesn't - even support groups so let's silently ignore this for now. */ - } + if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) + bu = bee_user_new( bee, ic, handle ); - bu = bee_user_new( bee, ic, handle ); bu->group = bee_group_by_name( bee, group, TRUE ); } -- cgit v1.2.3 From 3663bb3ee9bc20d83642103f03a53831caee454d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 13 May 2010 01:19:33 +0100 Subject: Restore query cleanup on IM disconnects. --- protocols/nogaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 51679f88..241c9833 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -342,7 +342,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) l = next; } - //query_del_by_conn( ic->irc, ic ); + query_del_by_conn( (irc_t*) ic->bee->ui_data, ic ); for( a = bee->accounts; a; a = a->next ) if( a->ic == ic ) -- cgit v1.2.3 From ad404ab26aa3cfdfc3c76f6926e556e333d02753 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 3 Jun 2010 01:20:53 +0100 Subject: Restore add_* handle_unknown settings. --- protocols/nogaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 241c9833..00fe0ebf 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -375,7 +375,7 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g bee_t *bee = ic->bee; if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) - bu = bee_user_new( bee, ic, handle ); + bu = bee_user_new( bee, ic, handle, 0 ); bu->group = bee_group_by_name( bee, group, TRUE ); } -- cgit v1.2.3 From 7e83e8e47ff1ba031928e1e46bf16ec53ca53117 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 5 Jun 2010 01:35:17 +0100 Subject: Inform the UI about group changes. This is important if the user has group channels. --- protocols/nogaim.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 00fe0ebf..df97393d 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -378,6 +378,9 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g bu = bee_user_new( bee, ic, handle, 0 ); bu->group = bee_group_by_name( bee, group, TRUE ); + + if( bee->ui->user_group ) + bee->ui->user_group( bee, bu ); } void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *fullname ) -- cgit v1.2.3 From 0e8b3e855dfa370fe559729224b3bff1d4cf5b87 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 7 Jun 2010 16:21:21 +0100 Subject: Changing away_devoice will change current voice statuses in all channels. --- protocols/nogaim.c | 59 ------------------------------------------------------ 1 file changed, 59 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index be85b8ba..499e4d1d 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -536,65 +536,6 @@ struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *han return bee_user_by_handle( ic->bee, ic, handle ); } - -/* Misc. BitlBee stuff which shouldn't really be here */ -#if 0 -char *set_eval_away_devoice( set_t *set, char *value ) -{ - irc_t *irc = set->data; - int st; - - if( !is_bool( value ) ) - return SET_INVALID; - - st = bool2int( value ); - - /* Horror.... */ - - if( st != set_getbool( &irc->b->set, "away_devoice" ) ) - { - char list[80] = ""; - user_t *u = irc->users; - int i = 0, count = 0; - char pm; - char v[80]; - - if( st ) - pm = '+'; - else - pm = '-'; - - while( u ) - { - if( u->ic && u->online && !u->away ) - { - if( ( strlen( list ) + strlen( u->nick ) ) >= 79 ) - { - for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0; - irc_write( irc, ":%s MODE %s %c%s%s", - irc->myhost, - irc->channel, pm, v, list ); - - *list = 0; - count = 0; - } - - sprintf( list + strlen( list ), " %s", u->nick ); - count ++; - } - u = u->next; - } - - /* $v = 'v' x $i */ - for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0; - irc_write( irc, ":%s MODE %s %c%s%s", irc->myhost, - irc->channel, pm, v, list ); - } - - return value; -} -#endif - /* 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: */ -- cgit v1.2.3 From 6ef906557277b71fc278e3f612542bd4d7d75ab5 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 7 Jun 2010 22:09:33 +0100 Subject: Restored nick_hint/nick_source functionality. --- protocols/nogaim.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 499e4d1d..6ecdfe12 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -417,39 +417,13 @@ void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *grou modules to suggest a nickname for a handle. */ void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick ) { -#if 0 - user_t *u = user_findhandle( ic, handle ); - char newnick[MAX_NICK_LENGTH+1], *orig_nick; + bee_t *bee = ic->bee; + bee_user_t *bu = bee_user_by_handle( bee, ic, handle ); - if( u && !u->online && !nick_saved( ic->acc, handle ) ) - { - /* Only do this if the person isn't online yet (which should - be the case if we just added it) and if the user hasn't - assigned a nickname to this buddy already. */ - - strncpy( newnick, nick, MAX_NICK_LENGTH ); - newnick[MAX_NICK_LENGTH] = 0; - - /* Some processing to make sure this string is a valid IRC nickname. */ - nick_strip( newnick ); - if( set_getbool( &ic->bee->set, "lcnicks" ) ) - nick_lc( newnick ); - - if( strcmp( u->nick, newnick ) != 0 ) - { - /* Only do this if newnick is different from the current one. - If rejoining a channel, maybe we got this nick already - (and dedupe would only add an underscore. */ - nick_dedupe( ic->acc, handle, newnick ); - - /* u->nick will be freed halfway the process, so it can't be - passed as an argument. */ - orig_nick = g_strdup( u->nick ); - user_rename( ic->irc, orig_nick, newnick ); - g_free( orig_nick ); - } - } -#endif + if( !bu || !nick ) return; + + if( bee->ui->user_nick_hint ) + bee->ui->user_nick_hint( bee, bu, nick ); } -- cgit v1.2.3 From 84c3a72604a292c41348d678eccf1875263cb8dd Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 27 Jun 2010 13:39:07 +0100 Subject: Import chatrooms configured in older BitlBee versions. Settings are currently ignored though. Also removing the old chat.[ch] files since they're really not important anymore. --- protocols/nogaim.c | 1 - 1 file changed, 1 deletion(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 6ecdfe12..f88ec693 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -35,7 +35,6 @@ #include #include "nogaim.h" -#include "chat.h" GSList *connections; -- cgit v1.2.3 From 5c7b45cb652c73a8f2c827116786a1b21519d4b7 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 4 Jul 2010 14:36:08 +0100 Subject: Auto joins for chatrooms. --- protocols/nogaim.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index f88ec693..0998291b 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -286,6 +286,9 @@ void imcb_connected( struct im_connection *ic ) exponential backoff timer. */ ic->acc->auto_reconnect_delay = 0; + if( ic->bee->ui->imc_connected ) + ic->bee->ui->imc_connected( ic ); + /* for( c = irc->chatrooms; c; c = c->next ) { @@ -328,6 +331,9 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) else ic->flags |= OPT_LOGGING_OUT; + if( ic->bee->ui->imc_disconnected ) + ic->bee->ui->imc_disconnected( ic ); + imcb_log( ic, "Signing off.." ); b_event_remove( ic->keepalive ); -- cgit v1.2.3 From 69b896b5967e5d13b1c60c68cb3bc7d4a0d5cd06 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 5 Jul 2010 13:01:28 +0100 Subject: When addressing people in a chatroom, try to translate the nickname to the original unstripped version (without ugly underscores, also). --- protocols/nogaim.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 0998291b..c23b0a3a 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -427,6 +427,9 @@ void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const c if( !bu || !nick ) return; + g_free( bu->nick ); + bu->nick = g_strdup( nick ); + if( bee->ui->user_nick_hint ) bee->ui->user_nick_hint( bee, bu, nick ); } -- cgit v1.2.3 From 1e52e1ff518987092cfe94bc5c9c4479ed535019 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Jul 2010 11:30:27 +0100 Subject: When cleaning up queries, q->data is free()d. Even if it turns out to be the "struct irc" containing all data belonging to a session. Sanitise memory management a little bit here. (There are some memory leaks in here too that need to be fixed at some point.) --- protocols/nogaim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index c23b0a3a..7380c575 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -379,7 +379,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ) { - query_add( (irc_t *) ic->bee->ui_data, ic, msg, doit, dont, data ); + query_add( (irc_t *) ic->bee->ui_data, ic, msg, doit, dont, g_free, data ); } void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group ) @@ -477,7 +477,7 @@ void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *re data->ic = ic; data->handle = g_strdup( handle ); query_add( (irc_t *) ic->bee->ui_data, ic, s, - imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); + imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, g_free, data ); } @@ -510,7 +510,7 @@ void imcb_ask_add( struct im_connection *ic, const char *handle, const char *rea data->ic = ic; data->handle = g_strdup( handle ); query_add( (irc_t *) ic->bee->ui_data, ic, s, - imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); + imcb_ask_add_cb_yes, imcb_ask_add_cb_no, g_free, data ); } struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle ) -- cgit v1.2.3 From d0527c1845ed1230bbc3b0f94b8643cd8f9fddc3 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 17 Jul 2010 12:34:24 +0100 Subject: libpurple: Handle incoming authorization requests. --- protocols/nogaim.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 7380c575..e628126f 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -382,6 +382,12 @@ void imcb_ask( struct im_connection *ic, char *msg, void *data, query_add( (irc_t *) ic->bee->ui_data, ic, msg, doit, dont, g_free, data ); } +void imcb_ask_with_free( struct im_connection *ic, char *msg, void *data, + query_callback doit, query_callback dont, query_callback myfree ) +{ + query_add( (irc_t *) ic->bee->ui_data, ic, msg, doit, dont, myfree, data ); +} + void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group ) { bee_user_t *bu; -- cgit v1.2.3