Changeset e77c264


Ignore:
Timestamp:
2010-05-22T00:58:59Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
dca8eff
Parents:
2c5fabc
Message:

Added support for the info command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r2c5fabc re77c264  
    359359}
    360360
     361static void purple_get_info( struct im_connection *ic, char *who )
     362{
     363        serv_get_info( purple_account_get_connection( ic->proto_data ), who );
     364}
     365
    361366static void purple_keepalive( struct im_connection *ic )
    362367{
     
    825830}
    826831
     832static void *prplcb_notify_userinfo( PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info )
     833{
     834        struct im_connection *ic = purple_ic_by_gc( gc );
     835        GString *info = g_string_new( "" );
     836        GList *l = purple_notify_user_info_get_entries( user_info );
     837        char *key;
     838        const char *value;
     839        int n;
     840       
     841        while( l )
     842        {
     843                PurpleNotifyUserInfoEntry *e = l->data;
     844               
     845                switch( purple_notify_user_info_entry_get_type( e ) )
     846                {
     847                case PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR:
     848                case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER:
     849                        key = g_strdup( purple_notify_user_info_entry_get_label( e ) );
     850                        value = purple_notify_user_info_entry_get_value( e );
     851                       
     852                        if( key )
     853                        {
     854                                strip_html( key );
     855                                g_string_append_printf( info, "%s: ", key );
     856                               
     857                                if( value )
     858                                {
     859                                        n = strlen( value ) - 1;
     860                                        while( isspace( value[n] ) )
     861                                                n --;
     862                                        g_string_append_len( info, value, n + 1 );
     863                                }
     864                                g_string_append_c( info, '\n' );
     865                                g_free( key );
     866                        }
     867                       
     868                        break;
     869                case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK:
     870                        g_string_append( info, "------------------------\n" );
     871                        break;
     872                }
     873               
     874                l = l->next;
     875        }
     876       
     877        imcb_log( ic, "User %s info:\n%s", who, info->str );
     878        g_string_free( info, TRUE );
     879       
     880        return NULL;
     881}
     882
    827883static PurpleNotifyUiOps bee_notify_uiops =
    828884{
    829885        NULL,
    830886        prplcb_notify_email,
     887        NULL,
     888        NULL,
     889        NULL,
     890        NULL,
     891        prplcb_notify_userinfo,
    831892};
    832893
     
    886947        funcs.add_buddy = purple_add_buddy;
    887948        funcs.remove_buddy = purple_remove_buddy;
     949        funcs.get_info = purple_get_info;
    888950        funcs.keepalive = purple_keepalive;
    889951        funcs.send_typing = purple_send_typing;
Note: See TracChangeset for help on using the changeset viewer.