Changeset bad41f56 for protocols


Ignore:
Timestamp:
2010-08-19T23:42:11Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
4d4a7ed
Parents:
acd7959
Message:

libpurple: Fix typing notifications (in and out). Closes #671.

Location:
protocols
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/bee_user.c

    racd7959 rbad41f56  
    241241}
    242242
    243 void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags )
     243void imcb_buddy_typing( struct im_connection *ic, const char *handle, uint32_t flags )
    244244{
    245245        bee_user_t *bu;
  • protocols/nogaim.h

    racd7959 rbad41f56  
    310310G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick );
    311311
    312 G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags );
     312G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, const char *handle, uint32_t flags );
    313313G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle );
    314314G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle );
  • protocols/purple/purple.c

    racd7959 rbad41f56  
    427427{
    428428        PurpleTypingState state = PURPLE_NOT_TYPING;
    429         PurpleConversation *conv;
     429        PurpleAccount *pa = ic->proto_data;
    430430       
    431431        if( flags & OPT_TYPING )
     
    434434                state = PURPLE_TYPED;
    435435       
    436         if( ( conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_IM,
    437                                                             who, ic->proto_data ) ) == NULL )
    438         {
    439                 purple_conv_im_set_typing_state( purple_conversation_get_im_data( conv ), state );
    440                 return 1;
    441         }
    442         else
    443         {
    444                 return 0;
    445         }
     436        serv_send_typing( purple_account_get_connection( pa ), who, state );
     437       
     438        return 1;
    446439}
    447440
     
    807800       
    808801        imcb_buddy_msg( ic, (char*) who, (char*) message, 0, mtime );
     802}
     803
     804/* No, this is not a ui_op but a signal. */
     805static void prplcb_buddy_typing( PurpleAccount *account, const char *who, gpointer null )
     806{
     807        PurpleConversation *conv;
     808        PurpleConvIm *im;
     809        int state;
     810       
     811        if( ( conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_IM, who, account ) ) == NULL )
     812                return;
     813       
     814        im = PURPLE_CONV_IM(conv);
     815        switch( purple_conv_im_get_typing_state( im ) )
     816        {
     817        case PURPLE_TYPING:
     818                state = OPT_TYPING;
     819                break;
     820        case PURPLE_TYPED:
     821                state = OPT_THINKING;
     822                break;
     823        default:
     824                state = 0;
     825        }
     826       
     827        imcb_buddy_typing( purple_ic_by_pa( account ), who, state );
    809828}
    810829
     
    11391158        purple_prefs_load();
    11401159       
     1160        /* No, really. So far there were ui_ops for everything, but now suddenly
     1161           one needs to use signals for typing notification stuff. :-( */
     1162        purple_signal_connect( purple_conversations_get_handle(), "buddy-typing",
     1163                               &funcs, PURPLE_CALLBACK(prplcb_buddy_typing), NULL );
     1164        purple_signal_connect( purple_conversations_get_handle(), "buddy-typed",
     1165                               &funcs, PURPLE_CALLBACK(prplcb_buddy_typing), NULL );
     1166        purple_signal_connect( purple_conversations_get_handle(), "buddy-typing-stopped",
     1167                               &funcs, PURPLE_CALLBACK(prplcb_buddy_typing), NULL );
     1168       
    11411169        memset( &funcs, 0, sizeof( funcs ) );
    11421170        funcs.login = purple_login;
Note: See TracChangeset for help on using the changeset viewer.