Changeset 1f92a58
- Timestamp:
- 2010-04-10T02:27:50Z (15 years ago)
- Branches:
- master
- Children:
- 17a6ee9
- Parents:
- 57c96f7
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r57c96f7 r1f92a58 11 11 # Program variables 12 12 #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 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 storage.o $(STORAGE_OBJS) 14 14 headers = 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 15 15 subdirs = lib protocols -
irc.c
r57c96f7 r1f92a58 259 259 260 260 return( TRUE ); 261 } 262 263 /* USE WITH CAUTION! 264 Sets pass without checking */ 265 void 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 } 261 274 } 262 275 -
irc.h
r57c96f7 r1f92a58 160 160 void irc_abort( irc_t *irc, int immed, char *format, ... ) G_GNUC_PRINTF( 3, 4 ); 161 161 void irc_free( irc_t *irc ); 162 void irc_setpass (irc_t *irc, const char *pass); 162 163 163 164 void irc_process( irc_t *irc ); -
root_commands.c
r57c96f7 r1f92a58 136 136 } 137 137 138 #if 0139 138 static void cmd_account( irc_t *irc, char **cmd ); 140 139 … … 162 161 irc->status |= USTATUS_IDENTIFIED; 163 162 irc_umode_set( irc, "+R", 1 ); 164 if( set_getbool( &irc-> set, "auto_connect" ) )163 if( set_getbool( &irc->b->set, "auto_connect" ) ) 165 164 cmd_account( irc, account_on ); 166 165 break; … … 202 201 storage_status_t status; 203 202 204 status = storage_remove (irc-> nick, cmd[1]);203 status = storage_remove (irc->user->nick, cmd[1]); 205 204 switch (status) { 206 205 case STORAGE_NO_SUCH_USER: … … 214 213 irc->status &= ~USTATUS_IDENTIFIED; 215 214 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 ); 217 216 break; 218 217 default: … … 221 220 } 222 221 } 223 #endif 222 223 static 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 } 224 232 225 233 struct cmd_account_del_data … … 909 917 } 910 918 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 else918 irc_usermsg( irc, "Configuration could not be saved!" );919 }920 921 919 static void cmd_blist( irc_t *irc, char **cmd ) 922 920 { … … 984 982 } 985 983 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 else1007 {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 1014 984 static void cmd_qlist( irc_t *irc, char **cmd ) 1015 985 { … … 1030 1000 else 1031 1001 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." );1038 1002 } 1039 1003 … … 1216 1180 { "help", 0, cmd_help, 0 }, 1217 1181 { "account", 1, cmd_account, 0 }, 1218 #if 01219 1182 { "identify", 1, cmd_identify, 0 }, 1220 1183 { "register", 1, cmd_register, 0 }, 1221 1184 { "drop", 1, cmd_drop, 0 }, 1185 { "save", 0, cmd_save, 0 }, 1186 #if 0 1222 1187 { "add", 2, cmd_add, 0 }, 1223 1188 { "info", 1, cmd_info, 0 }, … … 1228 1193 { "block", 1, cmd_block, 0 }, 1229 1194 { "allow", 1, cmd_allow, 0 }, 1230 { "save", 0, cmd_save, 0 },1231 1195 { "set", 0, cmd_set, 0 }, 1232 1196 { "yes", 0, cmd_yesno, 0 }, -
storage_xml.c
r57c96f7 r1f92a58 147 147 arc_decode( pass_cr, pass_len, &password, xd->given_pass ) ) 148 148 { 149 xd->current_account = account_add( irc , prpl, handle, password );149 xd->current_account = account_add( irc->b, prpl, handle, password ); 150 150 if( server ) 151 151 set_setstr( &xd->current_account->set, "server", server ); … … 181 181 xd->current_set_head = &xd->current_account->set; 182 182 else 183 xd->current_set_head = &xd->irc-> set;183 xd->current_set_head = &xd->irc->b->set; 184 184 185 185 xd->current_setting = g_strdup( setting ); … … 215 215 if( xd->current_account && handle && channel ) 216 216 { 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 ); 218 218 } 219 219 else … … 353 353 static storage_status_t xml_load( irc_t *irc, const char *password ) 354 354 { 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 ); 356 356 } 357 357 … … 396 396 md5_state_t md5_state; 397 397 398 path2 = g_strdup( irc-> nick );398 path2 = g_strdup( irc->user->nick ); 399 399 nick_lc( path2 ); 400 400 g_snprintf( path, sizeof( path ) - 2, "%s%s%s", global.conf->configdir, path2, ".xml" ); … … 422 422 pass_buf = base64_encode( pass_md5, 21 ); 423 423 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 ) ) 425 425 goto write_error; 426 426 427 427 g_free( pass_buf ); 428 428 429 for( set = irc-> set; set; set = set->next )429 for( set = irc->b->set; set; set = set->next ) 430 430 if( set->value ) 431 431 if( !xml_printf( fd, 1, "<setting name=\"%s\">%s</setting>\n", set->key, set->value ) ) 432 432 goto write_error; 433 433 434 for( acc = irc-> accounts; acc; acc = acc->next )434 for( acc = irc->b->accounts; acc; acc = acc->next ) 435 435 { 436 436 unsigned char *pass_cr; … … 470 470 goto write_error; 471 471 472 #if 0 472 473 for( c = irc->chatrooms; c; c = c->next ) 473 474 { … … 488 489 goto write_error; 489 490 } 491 #endif 490 492 491 493 if( !xml_printf( fd, 1, "</account>\n" ) ) -
unix.c
r57c96f7 r1f92a58 115 115 } 116 116 117 /*118 117 global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage ); 119 118 if( global.storage == NULL ) … … 122 121 return( 1 ); 123 122 } 124 */125 123 126 124 /* Catch some signals to tell the user what's happening before quitting */
Note: See TracChangeset
for help on using the changeset viewer.