Changeset 1f92a58


Ignore:
Timestamp:
2010-04-10T02:27:50Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
17a6ee9
Parents:
57c96f7
Message:

Restore the storage module.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r57c96f7 r1f92a58  
    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_im.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 storage.o $(STORAGE_OBJS)
    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.c

    r57c96f7 r1f92a58  
    259259       
    260260        return( TRUE );
     261}
     262
     263/* USE WITH CAUTION!
     264   Sets pass without checking */
     265void irc_setpass (irc_t *irc, const char *pass)
     266{
     267        g_free (irc->password);
     268       
     269        if (pass) {
     270                irc->password = g_strdup (pass);
     271        } else {
     272                irc->password = NULL;
     273        }
    261274}
    262275
  • irc.h

    r57c96f7 r1f92a58  
    160160void irc_abort( irc_t *irc, int immed, char *format, ... ) G_GNUC_PRINTF( 3, 4 );
    161161void irc_free( irc_t *irc );
     162void irc_setpass (irc_t *irc, const char *pass);
    162163
    163164void irc_process( irc_t *irc );
  • root_commands.c

    r57c96f7 r1f92a58  
    136136}
    137137
    138 #if 0
    139138static void cmd_account( irc_t *irc, char **cmd );
    140139
     
    162161                irc->status |= USTATUS_IDENTIFIED;
    163162                irc_umode_set( irc, "+R", 1 );
    164                 if( set_getbool( &irc->set, "auto_connect" ) )
     163                if( set_getbool( &irc->b->set, "auto_connect" ) )
    165164                        cmd_account( irc, account_on );
    166165                break;
     
    202201        storage_status_t status;
    203202       
    204         status = storage_remove (irc->nick, cmd[1]);
     203        status = storage_remove (irc->user->nick, cmd[1]);
    205204        switch (status) {
    206205        case STORAGE_NO_SUCH_USER:
     
    214213                irc->status &= ~USTATUS_IDENTIFIED;
    215214                irc_umode_set( irc, "-R", 1 );
    216                 irc_usermsg( irc, "Account `%s' removed", irc->nick );
     215                irc_usermsg( irc, "Account `%s' removed", irc->user->nick );
    217216                break;
    218217        default:
     
    221220        }
    222221}
    223 #endif
     222
     223static void cmd_save( irc_t *irc, char **cmd )
     224{
     225        if( ( irc->status & USTATUS_IDENTIFIED ) == 0 )
     226                irc_usermsg( irc, "Please create an account first" );
     227        else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK )
     228                irc_usermsg( irc, "Configuration saved" );
     229        else
     230                irc_usermsg( irc, "Configuration could not be saved!" );
     231}
    224232
    225233struct cmd_account_del_data
     
    909917}
    910918
    911 static void cmd_save( irc_t *irc, char **cmd )
    912 {
    913         if( ( irc->status & USTATUS_IDENTIFIED ) == 0 )
    914                 irc_usermsg( irc, "Please create an account first" );
    915         else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK )
    916                 irc_usermsg( irc, "Configuration saved" );
    917         else
    918                 irc_usermsg( irc, "Configuration could not be saved!" );
    919 }
    920 
    921919static void cmd_blist( irc_t *irc, char **cmd )
    922920{
     
    984982}
    985983
    986 static void cmd_nick( irc_t *irc, char **cmd )
    987 {
    988         account_t *a;
    989 
    990         if( !cmd[1] || !( a = account_get( irc, cmd[1] ) ) )
    991         {
    992                 irc_usermsg( irc, "Invalid account");
    993         }
    994         else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    995         {
    996                 irc_usermsg( irc, "That account is not on-line" );
    997         }
    998         else if ( !cmd[2] )
    999         {
    1000                 irc_usermsg( irc, "Your name is `%s'" , a->ic->displayname ? a->ic->displayname : "NULL" );
    1001         }
    1002         else if ( !a->prpl->set_my_name )
    1003         {
    1004                 irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
    1005         }
    1006         else
    1007         {
    1008                 irc_usermsg( irc, "Setting your name to `%s'", cmd[2] );
    1009                
    1010                 a->prpl->set_my_name( a->ic, cmd[2] );
    1011         }
    1012 }
    1013 
    1014984static void cmd_qlist( irc_t *irc, char **cmd )
    1015985{
     
    10301000                else
    10311001                        irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
    1032 }
    1033 
    1034 static void cmd_join_chat( irc_t *irc, char **cmd )
    1035 {
    1036         irc_usermsg( irc, "This command is now obsolete. "
    1037                           "Please try the `chat' command instead." );
    10381002}
    10391003
     
    12161180        { "help",           0, cmd_help,           0 },
    12171181        { "account",        1, cmd_account,        0 },
    1218 #if 0
    12191182        { "identify",       1, cmd_identify,       0 },
    12201183        { "register",       1, cmd_register,       0 },
    12211184        { "drop",           1, cmd_drop,           0 },
     1185        { "save",           0, cmd_save,           0 },
     1186#if 0
    12221187        { "add",            2, cmd_add,            0 },
    12231188        { "info",           1, cmd_info,           0 },
     
    12281193        { "block",          1, cmd_block,          0 },
    12291194        { "allow",          1, cmd_allow,          0 },
    1230         { "save",           0, cmd_save,           0 },
    12311195        { "set",            0, cmd_set,            0 },
    12321196        { "yes",            0, cmd_yesno,          0 },
  • storage_xml.c

    r57c96f7 r1f92a58  
    147147                                         arc_decode( pass_cr, pass_len, &password, xd->given_pass ) )
    148148                {
    149                         xd->current_account = account_add( irc, prpl, handle, password );
     149                        xd->current_account = account_add( irc->b, prpl, handle, password );
    150150                        if( server )
    151151                                set_setstr( &xd->current_account->set, "server", server );
     
    181181                                xd->current_set_head = &xd->current_account->set;
    182182                        else
    183                                 xd->current_set_head = &xd->irc->set;
     183                                xd->current_set_head = &xd->irc->b->set;
    184184                       
    185185                        xd->current_setting = g_strdup( setting );
     
    215215                if( xd->current_account && handle && channel )
    216216                {
    217                         xd->current_chat = chat_add( xd->irc, xd->current_account, handle, channel );
     217                        //xd->current_chat = chat_add( xd->irc, xd->current_account, handle, channel );
    218218                }
    219219                else
     
    353353static storage_status_t xml_load( irc_t *irc, const char *password )
    354354{
    355         return xml_load_real( irc, irc->nick, password, XML_PASS_UNKNOWN );
     355        return xml_load_real( irc, irc->user->nick, password, XML_PASS_UNKNOWN );
    356356}
    357357
     
    396396        md5_state_t md5_state;
    397397       
    398         path2 = g_strdup( irc->nick );
     398        path2 = g_strdup( irc->user->nick );
    399399        nick_lc( path2 );
    400400        g_snprintf( path, sizeof( path ) - 2, "%s%s%s", global.conf->configdir, path2, ".xml" );
     
    422422        pass_buf = base64_encode( pass_md5, 21 );
    423423       
    424         if( !xml_printf( fd, 0, "<user nick=\"%s\" password=\"%s\" version=\"%d\">\n", irc->nick, pass_buf, XML_FORMAT_VERSION ) )
     424        if( !xml_printf( fd, 0, "<user nick=\"%s\" password=\"%s\" version=\"%d\">\n", irc->user->nick, pass_buf, XML_FORMAT_VERSION ) )
    425425                goto write_error;
    426426       
    427427        g_free( pass_buf );
    428428       
    429         for( set = irc->set; set; set = set->next )
     429        for( set = irc->b->set; set; set = set->next )
    430430                if( set->value )
    431431                        if( !xml_printf( fd, 1, "<setting name=\"%s\">%s</setting>\n", set->key, set->value ) )
    432432                                goto write_error;
    433433       
    434         for( acc = irc->accounts; acc; acc = acc->next )
     434        for( acc = irc->b->accounts; acc; acc = acc->next )
    435435        {
    436436                unsigned char *pass_cr;
     
    470470                        goto write_error;
    471471               
     472#if 0
    472473                for( c = irc->chatrooms; c; c = c->next )
    473474                {
     
    488489                                goto write_error;
    489490                }
     491#endif
    490492               
    491493                if( !xml_printf( fd, 1, "</account>\n" ) )
  • unix.c

    r57c96f7 r1f92a58  
    115115        }
    116116
    117         /*
    118117        global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage );
    119118        if( global.storage == NULL )
     
    122121                return( 1 );
    123122        }
    124         */
    125123       
    126124        /* Catch some signals to tell the user what's happening before quitting */
Note: See TracChangeset for help on using the changeset viewer.