First try at alternate packet numbering for bluewave
This commit is contained in:
parent
1b0c1a6906
commit
5ca5ea73c3
@ -233,3 +233,4 @@ File exists!\r\n
|
||||
\r\nScan for new files? (Y/N) :
|
||||
\r\n\e[1;37mOrder by (\e[1;32mF\e[1;37m)ilename, (\e[1;32mU\e[1;37m)pload Date, (\e[1;32mP\e[1;37m)opularity : \e[0m
|
||||
\e[24;1H\e[1;32mUp / Down\e[1;37m to Scroll, \e[1;32mLeft / Right \e[1;37mChange Message, \e[1;32mR \e[1;37mReply, \e[1;32mJ \e[1;37mNext Area, \e[1;32mQ \e[1;37mQuit\e[K\e[0m
|
||||
\e[0;36mB. \e[1;37mBluewave Packet Style (\e[1;33m%s\e[1;37m)\r\n
|
||||
|
@ -205,6 +205,7 @@ struct user_record {
|
||||
int nodemsgs;
|
||||
int codepage;
|
||||
int exteditor;
|
||||
int bwavestyle;
|
||||
};
|
||||
|
||||
struct jam_msg {
|
||||
|
@ -212,11 +212,12 @@ void bwave_create_packet() {
|
||||
int stout;
|
||||
int stin;
|
||||
int sterr;
|
||||
|
||||
char *weekday[] = {"SU", "MO", "TU", "WE", "TH", "FR", "SA"};
|
||||
struct termios oldit;
|
||||
struct termios oldot;
|
||||
struct stat s;
|
||||
|
||||
struct tm time_tm;
|
||||
time_t thetime;
|
||||
FILE *mix_file;
|
||||
FILE *fti_file;
|
||||
FILE *dat_file;
|
||||
@ -374,7 +375,13 @@ void bwave_create_packet() {
|
||||
if (totmsgs > 0) {
|
||||
// create archive
|
||||
bpos = 0;
|
||||
if (gUser->bwavestyle) {
|
||||
thetime = time(NULL);
|
||||
localtime_r(&thetime, &time_tm);
|
||||
snprintf(archive, 1024, "%s/node%d/%s.%s%d", conf.bbs_path, mynode, conf.bwave_name, weekday[time_tm.tm_wday], gUser->bwavepktno % 10);
|
||||
} else {
|
||||
snprintf(archive, 1024, "%s/node%d/%s.%03d", conf.bbs_path, mynode, conf.bwave_name, gUser->bwavepktno);
|
||||
}
|
||||
|
||||
for (i=0;i<strlen(conf.archivers[gUser->defarchiver-1]->pack);i++) {
|
||||
if (conf.archivers[gUser->defarchiver-1]->pack[i] == '*') {
|
||||
|
@ -35,6 +35,7 @@ void settings_menu(struct user_record *user) {
|
||||
break;
|
||||
}
|
||||
s_printf(get_string(222), buffer);
|
||||
s_printf(get_string(235), (user->bwavestyle ? "000-999" : "mo?,tu? ..."));
|
||||
s_printf(get_string(153));
|
||||
s_printf(get_string(154));
|
||||
|
||||
@ -146,6 +147,12 @@ void settings_menu(struct user_record *user) {
|
||||
save_user(user);
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
{
|
||||
user->bwavestyle = !user->bwavestyle;
|
||||
save_user(user);
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
dosettings = 1;
|
||||
break;
|
||||
|
15
src/users.c
15
src/users.c
@ -82,7 +82,7 @@ int save_user(struct user_record *user) {
|
||||
int rc;
|
||||
|
||||
char *update_sql = "UPDATE users SET password=?, salt=?, firstname=?,"
|
||||
"lastname=?, email=?, location=?, sec_level=?, last_on=?, time_left=?, cur_mail_conf=?, cur_mail_area=?, cur_file_dir=?, cur_file_sub=?, times_on=?, bwavepktno=?, archiver=?, protocol=?,nodemsgs=?,codepage=?,exteditor=? where loginname LIKE ?";
|
||||
"lastname=?, email=?, location=?, sec_level=?, last_on=?, time_left=?, cur_mail_conf=?, cur_mail_area=?, cur_file_dir=?, cur_file_sub=?, times_on=?, bwavepktno=?, archiver=?, protocol=?,nodemsgs=?,codepage=?,exteditor=?,bwavestyle=? where loginname LIKE ?";
|
||||
|
||||
sprintf(buffer, "%s/users.sq3", conf.bbs_path);
|
||||
|
||||
@ -118,7 +118,8 @@ int save_user(struct user_record *user) {
|
||||
sqlite3_bind_int(res, 18, user->nodemsgs);
|
||||
sqlite3_bind_int(res, 19, user->codepage);
|
||||
sqlite3_bind_int(res, 20, user->exteditor);
|
||||
sqlite3_bind_text(res, 21, user->loginname, -1, 0);
|
||||
sqlite3_bind_int(res, 21, user->bwavestyle);
|
||||
sqlite3_bind_text(res, 22, user->loginname, -1, 0);
|
||||
} else {
|
||||
dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
|
||||
}
|
||||
@ -260,10 +261,11 @@ int inst_user(struct user_record *user) {
|
||||
"protocol INTEGER,"
|
||||
"nodemsgs INTEGER,"
|
||||
"codepage INTEGER,"
|
||||
"exteditor INTEGER);";
|
||||
"exteditor INTEGER,"
|
||||
"bwavestyle INTEGER);";
|
||||
|
||||
char *insert_sql = "INSERT INTO users (loginname, password, salt, firstname,"
|
||||
"lastname, email, location, sec_level, last_on, time_left, cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, times_on, bwavepktno, archiver, protocol, nodemsgs, codepage, exteditor) VALUES(?,?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
"lastname, email, location, sec_level, last_on, time_left, cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, times_on, bwavepktno, archiver, protocol, nodemsgs, codepage, exteditor, bwavestyle) VALUES(?,?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
char *err_msg = 0;
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
|
||||
@ -312,6 +314,7 @@ int inst_user(struct user_record *user) {
|
||||
sqlite3_bind_int(res, 19, user->nodemsgs);
|
||||
sqlite3_bind_int(res, 20, user->codepage);
|
||||
sqlite3_bind_int(res, 21, user->exteditor);
|
||||
sqlite3_bind_int(res, 22, user->bwavestyle);
|
||||
} else {
|
||||
dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
|
||||
sqlite3_close(db);
|
||||
@ -341,7 +344,7 @@ struct user_record *check_user_pass(char *loginname, char *password) {
|
||||
sqlite3_stmt *res;
|
||||
int rc;
|
||||
char *sql = "SELECT Id, loginname, password, salt, firstname,"
|
||||
"lastname, email, location, sec_level, last_on, time_left, cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, times_on, bwavepktno, archiver, protocol,nodemsgs, codepage, exteditor FROM users WHERE loginname LIKE ?";
|
||||
"lastname, email, location, sec_level, last_on, time_left, cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, times_on, bwavepktno, archiver, protocol,nodemsgs, codepage, exteditor, bwavestyle FROM users WHERE loginname LIKE ?";
|
||||
char *pass_hash;
|
||||
|
||||
sprintf(buffer, "%s/users.sq3", conf.bbs_path);
|
||||
@ -391,6 +394,7 @@ struct user_record *check_user_pass(char *loginname, char *password) {
|
||||
user->nodemsgs = sqlite3_column_int(res, 19);
|
||||
user->codepage = sqlite3_column_int(res, 20);
|
||||
user->exteditor = sqlite3_column_int(res, 21);
|
||||
user->bwavestyle = sqlite3_column_int(res, 22);
|
||||
pass_hash = hash_sha256(password, user->salt);
|
||||
|
||||
if (strcmp(pass_hash, user->password) != 0) {
|
||||
@ -677,6 +681,7 @@ struct user_record *new_user() {
|
||||
user->nodemsgs = 1;
|
||||
user->codepage = conf.codepage;
|
||||
user->exteditor = 2;
|
||||
user->bwavestyle = 0;
|
||||
inst_user(user);
|
||||
|
||||
return user;
|
||||
|
@ -156,3 +156,24 @@ if (check_exists("exteditor") == 0) {
|
||||
$dbh->do($sql);
|
||||
$dbh->disconnect;
|
||||
}
|
||||
|
||||
|
||||
if (check_exists("bwavestyle") == 0) {
|
||||
print "Column \"bwavestyle\" doesn't exist... adding..\n";
|
||||
|
||||
my ($needed) = @_;
|
||||
|
||||
my $dsn = "dbi:SQLite:dbname=$dbfile";
|
||||
my $user = "";
|
||||
my $password = "";
|
||||
my $dbh = DBI->connect($dsn, $user, $password, {
|
||||
PrintError => 0,
|
||||
RaiseError => 1,
|
||||
AutoCommit => 1,
|
||||
FetchHashKeyName => 'NAME_lc',
|
||||
});
|
||||
|
||||
my $sql = "ALTER TABLE users ADD COLUMN bwavestyle INTEGER DEFAULT 0";
|
||||
$dbh->do($sql);
|
||||
$dbh->disconnect;
|
||||
}
|
||||
|
Reference in New Issue
Block a user