Changeset d860a8d


Ignore:
Timestamp:
2010-04-01T03:38:50Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e63507a
Parents:
81e04e1
Message:

Restored "account" root command and restored enough stuff to be able to
send messages. Also started moving stuff out from nogaim.* into bee_* files.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r81e04e1 rd860a8d  
    9494       
    9595        b = irc->b = bee_new();
     96        b->ui_data = irc;
     97        b->ui = &irc_ui_funcs;
    9698       
    9799        s = set_add( &b->set, "away_devoice", "true", NULL/*set_eval_away_devoice*/, irc );
  • irc.h

    r81e04e1 rd860a8d  
    7575       
    7676        struct query *queries;
    77         struct account *accounts;
    7877        GSList *file_transfers;
    7978       
     
    113112        //int sendbuf_flags;
    114113       
    115         //struct user *b;
     114        struct bee_user *bu;
    116115       
    117116        const struct irc_user_funcs *f;
     
    152151        gboolean (*privmsg)( irc_channel_t *iu, const char *msg );
    153152};
     153
     154extern const struct bee_ui_funcs irc_ui_funcs;
    154155
    155156/* irc.c */
  • irc_commands.c

    r81e04e1 rd860a8d  
    309309}
    310310
     311static void irc_cmd_nickserv( irc_t *irc, char **cmd )
     312{
     313        /* [SH] This aliases the NickServ command to PRIVMSG root */
     314        /* [TV] This aliases the NS command to PRIVMSG root as well */
     315        root_command( irc, cmd + 1 );
     316}
     317
    311318
    312319
     
    516523       
    517524        set_setstr( &irc->set, "away", u->away );
    518 }
    519 
    520 static void irc_cmd_nickserv( irc_t *irc, char **cmd )
    521 {
    522         /* [SH] This aliases the NickServ command to PRIVMSG root */
    523         /* [TV] This aliases the NS command to PRIVMSG root as well */
    524         root_command( irc, cmd + 1 );
    525525}
    526526
     
    578578        { "who",         0, irc_cmd_who,         IRC_CMD_LOGGED_IN },
    579579        { "privmsg",     1, irc_cmd_privmsg,     IRC_CMD_LOGGED_IN },
     580        { "nickserv",    1, irc_cmd_nickserv,    IRC_CMD_LOGGED_IN },
     581        { "ns",          1, irc_cmd_nickserv,    IRC_CMD_LOGGED_IN },
    580582#if 0
    581583        { "oper",        2, irc_cmd_oper,        IRC_CMD_LOGGED_IN },
     
    587589        { "topic",       1, irc_cmd_topic,       IRC_CMD_LOGGED_IN },
    588590        { "away",        0, irc_cmd_away,        IRC_CMD_LOGGED_IN },
    589         { "nickserv",    1, irc_cmd_nickserv,    IRC_CMD_LOGGED_IN },
    590         { "ns",          1, irc_cmd_nickserv,    IRC_CMD_LOGGED_IN },
    591591        { "version",     0, irc_cmd_version,     IRC_CMD_LOGGED_IN },
    592592        { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN },
  • irc_im.c

    r81e04e1 rd860a8d  
    2626#include "bitlbee.h"
    2727
     28
     29/* IM->IRC callbacks */
     30
    2831static const struct irc_user_funcs irc_user_im_funcs;
    29 static const struct bee_ui_funcs irc_ui_funcs;
    3032
    3133static gboolean bee_irc_user_new( bee_t *bee, bee_user_t *bu )
     
    3739        strcpy( nick, nick_get( bu->ic->acc, bu->handle ) );
    3840       
    39         iu = irc_user_new( (irc_t*) bee->ui_data, nick );
     41        bu->ui_data = iu = irc_user_new( (irc_t*) bee->ui_data, nick );
     42        iu->bu = bu;
    4043       
    4144        if( ( s = strchr( bu->handle, '@' ) ) )
     
    6669}
    6770
     71static gboolean bee_irc_user_free( bee_t *bee, bee_user_t *bu )
     72{
     73        return irc_user_free( bee->ui_data, bu->ui_data );
     74}
     75
     76static gboolean bee_irc_user_status( bee_t *bee, bee_user_t *bu, bee_user_t *old )
     77{
     78        return TRUE;
     79}
     80
     81const struct bee_ui_funcs irc_ui_funcs = {
     82        bee_irc_user_new,
     83        bee_irc_user_free,
     84        bee_irc_user_status,
     85};
    6886
    6987
    70 static const struct bee_ui_funcs irc_ui_funcs = {
    71         bee_irc_user_new,
    72 };
     88/* IRC->IM calls */
     89
     90static gboolean bee_irc_user_privmsg( irc_user_t *iu, const char *msg )
     91{
     92        if( iu->bu )
     93                return bee_user_msg( iu->irc->b, iu->bu, msg, 0 );
     94        else
     95                return FALSE;
     96}
    7397
    7498static const struct irc_user_funcs irc_user_im_funcs = {
     99        bee_irc_user_privmsg,
    75100};
  • protocols/bee.h

    r81e04e1 rd860a8d  
    8080int bee_user_free( bee_t *bee, struct im_connection *ic, const char *handle );
    8181bee_user_t *bee_user_by_handle( bee_t *bee, struct im_connection *ic, const char *handle );
     82int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags );
     83
     84/* Callbacks from IM modules to core: */
     85/* Buddy activity */
     86/* To manipulate the status of a handle.
     87 * - flags can be |='d with OPT_* constants. You will need at least:
     88 *   OPT_LOGGED_IN and OPT_AWAY.
     89 * - 'state' and 'message' can be NULL */
     90G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message );
     91/* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle );
     92/* Call when a handle says something. 'flags' and 'sent_at may be just 0. */
     93G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at );
    8294
    8395#endif /* __BEE_H__ */
  • protocols/bee_user.c

    r81e04e1 rd860a8d  
    8181        return NULL;
    8282}
     83
     84int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags )
     85{
     86        char *buf = NULL;
     87        int st;
     88       
     89        if( ( bu->ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
     90        {
     91                buf = escape_html( msg );
     92                msg = buf;
     93        }
     94       
     95        st = bu->ic->acc->prpl->buddy_msg( bu->ic, bu->handle, msg, flags );
     96        g_free( buf );
     97       
     98        return st;
     99}
     100
     101
     102/* IM->UI callbacks */
     103void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message )
     104{
     105        bee_t *bee = ic->bee;
     106        bee_user_t *bu, *old;
     107       
     108        if( !( bu = bee_user_by_handle( bee, ic, handle ) ) )
     109        {
     110                if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "add" ) == 0 )
     111                {
     112                        bu = bee_user_new( bee, ic, handle );
     113                }
     114                else
     115                {
     116                        if( set_getbool( &ic->bee->set, "debug" ) || g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 )
     117                        {
     118                                imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle );
     119                                imcb_log( ic, "flags = %d, state = %s, message = %s", flags,
     120                                          state ? state : "NULL", message ? message : "NULL" );
     121                        }
     122                       
     123                        return;
     124                }
     125        }
     126       
     127        /* May be nice to give the UI something to compare against. */
     128        old = g_memdup( bu, sizeof( bee_user_t ) );
     129       
     130        /* TODO(wilmer): OPT_AWAY, or just state == NULL ? */
     131        bu->flags = ( flags & OPT_LOGGED_IN ? BEE_USER_ONLINE : 0 ) |
     132                    ( flags & OPT_AWAY ? BEE_USER_AWAY : 0 );
     133        bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state );
     134        bu->status_msg = g_strdup( message );
     135       
     136        if( bee->ui->user_status )
     137                bee->ui->user_status( bee, bu, old );
     138       
     139        g_free( old->status_msg );
     140        g_free( old->status );
     141        g_free( old );
     142#if 0   
     143        oa = u->away != NULL;
     144        oo = u->online;
     145       
     146        g_free( u->away );
     147        g_free( u->status_msg );
     148        u->away = u->status_msg = NULL;
     149       
     150        if( ( flags & OPT_LOGGED_IN ) && !u->online )
     151        {
     152                irc_spawn( ic->irc, u );
     153                u->online = 1;
     154        }
     155        else if( !( flags & OPT_LOGGED_IN ) && u->online )
     156        {
     157                struct groupchat *c;
     158               
     159                irc_kill( ic->irc, u );
     160                u->online = 0;
     161               
     162                /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
     163                for( c = ic->groupchats; c; c = c->next )
     164                        remove_chat_buddy_silent( c, handle );
     165        }
     166       
     167        if( flags & OPT_AWAY )
     168        {
     169                if( state && message )
     170                {
     171                        u->away = g_strdup_printf( "%s (%s)", state, message );
     172                }
     173                else if( state )
     174                {
     175                        u->away = g_strdup( state );
     176                }
     177                else if( message )
     178                {
     179                        u->away = g_strdup( message );
     180                }
     181                else
     182                {
     183                        u->away = g_strdup( "Away" );
     184                }
     185        }
     186        else
     187        {
     188                u->status_msg = g_strdup( message );
     189        }
     190       
     191        /* LISPy... */
     192        if( ( set_getbool( &ic->bee->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
     193            ( u->online ) &&                                            /* Don't touch offline people */
     194            ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
     195              ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
     196        {
     197                char *from;
     198               
     199                if( set_getbool( &ic->bee->set, "simulate_netsplit" ) )
     200                {
     201                        from = g_strdup( ic->irc->myhost );
     202                }
     203                else
     204                {
     205                        from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick,
     206                                                            ic->irc->myhost );
     207                }
     208                irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
     209                                                          u->away?'-':'+', u->nick );
     210                g_free( from );
     211        }
     212#endif
     213}
     214
     215void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
     216{
     217#if 0
     218        bee_t *bee = ic->bee;
     219        char *wrapped;
     220        user_t *u;
     221       
     222        u = user_findhandle( ic, handle );
     223       
     224        if( !u )
     225        {
     226                char *h = set_getstr( &bee->set, "handle_unknown" );
     227               
     228                if( g_strcasecmp( h, "ignore" ) == 0 )
     229                {
     230                        if( set_getbool( &bee->set, "debug" ) )
     231                                imcb_log( ic, "Ignoring message from unknown handle %s", handle );
     232                       
     233                        return;
     234                }
     235                else if( g_strncasecmp( h, "add", 3 ) == 0 )
     236                {
     237                        int private = set_getbool( &bee->set, "private" );
     238                       
     239                        if( h[3] )
     240                        {
     241                                if( g_strcasecmp( h + 3, "_private" ) == 0 )
     242                                        private = 1;
     243                                else if( g_strcasecmp( h + 3, "_channel" ) == 0 )
     244                                        private = 0;
     245                        }
     246                       
     247                        imcb_add_buddy( ic, handle, NULL );
     248                        u = user_findhandle( ic, handle );
     249                        u->is_private = private;
     250                }
     251                else
     252                {
     253                        imcb_log( ic, "Message from unknown handle %s:", handle );
     254                        u = user_find( irc, irc->mynick );
     255                }
     256        }
     257       
     258        if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
     259            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
     260                strip_html( msg );
     261
     262        wrapped = word_wrap( msg, 425 );
     263        irc_msgfrom( irc, u->nick, wrapped );
     264        g_free( wrapped );
     265#endif
     266}
  • protocols/nogaim.c

    r81e04e1 rd860a8d  
    546546        data->handle = g_strdup( handle );
    547547        query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data );
    548 #endif
    549 }
    550 
    551 void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message )
    552 {
    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 );
    561                 }
    562                 else
    563                 {
    564                         if( set_getbool( &ic->bee->set, "debug" ) || g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 )
    565                         {
    566                                 imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle );
    567                                 imcb_log( ic, "flags = %d, state = %s, message = %s", flags,
    568                                           state ? state : "NULL", message ? message : "NULL" );
    569                         }
    570                        
    571                         return;
    572                 }
    573         }
    574        
    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   
    591         oa = u->away != NULL;
    592         oo = u->online;
    593        
    594         g_free( u->away );
    595         g_free( u->status_msg );
    596         u->away = u->status_msg = NULL;
    597        
    598         if( ( flags & OPT_LOGGED_IN ) && !u->online )
    599         {
    600                 irc_spawn( ic->irc, u );
    601                 u->online = 1;
    602         }
    603         else if( !( flags & OPT_LOGGED_IN ) && u->online )
    604         {
    605                 struct groupchat *c;
    606                
    607                 irc_kill( ic->irc, u );
    608                 u->online = 0;
    609                
    610                 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
    611                 for( c = ic->groupchats; c; c = c->next )
    612                         remove_chat_buddy_silent( c, handle );
    613         }
    614        
    615         if( flags & OPT_AWAY )
    616         {
    617                 if( state && message )
    618                 {
    619                         u->away = g_strdup_printf( "%s (%s)", state, message );
    620                 }
    621                 else if( state )
    622                 {
    623                         u->away = g_strdup( state );
    624                 }
    625                 else if( message )
    626                 {
    627                         u->away = g_strdup( message );
    628                 }
    629                 else
    630                 {
    631                         u->away = g_strdup( "Away" );
    632                 }
    633         }
    634         else
    635         {
    636                 u->status_msg = g_strdup( message );
    637         }
    638        
    639         /* LISPy... */
    640         if( ( set_getbool( &ic->bee->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
    641             ( u->online ) &&                                            /* Don't touch offline people */
    642             ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
    643               ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
    644         {
    645                 char *from;
    646                
    647                 if( set_getbool( &ic->bee->set, "simulate_netsplit" ) )
    648                 {
    649                         from = g_strdup( ic->irc->myhost );
    650                 }
    651                 else
    652                 {
    653                         from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick,
    654                                                             ic->irc->myhost );
    655                 }
    656                 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
    657                                                           u->away?'-':'+', u->nick );
    658                 g_free( from );
    659         }
    660 #endif
    661 }
    662 
    663 void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
    664 {
    665 #if 0
    666         bee_t *bee = ic->bee;
    667         char *wrapped;
    668         user_t *u;
    669        
    670         u = user_findhandle( ic, handle );
    671        
    672         if( !u )
    673         {
    674                 char *h = set_getstr( &bee->set, "handle_unknown" );
    675                
    676                 if( g_strcasecmp( h, "ignore" ) == 0 )
    677                 {
    678                         if( set_getbool( &bee->set, "debug" ) )
    679                                 imcb_log( ic, "Ignoring message from unknown handle %s", handle );
    680                        
    681                         return;
    682                 }
    683                 else if( g_strncasecmp( h, "add", 3 ) == 0 )
    684                 {
    685                         int private = set_getbool( &bee->set, "private" );
    686                        
    687                         if( h[3] )
    688                         {
    689                                 if( g_strcasecmp( h + 3, "_private" ) == 0 )
    690                                         private = 1;
    691                                 else if( g_strcasecmp( h + 3, "_channel" ) == 0 )
    692                                         private = 0;
    693                         }
    694                        
    695                         imcb_add_buddy( ic, handle, NULL );
    696                         u = user_findhandle( ic, handle );
    697                         u->is_private = private;
    698                 }
    699                 else
    700                 {
    701                         imcb_log( ic, "Message from unknown handle %s:", handle );
    702                         u = user_find( irc, irc->mynick );
    703                 }
    704         }
    705        
    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" ) ) )
    708                 strip_html( msg );
    709 
    710         wrapped = word_wrap( msg, 425 );
    711         irc_msgfrom( irc, u->nick, wrapped );
    712         g_free( wrapped );
    713548#endif
    714549}
     
    1035870   them all from some wrappers. We'll start to define some down here: */
    1036871
    1037 int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags )
    1038 {
    1039         char *buf = NULL;
    1040         int st;
    1041        
    1042         if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
    1043         {
    1044                 buf = escape_html( msg );
    1045                 msg = buf;
    1046         }
    1047        
    1048         st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags );
    1049         g_free( buf );
    1050        
    1051         return st;
    1052 }
    1053 
    1054872int imc_chat_msg( struct groupchat *c, char *msg, int flags )
    1055873{
  • protocols/nogaim.h

    r81e04e1 rd860a8d  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2010 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    286286G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick );
    287287
    288 /* Buddy activity */
    289 /* To manipulate the status of a handle.
    290  * - flags can be |='d with OPT_* constants. You will need at least:
    291  *   OPT_LOGGED_IN and OPT_AWAY.
    292  * - 'state' and 'message' can be NULL */
    293 G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message );
    294 /* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle );
    295 /* Call when a handle says something. 'flags' and 'sent_at may be just 0. */
    296 G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at );
    297288G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags );
     289G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle );
    298290G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle );
    299291
     
    320312/* Actions, or whatever. */
    321313int imc_away_send_update( struct im_connection *ic );
    322 int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags );
    323314int imc_chat_msg( struct groupchat *c, char *msg, int flags );
    324315
  • root_commands.c

    r81e04e1 rd860a8d  
    221221        }
    222222}
     223#endif
    223224
    224225struct cmd_account_del_data
     
    233234        account_t *a;
    234235       
    235         for( a = cad->irc->accounts; a && a != cad->a; a = a->next );
     236        for( a = cad->irc->b->accounts; a && a != cad->a; a = a->next );
    236237       
    237238        if( a == NULL )
     
    245246        else
    246247        {
    247                 account_del( cad->irc, a );
     248                account_del( cad->irc->b, a );
    248249                irc_usermsg( cad->irc, "Account deleted" );
    249250        }
     
    286287                set_name = set_full;
    287288               
    288                 head = &irc->set;
     289                head = &irc->b->set;
    289290        }
    290291        else
     
    357358        account_t *a;
    358359       
    359         if( ( a = account_get( irc, id ) ) )
     360        if( ( a = account_get( irc->b, id ) ) )
    360361                return &a->set;
    361362        else
     
    405406                }
    406407
    407                 a = account_add( irc, prpl, cmd[3], cmd[4] );
     408                a = account_add( irc->b, prpl, cmd[3], cmd[4] );
    408409                if( cmd[5] )
    409410                {
     
    419420                MIN_ARGS( 2 );
    420421
    421                 if( !( a = account_get( irc, cmd[2] ) ) )
     422                if( !( a = account_get( irc->b, cmd[2] ) ) )
    422423                {
    423424                        irc_usermsg( irc, "Invalid account" );
     
    441442                                               "set' command. Are you sure you want to delete this "
    442443                                               "account?", a->prpl->name, a->user );
    443                         query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad );
     444                        //query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad );
    444445                        g_free( msg );
    445446                }
     
    452453                        irc_usermsg( irc, "Account list:" );
    453454               
    454                 for( a = irc->accounts; a; a = a->next )
     455                for( a = irc->b->accounts; a; a = a->next )
    455456                {
    456457                        char *con;
     
    475476                if( cmd[2] )
    476477                {
    477                         if( ( a = account_get( irc, cmd[2] ) ) )
     478                        if( ( a = account_get( irc->b, cmd[2] ) ) )
    478479                        {
    479480                                if( a->ic )
     
    484485                                else
    485486                                {
    486                                         account_on( irc, a );
     487                                        account_on( irc->b, a );
    487488                                }
    488489                        }
     
    495496                else
    496497                {
    497                         if ( irc->accounts ) {
     498                        if ( irc->b->accounts )
     499                        {
    498500                                irc_usermsg( irc, "Trying to get all accounts connected..." );
    499501                       
    500                                 for( a = irc->accounts; a; a = a->next )
     502                                for( a = irc->b->accounts; a; a = a->next )
    501503                                        if( !a->ic && a->auto_connect )
    502                                                 account_on( irc, a );
     504                                                account_on( irc->b, a );
    503505                        }
    504506                        else
     
    514516                        irc_usermsg( irc, "Deactivating all active (re)connections..." );
    515517                       
    516                         for( a = irc->accounts; a; a = a->next )
     518                        for( a = irc->b->accounts; a; a = a->next )
    517519                        {
    518520                                if( a->ic )
    519                                         account_off( irc, a );
     521                                        account_off( irc->b, a );
    520522                                else if( a->reconnect )
    521523                                        cancel_auto_reconnect( a );
    522524                        }
    523525                }
    524                 else if( ( a = account_get( irc, cmd[2] ) ) )
     526                else if( ( a = account_get( irc->b, cmd[2] ) ) )
    525527                {
    526528                        if( a->ic )
    527529                        {
    528                                 account_off( irc, a );
     530                                account_off( irc->b, a );
    529531                        }
    530532                        else if( a->reconnect )
     
    557559}
    558560
     561#if 0
    559562static void cmd_add( irc_t *irc, char **cmd )
    560563{
     
    12221225const command_t commands[] = {
    12231226        { "help",           0, cmd_help,           0 },
     1227        { "account",        1, cmd_account,        0 },
    12241228#if 0
    12251229        { "identify",       1, cmd_identify,       0 },
    12261230        { "register",       1, cmd_register,       0 },
    12271231        { "drop",           1, cmd_drop,           0 },
    1228         { "account",        1, cmd_account,        0 },
    12291232        { "add",            2, cmd_add,            0 },
    12301233        { "info",           1, cmd_info,           0 },
  • unix.c

    r81e04e1 rd860a8d  
    6262       
    6363        b_main_init();
    64         //nogaim_init();
     64        nogaim_init();
    6565       
    6666        srand( time( NULL ) ^ getpid() );
Note: See TracChangeset for help on using the changeset viewer.