Changeset c3caa46


Ignore:
Timestamp:
2010-05-22T13:46:25Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
f85e9d6
Parents:
05a8932
Message:

Support for named groupchats, although not very solid.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r05a8932 rc3caa46  
    496496}
    497497
     498struct groupchat *purple_chat_join( struct im_connection *ic, const char *room, const char *nick, const char *password )
     499{
     500        PurpleAccount *pa = ic->proto_data;
     501        PurplePlugin *prpl = purple_plugins_find_with_id( pa->protocol_id );
     502        PurplePluginProtocolInfo *pi = prpl->info->extra_info;
     503        GHashTable *chat_hash;
     504        PurpleConversation *conv;
     505        GList *info, *l;
     506       
     507        if( !pi->chat_info || !pi->chat_info_defaults ||
     508            !( info = pi->chat_info( purple_account_get_connection( pa ) ) ) )
     509        {
     510                imcb_error( ic, "Joining chatrooms not supported by this protocol" );
     511                return NULL;
     512        }
     513       
     514        if( ( conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_CHAT, room, pa ) ) )
     515                purple_conversation_destroy( conv );
     516       
     517        chat_hash = pi->chat_info_defaults( purple_account_get_connection( pa ), room );
     518       
     519        for( l = info; l; l = l->next )
     520        {
     521                struct proto_chat_entry *pce = l->data;
     522               
     523                if( strcmp( pce->identifier, "handle" ) == 0 )
     524                        g_hash_table_replace( chat_hash, "handle", g_strdup( nick ) );
     525                else if( strcmp( pce->identifier, "password" ) == 0 )
     526                        g_hash_table_replace( chat_hash, "password", g_strdup( password ) );
     527                else if( strcmp( pce->identifier, "passwd" ) == 0 )
     528                        g_hash_table_replace( chat_hash, "passwd", g_strdup( password ) );
     529        }
     530       
     531        serv_join_chat( purple_account_get_connection( pa ), chat_hash );
     532       
     533        return NULL;
     534}
     535
    498536void purple_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *handle );
    499537
     
    662700                conv->ui_data = gc;
    663701                gc->data = conv;
     702               
     703                /* libpurple brokenness: Whatever. Show that we join right away,
     704                   there's no clear "This is you!" signaling in _add_users so
     705                   don't even try. */
     706                imcb_chat_add_buddy( gc, gc->ic->acc->user );
    664707        }
    665708}
     
    676719        struct groupchat *gc = conv->ui_data;
    677720        GList *b;
    678        
    679         if( !gc->joined && strcmp( conv->account->protocol_id, "prpl-msn" ) == 0 )
    680         {
    681                 /* Work around the broken MSN module which fucks up the user's
    682                    handle completely when informing him/her that he just
    683                    successfully joined the room s/he just created (v2.6.6). */
    684                 imcb_chat_add_buddy( gc, gc->ic->acc->user );
    685         }
    686721       
    687722        for( b = cbuddies; b; b = b->next )
     
    10461081        funcs.chat_invite = purple_chat_invite;
    10471082        funcs.chat_leave = purple_chat_leave;
     1083        funcs.chat_join = purple_chat_join;
    10481084        funcs.transfer_request = purple_transfer_request;
    10491085       
Note: See TracChangeset for help on using the changeset viewer.