Changeset 81e04e1


Ignore:
Timestamp:
2010-04-01T02:32:25Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d860a8d
Parents:
10a96f4
Message:

nogaim.c is close to doing something useful again without speaking any IRC
itself.

Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r10a96f4 r81e04e1  
    1111# Program variables
    1212#objects = bitlbee.o chat.o dcc.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS)
    13 objects = bitlbee.o help.o ipc.o irc.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o
     13objects = bitlbee.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o
    1414headers = account.h bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/ft.h protocols/nogaim.h
    1515subdirs = lib protocols
  • irc.h

    r10a96f4 r81e04e1  
    152152        gboolean (*privmsg)( irc_channel_t *iu, const char *msg );
    153153};
    154 
    155 #include "user.h"
    156154
    157155/* irc.c */
  • nick.c

    r10a96f4 r81e04e1  
    7878               
    7979                nick_strip( nick );
    80                 if( set_getbool( &acc->irc->b->set, "lcnicks" ) )
     80                if( set_getbool( &acc->bee->set, "lcnicks" ) )
    8181                        nick_lc( nick );
    8282        }
     
    9292void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] )
    9393{
     94        irc_t *irc = (irc_t*) acc->bee->ui_data;
    9495        int inf_protection = 256;
    9596       
    9697        /* Now, find out if the nick is already in use at the moment, and make
    9798           subtle changes to make it unique. */
    98         while( !nick_ok( nick ) || irc_user_by_name( acc->irc, nick ) )
     99        while( !nick_ok( nick ) || irc_user_by_name( irc, nick ) )
    99100        {
    100101                if( strlen( nick ) < ( MAX_NICK_LENGTH - 1 ) )
     
    112113                        int i;
    113114                       
    114                         irc_usermsg( acc->irc, "Warning: Almost had an infinite loop in nick_get()! "
    115                                                "This used to be a fatal BitlBee bug, but we tried to fix it. "
    116                                                "This message should *never* appear anymore. "
    117                                                "If it does, please *do* send us a bug report! "
    118                                                "Please send all the following lines in your report:" );
    119                        
    120                         irc_usermsg( acc->irc, "Trying to get a sane nick for handle %s", handle );
     115                        irc_usermsg( irc, "Warning: Almost had an infinite loop in nick_get()! "
     116                                          "This used to be a fatal BitlBee bug, but we tried to fix it. "
     117                                          "This message should *never* appear anymore. "
     118                                          "If it does, please *do* send us a bug report! "
     119                                          "Please send all the following lines in your report:" );
     120                       
     121                        irc_usermsg( irc, "Trying to get a sane nick for handle %s", handle );
    121122                        for( i = 0; i < MAX_NICK_LENGTH; i ++ )
    122                                 irc_usermsg( acc->irc, "Char %d: %c/%d", i, nick[i], nick[i] );
    123                        
    124                         irc_usermsg( acc->irc, "FAILED. Returning an insane nick now. Things might break. "
    125                                                "Good luck, and please don't forget to paste the lines up here "
    126                                                "in #bitlbee on OFTC or in a mail to wilmer@gaast.net" );
     123                                irc_usermsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] );
     124                       
     125                        irc_usermsg( irc, "FAILED. Returning an insane nick now. Things might break. "
     126                                          "Good luck, and please don't forget to paste the lines up here "
     127                                          "in #bitlbee on OFTC or in a mail to wilmer@gaast.net" );
    127128                       
    128129                        g_snprintf( nick, MAX_NICK_LENGTH + 1, "xx%x", rand() );
  • protocols/Makefile

    r10a96f4 r81e04e1  
    1010
    1111# [SH] Program variables
    12 #objects = account.o nogaim.o user.o
    13 objects = bee.o bee_user.o nogaim.o
     12objects = account.o bee.o bee_user.o nogaim.o
    1413
    1514
  • protocols/account.c

    r10a96f4 r81e04e1  
    2929#include "chat.h"
    3030
    31 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )
     31account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass )
    3232{
    3333        account_t *a;
    3434        set_t *s;
    3535       
    36         if( irc->accounts )
    37         {
    38                 for( a = irc->accounts; a->next; a = a->next );
     36        if( bee->accounts )
     37        {
     38                for( a = bee->accounts; a->next; a = a->next );
    3939                a = a->next = g_new0( account_t, 1 );
    4040        }
    4141        else
    4242        {
    43                 irc->accounts = a = g_new0 ( account_t, 1 );
     43                bee->accounts = a = g_new0 ( account_t, 1 );
    4444        }
    4545       
     
    4848        a->pass = g_strdup( pass );
    4949        a->auto_connect = 1;
    50         a->irc = irc;
     50        a->bee = bee;
    5151       
    5252        s = set_add( &a->set, "auto_connect", "true", set_eval_account, a );
     
    153153}
    154154
    155 account_t *account_get( irc_t *irc, char *id )
     155account_t *account_get( bee_t *bee, char *id )
    156156{
    157157        account_t *a, *ret = NULL;
     
    169169                if( ( proto = find_protocol( id ) ) )
    170170                {
    171                         for( a = irc->accounts; a; a = a->next )
     171                        for( a = bee->accounts; a; a = a->next )
    172172                                if( a->prpl == proto &&
    173173                                    a->prpl->handle_cmp( handle, a->user ) == 0 )
     
    186186        if( sscanf( id, "%d", &nr ) == 1 && nr < 1000 )
    187187        {
    188                 for( a = irc->accounts; a; a = a->next )
     188                for( a = bee->accounts; a; a = a->next )
    189189                        if( ( nr-- ) == 0 )
    190190                                return( a );
     
    193193        }
    194194       
    195         for( a = irc->accounts; a; a = a->next )
     195        for( a = bee->accounts; a; a = a->next )
    196196        {
    197197                if( g_strcasecmp( id, a->prpl->name ) == 0 )
     
    214214}
    215215
    216 void account_del( irc_t *irc, account_t *acc )
     216void account_del( bee_t *bee, account_t *acc )
    217217{
    218218        account_t *a, *l = NULL;
     
    223223                return;
    224224       
    225         for( a = irc->accounts; a; a = (l=a)->next )
     225        for( a = bee->accounts; a; a = (l=a)->next )
    226226                if( a == acc )
    227227                {
     
    229229                                l->next = a->next;
    230230                        else
    231                                 irc->accounts = a->next;
    232                        
    233                         for( c = irc->chatrooms; c; c = nc )
     231                                bee->accounts = a->next;
     232                       
     233                        /** FIXME
     234                        for( c = bee->chatrooms; c; c = nc )
    234235                        {
    235236                                nc = c->next;
    236237                                if( acc == c->acc )
    237                                         chat_del( irc, c );
     238                                        chat_del( bee, c );
    238239                        }
     240                        */
    239241                       
    240242                        while( a->set )
     
    254256}
    255257
    256 void account_on( irc_t *irc, account_t *a )
     258void account_on( bee_t *bee, account_t *a )
    257259{
    258260        if( a->ic )
     
    268270}
    269271
    270 void account_off( irc_t *irc, account_t *a )
     272void account_off( bee_t *bee, account_t *a )
    271273{
    272274        imc_logout( a->ic, FALSE );
     
    336338int account_reconnect_delay( account_t *a )
    337339{
    338         char *setting = set_getstr( &a->irc->b->set, "auto_reconnect_delay" );
     340        char *setting = set_getstr( &a->bee->set, "auto_reconnect_delay" );
    339341        struct account_reconnect_delay p;
    340342       
  • protocols/account.h

    r10a96f4 r81e04e1  
    4242        GHashTable *nicks;
    4343       
    44         struct irc *irc;
     44        struct bee *bee;
    4545        struct im_connection *ic;
    4646        struct account *next;
    4747} account_t;
    4848
    49 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass );
    50 account_t *account_get( irc_t *irc, char *id );
    51 void account_del( irc_t *irc, account_t *acc );
    52 void account_on( irc_t *irc, account_t *a );
    53 void account_off( irc_t *irc, account_t *a );
     49account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass );
     50account_t *account_get( bee_t *bee, char *id );
     51void account_del( bee_t *bee, account_t *acc );
     52void account_on( bee_t *bee, account_t *a );
     53void account_off( bee_t *bee, account_t *a );
    5454
    5555char *set_eval_account( set_t *set, char *value );
  • protocols/bee.c

    r10a96f4 r81e04e1  
    2424void bee_free( bee_t *b )
    2525{
    26         while( b->accounts )
     26        account_t *acc = b->accounts;
     27       
     28        while( acc )
    2729        {
    28                 account_t *acc = b->accounts->data;
    29                
    30                 /*
    3130                if( acc->ic )
    3231                        imc_logout( acc->ic, FALSE );
    3332                else if( acc->reconnect )
    3433                        cancel_auto_reconnect( acc );
    35                 */
    3634               
    3735                if( acc->ic == NULL )
    38                         {} //account_del( b, acc );
     36                        account_del( b, acc );
    3937                else
    4038                        /* Nasty hack, but account_del() doesn't work in this
    4139                           case and we don't want infinite loops, do we? ;-) */
    42                         b->accounts = g_slist_remove( b->accounts, acc );
     40                        acc = acc->next;
    4341        }
    4442       
    4543        while( b->set )
    4644                set_del( &b->set, b->set->key );
     45       
     46        g_free( b );
    4747}
  • protocols/bee.h

    r10a96f4 r81e04e1  
    3434       
    3535        GSList *users;
    36         GSList *accounts;
     36        struct account *accounts; /* TODO(wilmer): Use GSList here too? */
    3737       
    3838        const struct bee_ui_funcs *ui;
     
    5656        char *group;
    5757
    58         char *away;
     58        bee_user_flags_t flags;
     59        char *status;
    5960        char *status_msg;
    6061       
     
    6768        gboolean (*user_new)( bee_t *bee, struct bee_user *bu );
    6869        gboolean (*user_free)( bee_t *bee, struct bee_user *bu );
     70        gboolean (*user_status)( bee_t *bee, struct bee_user *bu, struct bee_user *old );
    6971} bee_ui_funcs_t;
    7072
  • protocols/bee_user.c

    r10a96f4 r81e04e1  
    5959        g_free( bu->fullname );
    6060        g_free( bu->group );
    61         g_free( bu->away );
     61        g_free( bu->status );
    6262        g_free( bu->status_msg );
    6363       
  • protocols/nogaim.c

    r10a96f4 r81e04e1  
    9292#endif
    9393
    94 /* nogaim.c */
    95 
    9694GList *protocols = NULL;
    9795 
     
    125123}
    126124
    127 /* nogaim.c */
    128125void nogaim_init()
    129126{
     
    156153GSList *get_connections() { return connections; }
    157154
    158 /* multi.c */
    159 
    160155struct im_connection *imcb_new( account_t *acc )
    161156{
     
    164159        ic = g_new0( struct im_connection, 1 );
    165160       
    166         ic->irc = acc->irc;
     161        ic->bee = acc->bee;
    167162        ic->acc = acc;
    168163        acc->ic = ic;
     
    178173       
    179174        /* Destroy the pointer to this connection from the account list */
    180         for( a = ic->irc->accounts; a; a = a->next )
     175        for( a = ic->bee->accounts; a; a = a->next )
    181176                if( a->ic == ic )
    182177                {
     
    199194        va_end( params );
    200195
    201         if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) ||
    202             ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) )
     196        if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
     197            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
    203198                strip_html( text );
    204199       
    205200        /* Try to find a different connection on the same protocol. */
    206         for( a = ic->irc->accounts; a; a = a->next )
     201        for( a = ic->bee->accounts; a; a = a->next )
    207202                if( a->prpl == ic->acc->prpl && a->ic != ic )
    208203                        break;
     
    210205        /* If we found one, include the screenname in the message. */
    211206        if( a )
    212                 irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );
     207                /* FIXME(wilmer): ui_log callback or so */
     208                irc_usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );
    213209        else
    214                 irc_usermsg( ic->irc, "%s - %s", ic->acc->prpl->name, text );
     210                irc_usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text );
    215211       
    216212        g_free( text );
     
    263259void imcb_connected( struct im_connection *ic )
    264260{
    265         irc_t *irc = ic->irc;
    266         struct chat *c;
    267        
    268261        /* MSN servers sometimes redirect you to a different server and do
    269262           the whole login sequence again, so these "late" calls to this
     
    301294       
    302295        a->reconnect = 0;
    303         account_on( a->irc, a );
     296        account_on( a->bee, a );
    304297       
    305298        return( FALSE );        /* Only have to run the timeout once */
     
    314307void imc_logout( struct im_connection *ic, int allow_reconnect )
    315308{
    316         irc_t *irc = ic->irc;
    317         user_t *t, *u;
     309        bee_t *bee = ic->bee;
    318310        account_t *a;
     311        GSList *l;
    319312        int delay;
    320313       
     
    336329        ic->away = NULL;
    337330       
    338         u = irc->users;
    339         while( u )
    340         {
    341                 if( u->ic == ic )
    342                 {
    343                         t = u->next;
    344                         user_del( irc, u->nick );
    345                         u = t;
    346                 }
    347                 else
    348                         u = u->next;
    349         }
    350        
    351         query_del_by_conn( ic->irc, ic );
    352        
    353         for( a = irc->accounts; a; a = a->next )
     331        for( l = bee->users; l; l = l->next )
     332        {
     333                bee_user_t *bu = l->data;
     334               
     335                if( bu->ic == ic )
     336                        bee_user_free( bee, ic, bu->handle );
     337        }
     338       
     339        //query_del_by_conn( ic->irc, ic );
     340       
     341        for( a = bee->accounts; a; a = a->next )
    354342                if( a->ic == ic )
    355343                        break;
     
    359347                /* Uhm... This is very sick. */
    360348        }
    361         else if( allow_reconnect && set_getbool( &irc->b->set, "auto_reconnect" ) &&
     349        else if( allow_reconnect && set_getbool( &bee->set, "auto_reconnect" ) &&
    362350                 set_getbool( &a->set, "auto_reconnect" ) &&
    363351                 ( delay = account_reconnect_delay( a ) ) > 0 )
     
    370358}
    371359
    372 
    373 /* dialogs.c */
    374 
    375360void imcb_ask( struct im_connection *ic, char *msg, void *data,
    376361               query_callback doit, query_callback dont )
    377362{
    378         query_add( ic->irc, ic, msg, doit, dont, data );
    379 }
    380 
    381 
    382 /* list.c */
     363        //query_add( ic->irc, ic, msg, doit, dont, data );
     364}
    383365
    384366void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group )
    385367{
    386         user_t *u;
    387         char nick[MAX_NICK_LENGTH+1], *s;
    388         irc_t *irc = ic->irc;
    389        
    390         if( user_findhandle( ic, handle ) )
    391         {
    392                 if( set_getbool( &irc->b->set, "debug" ) )
     368        bee_user_t *bu;
     369        //char nick[MAX_NICK_LENGTH+1], *s;
     370        bee_t *bee = ic->bee;
     371       
     372        if( bee_user_by_handle( bee, ic, handle ) )
     373        {
     374                if( set_getbool( &bee->set, "debug" ) )
    393375                        imcb_log( ic, "User already exists, ignoring add request: %s", handle );
    394376               
     
    401383        }
    402384       
    403         memset( nick, 0, MAX_NICK_LENGTH + 1 );
    404         strcpy( nick, nick_get( ic->acc, handle ) );
    405        
    406         u = user_add( ic->irc, nick );
    407        
    408 //      if( !realname || !*realname ) realname = nick;
    409 //      u->realname = g_strdup( realname );
    410        
    411         if( ( s = strchr( handle, '@' ) ) )
    412         {
    413                 u->host = g_strdup( s + 1 );
    414                 u->user = g_strndup( handle, s - handle );
    415         }
    416         else if( ic->acc->server )
    417         {
    418                 u->host = g_strdup( ic->acc->server );
    419                 u->user = g_strdup( handle );
    420                
    421                 /* s/ /_/ ... important for AOL screennames */
    422                 for( s = u->user; *s; s ++ )
    423                         if( *s == ' ' )
    424                                 *s = '_';
    425         }
    426         else
    427         {
    428                 u->host = g_strdup( ic->acc->prpl->name );
    429                 u->user = g_strdup( handle );
    430         }
    431        
    432         u->ic = ic;
    433         u->handle = g_strdup( handle );
    434         if( group ) u->group = g_strdup( group );
    435         u->send_handler = buddy_send_handler;
    436         u->last_typing_notice = 0;
    437 }
    438 
    439 struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle )
    440 {
    441         static struct buddy b[1];
    442         user_t *u;
    443        
    444         u = user_findhandle( ic, handle );
    445        
    446         if( !u )
    447                 return( NULL );
    448        
    449         memset( b, 0, sizeof( b ) );
    450         strncpy( b->name, handle, 80 );
    451         strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN );
    452         b->present = u->online;
    453         b->ic = u->ic;
    454        
    455         return( b );
     385        bu = bee_user_new( bee, ic, handle );
     386        bu->group = g_strdup( group );
    456387}
    457388
    458389void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname )
    459390{
     391#if 0
    460392        user_t *u = user_findhandle( ic, handle );
    461393        char *set;
     
    469401                u->realname = g_strdup( realname );
    470402               
    471                 if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->b->set, "display_namechanges" ) )
     403                if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->bee->set, "display_namechanges" ) )
    472404                        imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
    473405        }
     
    489421                g_free( name );
    490422        }
     423#endif
    491424}
    492425
    493426void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group )
    494427{
    495         user_t *u;
    496        
    497         if( ( u = user_findhandle( ic, handle ) ) )
    498                 user_del( ic->irc, u->nick );
     428        bee_user_free( ic->bee, ic, handle );
    499429}
    500430
     
    503433void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick )
    504434{
     435#if 0
    505436        user_t *u = user_findhandle( ic, handle );
    506437        char newnick[MAX_NICK_LENGTH+1], *orig_nick;
     
    517448                /* Some processing to make sure this string is a valid IRC nickname. */
    518449                nick_strip( newnick );
    519                 if( set_getbool( &ic->irc->b->set, "lcnicks" ) )
     450                if( set_getbool( &ic->bee->set, "lcnicks" ) )
    520451                        nick_lc( newnick );
    521452               
     
    534465                }
    535466        }
     467#endif
    536468}
    537469
     
    565497void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname )
    566498{
     499#if 0
    567500        struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
    568501        char *s, *realname_ = NULL;
     
    579512        data->handle = g_strdup( handle );
    580513        query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data );
     514#endif
    581515}
    582516
     
    599533void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname )
    600534{
     535#if 0
    601536        struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
    602537        char *s;
     
    611546        data->handle = g_strdup( handle );
    612547        query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data );
    613 }
    614 
    615 
    616 /* server.c */                   
     548#endif
     549}
    617550
    618551void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message )
    619552{
    620         user_t *u;
    621         int oa, oo;
    622        
    623         u = user_findhandle( ic, (char*) handle );
    624        
    625         if( !u )
    626         {
    627                 if( g_strcasecmp( set_getstr( &ic->irc->b->set, "handle_unknown" ), "add" ) == 0 )
    628                 {
    629                         imcb_add_buddy( ic, (char*) handle, NULL );
    630                         u = user_findhandle( ic, (char*) handle );
     553        bee_t *bee = ic->bee;
     554        bee_user_t *bu, *old;
     555       
     556        if( !( bu = bee_user_by_handle( bee, ic, handle ) ) )
     557        {
     558                if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "add" ) == 0 )
     559                {
     560                        bu = bee_user_new( bee, ic, handle );
    631561                }
    632562                else
    633563                {
    634                         if( set_getbool( &ic->irc->b->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->b->set, "handle_unknown" ), "ignore" ) != 0 )
     564                        if( set_getbool( &ic->bee->set, "debug" ) || g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 )
    635565                        {
    636566                                imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle );
     
    643573        }
    644574       
     575        /* May be nice to give the UI something to compare against. */
     576        old = g_memdup( bu, sizeof( bee_user_t ) );
     577       
     578        /* TODO(wilmer): OPT_AWAY, or just state == NULL ? */
     579        bu->flags = ( flags & OPT_LOGGED_IN ? BEE_USER_ONLINE : 0 ) |
     580                    ( flags & OPT_AWAY ? BEE_USER_AWAY : 0 );
     581        bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state );
     582        bu->status_msg = g_strdup( message );
     583       
     584        if( bee->ui->user_status )
     585                bee->ui->user_status( bee, bu, old );
     586       
     587        g_free( old->status_msg );
     588        g_free( old->status );
     589        g_free( old );
     590#if 0   
    645591        oa = u->away != NULL;
    646592        oo = u->online;
     
    692638       
    693639        /* LISPy... */
    694         if( ( set_getbool( &ic->irc->b->set, "away_devoice" ) ) &&              /* Don't do a thing when user doesn't want it */
     640        if( ( set_getbool( &ic->bee->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
    695641            ( u->online ) &&                                            /* Don't touch offline people */
    696642            ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
     
    699645                char *from;
    700646               
    701                 if( set_getbool( &ic->irc->b->set, "simulate_netsplit" ) )
     647                if( set_getbool( &ic->bee->set, "simulate_netsplit" ) )
    702648                {
    703649                        from = g_strdup( ic->irc->myhost );
     
    712658                g_free( from );
    713659        }
     660#endif
    714661}
    715662
    716663void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
    717664{
    718         irc_t *irc = ic->irc;
     665#if 0
     666        bee_t *bee = ic->bee;
    719667        char *wrapped;
    720668        user_t *u;
     
    724672        if( !u )
    725673        {
    726                 char *h = set_getstr( &irc->b->set, "handle_unknown" );
     674                char *h = set_getstr( &bee->set, "handle_unknown" );
    727675               
    728676                if( g_strcasecmp( h, "ignore" ) == 0 )
    729677                {
    730                         if( set_getbool( &irc->b->set, "debug" ) )
     678                        if( set_getbool( &bee->set, "debug" ) )
    731679                                imcb_log( ic, "Ignoring message from unknown handle %s", handle );
    732680                       
     
    735683                else if( g_strncasecmp( h, "add", 3 ) == 0 )
    736684                {
    737                         int private = set_getbool( &irc->b->set, "private" );
     685                        int private = set_getbool( &bee->set, "private" );
    738686                       
    739687                        if( h[3] )
     
    756704        }
    757705       
    758         if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) ||
    759             ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) )
     706        if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
     707            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
    760708                strip_html( msg );
    761709
     
    763711        irc_msgfrom( irc, u->nick, wrapped );
    764712        g_free( wrapped );
     713#endif
    765714}
    766715
    767716void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags )
    768717{
     718#if 0
    769719        user_t *u;
    770720       
    771         if( !set_getbool( &ic->irc->b->set, "typing_notice" ) )
     721        if( !set_getbool( &ic->bee->set, "typing_notice" ) )
    772722                return;
    773723       
     
    779729                irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf );
    780730        }
     731#endif
     732}
     733
     734struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle )
     735{
     736        return bee_user_by_handle( ic->bee, ic, handle );
    781737}
    782738
    783739struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle )
    784740{
     741#if 0
    785742        struct groupchat *c;
    786743       
     
    800757        c->topic = g_strdup_printf( "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", c->title );
    801758       
    802         if( set_getbool( &ic->irc->b->set, "debug" ) )
     759        if( set_getbool( &ic->bee->set, "debug" ) )
    803760                imcb_log( ic, "Creating new conversation: (id=%p,handle=%s)", c, handle );
    804761       
    805762        return c;
     763#endif
    806764}
    807765
    808766void imcb_chat_free( struct groupchat *c )
    809767{
     768#if 0
    810769        struct im_connection *ic = c->ic;
    811770        struct groupchat *l;
    812771        GList *ir;
    813772       
    814         if( set_getbool( &ic->irc->b->set, "debug" ) )
     773        if( set_getbool( &ic->bee->set, "debug" ) )
    815774                imcb_log( ic, "You were removed from conversation %p", c );
    816775       
     
    845804                g_free( c );
    846805        }
     806#endif
    847807}
    848808
    849809void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at )
    850810{
     811#if 0
    851812        struct im_connection *ic = c->ic;
    852813        char *wrapped;
     
    859820        u = user_findhandle( ic, who );
    860821       
    861         if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) ||
    862             ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) )
     822        if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
     823            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
    863824                strip_html( msg );
    864825       
     
    873834        }
    874835        g_free( wrapped );
     836#endif
    875837}
    876838
    877839void imcb_chat_log( struct groupchat *c, char *format, ... )
    878840{
     841#if 0
    879842        irc_t *irc = c->ic->irc;
    880843        va_list params;
     
    891854       
    892855        g_free( text );
     856#endif
    893857}
    894858
    895859void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at )
    896860{
     861#if 0
    897862        struct im_connection *ic = c->ic;
    898863        user_t *u = NULL;
     
    905870                u = user_findhandle( ic, who );
    906871       
    907         if( ( g_strcasecmp( set_getstr( &ic->irc->b->set, "strip_html" ), "always" ) == 0 ) ||
    908             ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->b->set, "strip_html" ) ) )
     872        if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
     873            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
    909874                strip_html( topic );
    910875       
     
    914879        if( c->joined && u )
    915880                irc_write( ic->irc, ":%s!%s@%s TOPIC %s :%s", u->nick, u->user, u->host, c->channel, topic );
    916 }
    917 
    918 
    919 /* buddy_chat.c */
     881#endif
     882}
    920883
    921884void imcb_chat_add_buddy( struct groupchat *b, const char *handle )
    922885{
     886#if 0
    923887        user_t *u = user_findhandle( b->ic, handle );
    924888        int me = 0;
    925889       
    926         if( set_getbool( &b->ic->irc->b->set, "debug" ) )
     890        if( set_getbool( &b->ic->bee->set, "debug" ) )
    927891                imcb_log( b->ic, "User %s added to conversation %p", handle, b );
    928892       
     
    951915                b->in_room = g_list_append( b->in_room, g_strdup( handle ) );
    952916        }
     917#endif
    953918}
    954919
     
    956921void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason )
    957922{
     923#if 0
    958924        user_t *u;
    959925        int me = 0;
    960926       
    961         if( set_getbool( &b->ic->irc->b->set, "debug" ) )
     927        if( set_getbool( &b->ic->bee->set, "debug" ) )
    962928                imcb_log( b->ic, "User %s removed from conversation %p (%s)", handle, b, reason ? reason : "" );
    963929       
     
    979945        if( me || ( remove_chat_buddy_silent( b, handle ) && b->joined && u ) )
    980946                irc_part( b->ic->irc, u, b->channel );
     947#endif
    981948}
    982949
    983950static int remove_chat_buddy_silent( struct groupchat *b, const char *handle )
    984951{
     952#if 0
    985953        GList *i;
    986954       
     
    998966                i = i->next;
    999967        }
    1000        
    1001         return( 0 );
     968#endif
     969       
     970        return 0;
    1002971}
    1003972
    1004973
    1005974/* Misc. BitlBee stuff which shouldn't really be here */
    1006 
     975#if 0
    1007976char *set_eval_away_devoice( set_t *set, char *value )
    1008977{
     
    10591028        return value;
    10601029}
    1061 
     1030#endif
    10621031
    10631032
     
    11061075       
    11071076        away = set_getstr( &ic->acc->set, "away" ) ?
    1108              : set_getstr( &ic->irc->b->set, "away" );
     1077             : set_getstr( &ic->bee->set, "away" );
    11091078        if( away && *away )
    11101079        {
     
    11171086                away = NULL;
    11181087                msg = set_getstr( &ic->acc->set, "status" ) ?
    1119                     : set_getstr( &ic->irc->b->set, "status" );
     1088                    : set_getstr( &ic->bee->set, "status" );
    11201089        }
    11211090       
  • protocols/nogaim.h

    r10a96f4 r81e04e1  
    8787       
    8888        /* BitlBee */
    89         irc_t *irc;
     89        bee_t *bee;
    9090       
    9191        struct groupchat *groupchats;
  • protocols/oscar/oscar.c

    r10a96f4 r81e04e1  
    11901190        aim_ssi_auth_reply(od->sess, od->conn, uin, 1, "");
    11911191        // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
    1192         if(imcb_find_buddy(data->ic, uin) == NULL)
    1193                 imcb_ask_add(data->ic, uin, NULL);
     1192        imcb_ask_add(data->ic, uin, NULL);
    11941193       
    11951194        g_free(uin);
     
    19521951        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    19531952        if (odata->icq) {
     1953                /** FIXME(wilmer): Hmm, lost the ability to get away msgs here, do we care to get that back?
    19541954                struct buddy *budlight = imcb_find_buddy(g, who);
    19551955                if (budlight)
     
    19571957                                if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
    19581958                                        aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7);
     1959                */
    19591960        } else
    19601961                aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_AWAYMESSAGE);
     
    20942095                switch (curitem->type) {
    20952096                        case 0x0000: /* Buddy */
    2096                                 if ((curitem->name) && (!imcb_find_buddy(ic, nrm))) {
     2097                                if ((curitem->name) && (!imcb_buddy_by_handle(ic, nrm))) {
    20972098                                        char *realname = NULL;
    20982099
Note: See TracChangeset for help on using the changeset viewer.