Add signature capability

This commit is contained in:
Andrew Pamment 2018-01-13 19:17:22 +10:00
parent aa8a4c5d75
commit dd1d4d4eaa
7 changed files with 156 additions and 48 deletions

View File

@ -243,3 +243,5 @@ File exists!\r\n
\r\nLastname may not begin or end with a space\r\n \r\nLastname may not begin or end with a space\r\n
\r\nFirst & Last Name combination in use!\r\n \r\nFirst & Last Name combination in use!\r\n
\r\nSpaces not allowed\r\n \r\nSpaces not allowed\r\n
\e[0;36mS. \e[1;37mSet Signature...\r\n
\e[0;36mT. \e[1;37mToggle Auto-Signature (\e[1;33m%s\e[1;37m)\r\n

View File

@ -190,6 +190,8 @@ struct user_record {
char *lastname; char *lastname;
char *email; char *email;
char *location; char *location;
char *signature;
int autosig;
int sec_level; int sec_level;
struct sec_level_t *sec_info; struct sec_level_t *sec_info;
time_t laston; time_t laston;
@ -267,8 +269,8 @@ extern s_JamBase *open_jam_base(char *path);
extern void free_message_headers(struct msg_headers *msghs); extern void free_message_headers(struct msg_headers *msghs);
extern struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_record *user); extern struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_record *user);
extern void mail_scan(struct user_record *user); extern void mail_scan(struct user_record *user);
extern char *editor(struct user_record *user, char *quote, int qlen, char *from, int email); extern char *editor(struct user_record *user, char *quote, int qlen, char *from, int email, int sig);
extern char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email); extern char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email, int sig);
extern int msg_is_to(struct user_record *user, char *addressed_to, char *address, int type, int rn, int msgconf); extern int msg_is_to(struct user_record *user, char *addressed_to, char *address, int type, int rn, int msgconf);
extern int msg_is_from(struct user_record *user, char *addressed_from, char *address, int type, int rn, int msgconf); extern int msg_is_from(struct user_record *user, char *addressed_from, char *address, int type, int rn, int msgconf);
extern unsigned long generate_msgid(); extern unsigned long generate_msgid();

View File

@ -59,7 +59,7 @@ void send_email(struct user_record *user) {
subject = strdup(buffer); subject = strdup(buffer);
// post a message // post a message
msg = external_editor(user, user->loginname, recipient, NULL, 0, NULL, subject, 1); msg = external_editor(user, user->loginname, recipient, NULL, 0, NULL, subject, 1, 0);
if (msg != NULL) { if (msg != NULL) {
sprintf(buffer, "%s/email.sq3", conf.bbs_path); sprintf(buffer, "%s/email.sq3", conf.bbs_path);
@ -278,7 +278,7 @@ void show_email(struct user_record *user, int msgno, int email_count, struct ema
subject = (char *)malloc(strlen(buffer) + 1); subject = (char *)malloc(strlen(buffer) + 1);
strcpy(subject, buffer); strcpy(subject, buffer);
replybody = external_editor(user, user->loginname, emails[msgno]->from, emails[msgno]->body, strlen(emails[msgno]->body), emails[msgno]->from, subject, 1); replybody = external_editor(user, user->loginname, emails[msgno]->from, emails[msgno]->body, strlen(emails[msgno]->body), emails[msgno]->from, subject, 1, 0);
if (replybody != NULL) { if (replybody != NULL) {
sprintf(buffer, "%s/email.sq3", conf.bbs_path); sprintf(buffer, "%s/email.sq3", conf.bbs_path);

View File

@ -355,7 +355,7 @@ struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_r
return msghs; return msghs;
} }
char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email) { char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email, int sig) {
char c; char c;
FILE *fptr; FILE *fptr;
char *body = NULL; char *body = NULL;
@ -423,10 +423,15 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
fprintf(fptr, "E-Mail\r\n"); fprintf(fptr, "E-Mail\r\n");
fprintf(fptr, "YES\r\n"); fprintf(fptr, "YES\r\n");
} else { } else {
fprintf(fptr, "%s\r\n", conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->name); if (!sig) {
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NETMAIL_AREA){ fprintf(fptr, "%s\r\n", conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->name);
fprintf(fptr, "YES\r\n"); if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NETMAIL_AREA){
fprintf(fptr, "YES\r\n");
} else {
fprintf(fptr, "NO\r\n");
}
} else { } else {
fprintf(fptr, "None\r\n");
fprintf(fptr, "NO\r\n"); fprintf(fptr, "NO\r\n");
} }
} }
@ -471,24 +476,31 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
} }
} }
uname(&name); if (!sig) {
uname(&name);
if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_FIDO && !email) {
if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_FIDO && !email) { if (conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point == 0) {
if (conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point == 0) { snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node);
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node); } else {
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point);
}
} else { } else {
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone, snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline);
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net, }
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node, if (user->autosig) {
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point); body2 = (char *)malloc(totlen + 3 + strlen(buffer) + strlen(user->signature));
} else {
body2 = (char *)malloc(totlen + 2 + strlen(buffer));
} }
} else { } else {
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline); body2 = (char *)malloc(totlen + 1);
} }
body2 = (char *)malloc(totlen + 2 + strlen(buffer));
j = 0; j = 0;
@ -502,18 +514,23 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
body2[j] = '\0'; body2[j] = '\0';
} }
if (!sig) {
strcat(body2, buffer); if (user->autosig) {
strcat(body2, "\r");
strcat(body2, user->signature);
}
strcat(body2, buffer);
}
free(body); free(body);
return body2; return body2;
} }
} }
return editor(user, quote, qlen, qfrom, email); return editor(user, quote, qlen, qfrom, email, sig);
} }
char *editor(struct user_record *user, char *quote, int quotelen, char *from, int email) { char *editor(struct user_record *user, char *quote, int quotelen, char *from, int email, int sig) {
int lines = 0; int lines = 0;
char buffer[256]; char buffer[256];
char linebuffer[80]; char linebuffer[80];
@ -594,23 +611,32 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in
} else { } else {
tagline = conf.default_tagline; tagline = conf.default_tagline;
} }
uname(&name); if (!sig) {
if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_FIDO && !email) { uname(&name);
if (conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point == 0) { if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_FIDO && !email) {
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone, if (conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point == 0) {
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net, snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node); conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node);
} else {
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point);
}
} else { } else {
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone, snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline);
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net, }
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node, if (user->autosig) {
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->point); size += 3;
size += strlen(buffer) + strlen(user->signature);
} else {
size += 2;
size += strlen(buffer);
} }
} else { } else {
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline); size += 1;
} }
size += 2;
size += strlen(buffer);
msg = (char *)malloc(size); msg = (char *)malloc(size);
memset(msg, 0, size); memset(msg, 0, size);
@ -620,7 +646,13 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in
free(content[i]); free(content[i]);
} }
strcat(msg, buffer); if (!sig) {
if (user->autosig) {
strcat(msg, "\r");
strcat(msg, user->signature);
}
strcat(msg, buffer);
}
free(content); free(content);
if (quote != NULL) { if (quote != NULL) {
@ -1664,7 +1696,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
to = (char *)malloc(strlen(buffer) + 1); to = (char *)malloc(strlen(buffer) + 1);
strcpy(to, buffer); strcpy(to, buffer);
} }
replybody = external_editor(user, to, from, body, z2, msghs->msgs[mailno]->from, subject, 0); replybody = external_editor(user, to, from, body, z2, msghs->msgs[mailno]->from, subject, 0, 0);
if (replybody != NULL) { if (replybody != NULL) {
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path); jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
@ -2092,7 +2124,7 @@ void post_message(struct user_record *user) {
from = (char *)malloc(strlen(user->firstname) + strlen(user->lastname) + 2); from = (char *)malloc(strlen(user->firstname) + strlen(user->lastname) + 2);
sprintf(from, "%s %s", user->firstname, user->lastname); sprintf(from, "%s %s", user->firstname, user->lastname);
} }
msg = external_editor(user, to, from, NULL, 0, NULL, subject, 0); msg = external_editor(user, to, from, NULL, 0, NULL, subject, 0, 0);
free(from); free(from);

View File

@ -13,6 +13,7 @@ void settings_menu(struct user_record *user) {
char *hash; char *hash;
int new_arc; int new_arc;
int i; int i;
char *sig;
while (!dosettings) { while (!dosettings) {
s_printf(get_string(149)); s_printf(get_string(149));
@ -36,6 +37,8 @@ void settings_menu(struct user_record *user) {
} }
s_printf(get_string(222), buffer); s_printf(get_string(222), buffer);
s_printf(get_string(235), (user->bwavestyle ? "mo?,tu? ..." : "000-999")); s_printf(get_string(235), (user->bwavestyle ? "mo?,tu? ..." : "000-999"));
s_printf(get_string(245));
s_printf(get_string(246), (user->autosig ? "TRUE" : "FALSE"));
s_printf(get_string(153)); s_printf(get_string(153));
s_printf(get_string(154)); s_printf(get_string(154));
@ -154,6 +157,25 @@ void settings_menu(struct user_record *user) {
save_user(user); save_user(user);
} }
break; break;
case 's':
{
// set signature
if (user->signature != NULL) {
free(user->signature);
}
sig = external_editor(user, "No-One", "No-One", NULL, 0, "No-One", "Signature Editor", 0, 1);
if (sig != NULL) {
user->signature = sig;
save_user(user);
}
}
break;
case 't':
{
user->autosig = !user->autosig;
save_user(user);
}
break;
case 'q': case 'q':
dosettings = 1; dosettings = 1;
break; break;

View File

@ -82,7 +82,7 @@ int save_user(struct user_record *user) {
int rc; int rc;
char *update_sql = "UPDATE users SET password=?, salt=?, firstname=?," 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=?,bwavestyle=? 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=?,signature=?,autosig=? where loginname LIKE ?";
sprintf(buffer, "%s/users.sq3", conf.bbs_path); sprintf(buffer, "%s/users.sq3", conf.bbs_path);
@ -119,7 +119,9 @@ int save_user(struct user_record *user) {
sqlite3_bind_int(res, 19, user->codepage); sqlite3_bind_int(res, 19, user->codepage);
sqlite3_bind_int(res, 20, user->exteditor); sqlite3_bind_int(res, 20, user->exteditor);
sqlite3_bind_int(res, 21, user->bwavestyle); sqlite3_bind_int(res, 21, user->bwavestyle);
sqlite3_bind_text(res, 22, user->loginname, -1, 0); sqlite3_bind_text(res, 22, user->signature, -1, 0);
sqlite3_bind_int(res, 23, user->autosig);
sqlite3_bind_text(res, 24, user->loginname, -1, 0);
} else { } else {
dolog("Failed to execute statement: %s", sqlite3_errmsg(db)); dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
} }
@ -262,10 +264,12 @@ int inst_user(struct user_record *user) {
"nodemsgs INTEGER," "nodemsgs INTEGER,"
"codepage INTEGER," "codepage INTEGER,"
"exteditor INTEGER," "exteditor INTEGER,"
"bwavestyle INTEGER);"; "bwavestyle INTEGER,"
"signature TEXT,"
"autosig INT);";
char *insert_sql = "INSERT INTO users (loginname, password, salt, firstname," 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, bwavestyle) 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, signature, autosig) VALUES(?,?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
char *err_msg = 0; char *err_msg = 0;
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path); snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
@ -315,6 +319,8 @@ int inst_user(struct user_record *user) {
sqlite3_bind_int(res, 20, user->codepage); sqlite3_bind_int(res, 20, user->codepage);
sqlite3_bind_int(res, 21, user->exteditor); sqlite3_bind_int(res, 21, user->exteditor);
sqlite3_bind_int(res, 22, user->bwavestyle); sqlite3_bind_int(res, 22, user->bwavestyle);
sqlite3_bind_text(res, 23, user->signature, -1, 0);
sqlite3_bind_int(res, 24, user->autosig);
} else { } else {
dolog("Failed to execute statement: %s", sqlite3_errmsg(db)); dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
sqlite3_close(db); sqlite3_close(db);
@ -344,7 +350,7 @@ struct user_record *check_user_pass(char *loginname, char *password) {
sqlite3_stmt *res; sqlite3_stmt *res;
int rc; int rc;
char *sql = "SELECT Id, loginname, password, salt, firstname," 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, bwavestyle 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, signature, autosig FROM users WHERE loginname LIKE ?";
char *pass_hash; char *pass_hash;
sprintf(buffer, "%s/users.sq3", conf.bbs_path); sprintf(buffer, "%s/users.sq3", conf.bbs_path);
@ -395,6 +401,8 @@ struct user_record *check_user_pass(char *loginname, char *password) {
user->codepage = sqlite3_column_int(res, 20); user->codepage = sqlite3_column_int(res, 20);
user->exteditor = sqlite3_column_int(res, 21); user->exteditor = sqlite3_column_int(res, 21);
user->bwavestyle = sqlite3_column_int(res, 22); user->bwavestyle = sqlite3_column_int(res, 22);
user->signature = strdup((char *)sqlite3_column_text(res, 23));
user->autosig = sqlite3_column_int(res, 24);
pass_hash = hash_sha256(password, user->salt); pass_hash = hash_sha256(password, user->salt);
if (strcmp(pass_hash, user->password) != 0) { if (strcmp(pass_hash, user->password) != 0) {
@ -404,6 +412,7 @@ struct user_record *check_user_pass(char *loginname, char *password) {
free(user->email); free(user->email);
free(user->location); free(user->location);
free(user->salt); free(user->salt);
free(user->signature);
free(user); free(user);
free(pass_hash); free(pass_hash);
sqlite3_finalize(res); sqlite3_finalize(res);
@ -744,7 +753,6 @@ struct user_record *new_user() {
user->sec_level = conf.newuserlvl; user->sec_level = conf.newuserlvl;
user->bwavepktno = 0; user->bwavepktno = 0;
user->sec_info = (struct sec_level_t *)malloc(sizeof(struct sec_level_t)); user->sec_info = (struct sec_level_t *)malloc(sizeof(struct sec_level_t));
sprintf(buffer, "%s/config/s%d.ini", conf.bbs_path, user->sec_level); sprintf(buffer, "%s/config/s%d.ini", conf.bbs_path, user->sec_level);
if (ini_parse(buffer, secLevel, user->sec_info) <0) { if (ini_parse(buffer, secLevel, user->sec_info) <0) {
@ -765,6 +773,8 @@ struct user_record *new_user() {
user->codepage = conf.codepage; user->codepage = conf.codepage;
user->exteditor = 2; user->exteditor = 2;
user->bwavestyle = 0; user->bwavestyle = 0;
user->signature = strdup("");
user->autosig = 0;
inst_user(user); inst_user(user);
return user; return user;

View File

@ -177,3 +177,43 @@ if (check_exists("bwavestyle") == 0) {
$dbh->do($sql); $dbh->do($sql);
$dbh->disconnect; $dbh->disconnect;
} }
if (check_exists("signature") == 0) {
print "Column \"signature\" 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 signature TEXT DEFAULT \"\"";
$dbh->do($sql);
$dbh->disconnect;
}
if (check_exists("autosig") == 0) {
print "Column \"autosig\" 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 autosig INTEGER DEFAULT 0";
$dbh->do($sql);
$dbh->disconnect;
}