Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    re248c7f r4cf80bb  
    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 );
     
    102104{
    103105        GList *gl;
    104        
    105         for( gl = protocols; gl; gl = gl->next )
     106        for (gl = protocols; gl; gl = gl->next)
    106107        {
    107108                struct prpl *proto = gl->data;
    108                
    109                 if( g_strcasecmp( proto->name, name ) == 0 )
     109                if(!g_strcasecmp(proto->name, name))
    110110                        return proto;
    111 
    112 #ifdef WITH_PURPLE
    113                 /* I know, hardcoding is evil, but that doesn't make it
    114                    impossible. :-) */
    115                 if( g_strncasecmp( proto->name, "prpl-", 5 ) == 0 &&
    116                     g_strcasecmp( proto->name + 5, name ) == 0 )
    117                         return proto;
    118 #endif
    119111        }
    120        
    121112        return NULL;
    122113}
     
    129120        extern void byahoo_initmodule();
    130121        extern void jabber_initmodule();
    131         extern void purple_initmodule();
    132122
    133123#ifdef WITH_MSN
     
    145135#ifdef WITH_JABBER
    146136        jabber_initmodule();
    147 #endif
    148        
    149 #ifdef WITH_PURPLE
    150         purple_initmodule();
    151137#endif
    152138
     
    522508}
    523509
    524 /* prpl.c */
    525 
    526 struct show_got_added_data
     510
     511struct imcb_ask_cb_data
    527512{
    528513        struct im_connection *ic;
     
    530515};
    531516
    532 void show_got_added_no( void *data )
    533 {
    534         g_free( ((struct show_got_added_data*)data)->handle );
     517static void imcb_ask_auth_cb_no( void *data )
     518{
     519        struct imcb_ask_cb_data *cbd = data;
     520       
     521        cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle );
     522       
     523        g_free( cbd->handle );
     524        g_free( cbd );
     525}
     526
     527static void imcb_ask_auth_cb_yes( void *data )
     528{
     529        struct imcb_ask_cb_data *cbd = data;
     530       
     531        cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle );
     532       
     533        g_free( cbd->handle );
     534        g_free( cbd );
     535}
     536
     537void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname )
     538{
     539        struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
     540        char *s, *realname_ = NULL;
     541       
     542        if( realname != NULL )
     543                realname_ = g_strdup_printf( " (%s)", realname );
     544       
     545        s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.",
     546                             handle, realname_ ?: "" );
     547       
     548        g_free( realname_ );
     549       
     550        data->ic = ic;
     551        data->handle = g_strdup( handle );
     552        query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data );
     553}
     554
     555
     556static void imcb_ask_add_cb_no( void *data )
     557{
     558        g_free( ((struct imcb_ask_cb_data*)data)->handle );
    535559        g_free( data );
    536560}
    537561
    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 );
     562static void imcb_ask_add_cb_yes( void *data )
     563{
     564        struct imcb_ask_cb_data *cbd = data;
     565       
     566        cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL );
     567       
     568        return imcb_ask_add_cb_no( data );
     569}
     570
     571void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname )
     572{
     573        struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
    551574        char *s;
    552575       
     
    559582        data->ic = ic;
    560583        data->handle = g_strdup( handle );
    561         query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );
     584        query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data );
    562585}
    563586
Note: See TracChangeset for help on using the changeset viewer.