diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-06 01:28:56 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-06 01:28:56 +0100 |
commit | aea8b68bd0e057441d671c008200e71dd046a211 (patch) | |
tree | ba3d668eec9747c9009a50e8cdbaa842bddf446c /protocols/nogaim.c | |
parent | 94383231eddf56112cf74f2ae65d691821d70803 (diff) |
Starting to restore chatroom stuff. Only enough to create and be joined
into a room. More will follow soon.
Diffstat (limited to 'protocols/nogaim.c')
-rw-r--r-- | protocols/nogaim.c | 270 |
1 files changed, 0 insertions, 270 deletions
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 |