Changeset 4e04194 for protocols/nogaim.c


Ignore:
Timestamp:
2009-11-23T23:00:54Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
cd741d8
Parents:
b3117f2 (diff), fb51d85 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging BitlBee 1.2.4+

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    rb3117f2 r4e04194  
    3333
    3434#define BITLBEE_CORE
     35#include <ctype.h>
     36
    3537#include "nogaim.h"
    36 #include <ctype.h>
     38#include "chat.h"
    3739
    3840static int remove_chat_buddy_silent( struct groupchat *b, const char *handle );
     
    522524}
    523525
    524 /* prpl.c */
    525 
    526 struct show_got_added_data
     526
     527struct imcb_ask_cb_data
    527528{
    528529        struct im_connection *ic;
     
    530531};
    531532
    532 void show_got_added_no( void *data )
    533 {
    534         g_free( ((struct show_got_added_data*)data)->handle );
     533static void imcb_ask_auth_cb_no( void *data )
     534{
     535        struct imcb_ask_cb_data *cbd = data;
     536       
     537        cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle );
     538       
     539        g_free( cbd->handle );
     540        g_free( cbd );
     541}
     542
     543static void imcb_ask_auth_cb_yes( void *data )
     544{
     545        struct imcb_ask_cb_data *cbd = data;
     546       
     547        cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle );
     548       
     549        g_free( cbd->handle );
     550        g_free( cbd );
     551}
     552
     553void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname )
     554{
     555        struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
     556        char *s, *realname_ = NULL;
     557       
     558        if( realname != NULL )
     559                realname_ = g_strdup_printf( " (%s)", realname );
     560       
     561        s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.",
     562                             handle, realname_ ?: "" );
     563       
     564        g_free( realname_ );
     565       
     566        data->ic = ic;
     567        data->handle = g_strdup( handle );
     568        query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data );
     569}
     570
     571
     572static void imcb_ask_add_cb_no( void *data )
     573{
     574        g_free( ((struct imcb_ask_cb_data*)data)->handle );
    535575        g_free( data );
    536576}
    537577
    538 void show_got_added_yes( void *data )
    539 {
    540         struct show_got_added_data *sga = data;
    541        
    542         sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL );
    543         /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */
    544        
    545         return show_got_added_no( data );
    546 }
    547 
    548 void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname )
    549 {
    550         struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 );
     578static void imcb_ask_add_cb_yes( void *data )
     579{
     580        struct imcb_ask_cb_data *cbd = data;
     581       
     582        cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL );
     583       
     584        return imcb_ask_add_cb_no( data );
     585}
     586
     587void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname )
     588{
     589        struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
    551590        char *s;
    552591       
     
    559598        data->ic = ic;
    560599        data->handle = g_strdup( handle );
    561         query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );
     600        query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data );
    562601}
    563602
Note: See TracChangeset for help on using the changeset viewer.