From a7836b50de70acb9b6ead52c9ba3d75c2f99428b Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 13 Jun 2005 09:03:31 +0000 Subject: [PATCH] Implemented last_activity, HTML email SVN revision: 1394 --- src/elogd.c | 251 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 213 insertions(+), 38 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index 9a1e8d21..8c080384 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 1.678 2005/06/13 09:03:31 ritt + Implemented last_activity, HTML email + Revision 1.677 2005/06/04 11:58:20 ritt Switched login page to POST method @@ -1526,7 +1529,7 @@ int run_service(void); void show_error(char *error); BOOL enum_user_line(LOGBOOK * lbs, int n, char *user, int size); int get_user_line(LOGBOOK * lbs, char *user, char *password, char *full_name, - char *email, BOOL email_notify[1000]); + char *email, BOOL email_notify[1000], int *last_access); int strbreak(char *str, char list[][NAME_LENGTH], int size, char *brk); int execute_shell(LOGBOOK * lbs, int message_id, char attrib[MAX_N_ATTR][NAME_LENGTH], char att_file[MAX_ATTACHMENTS][256], char *sh_cmd); @@ -4039,7 +4042,7 @@ void retrieve_email_from(LOGBOOK * lbs, char *ret, char attrib[MAX_N_ATTR][NAME_ for (i = 0;; i++) { if (!enum_user_line(lbs, i, login_name, sizeof(login_name))) break; - get_user_line(lbs, login_name, NULL, NULL, str, NULL); + get_user_line(lbs, login_name, NULL, NULL, str, NULL, NULL); if (is_admin_user(lbs->name, login_name) && strchr(str, '@')) break; } @@ -6375,10 +6378,29 @@ void rsputs_elcode(const char *str) i += strlen(pattern_list[l].pattern); strextract(str+i, ']', attrib, sizeof(attrib)); i += strlen(attrib)+1; - if (strncmp(attrib, "http://", 7) != 0) /* add http:// if missing */ + + if (strncmp(attrib, "elog:", 5) == 0) { /* eval elog: */ + strlcpy(tmp, attrib+5, sizeof(tmp)); + if (strchr(tmp, '/')) + *strchr(tmp, '/') = 0; + + for (m = 0; m < (int) strlen(tmp); m++) + if (!isdigit(tmp[m])) + break; + + if (m < (int) strlen(tmp)) + /* if link contains reference to other logbook, add ".." in front */ + sprintf(hattrib, "../%s", attrib+5); + else if (attrib[5] == '/') + sprintf(hattrib, "%d%s", _current_message_id, attrib+5); + else + sprintf(hattrib, "%s", attrib+5); + + } else if (strncmp(attrib, "http://", 7) != 0) /* add http:// if missing */ sprintf(hattrib, "http://%s", attrib); else strlcpy(hattrib, attrib, sizeof(hattrib)); + strextract(str+i, '[', value, sizeof(value)); i += strlen(value)-1; strlcpy(subst, pattern_list[l].subst, sizeof(subst)); @@ -8143,7 +8165,7 @@ void show_change_pwd_page(LOGBOOK * lbs) if (old_pwd[0] || new_pwd[0]) { if (user[0] - && get_user_line(lbs, user, act_pwd, NULL, NULL, NULL)) { + && get_user_line(lbs, user, act_pwd, NULL, NULL, NULL, NULL)) { /* administrator does not have to supply old password if changing other user's password */ if (is_admin_user(lbs->name, getparam("unm")) @@ -8595,6 +8617,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL text = xmalloc(TEXT_SIZE); text[0] = 0; orig_author[0] = 0; + encoding[0] = 0; if (breedit || bupload) { /* get date from parameter */ @@ -9413,7 +9436,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL for (i = 0;; i++) { if (!enum_user_line(lbs, i, login_name, sizeof(login_name))) break; - get_user_line(lbs, login_name, NULL, str, NULL, NULL); + get_user_line(lbs, login_name, NULL, str, NULL, NULL, NULL); if (strieq(str, attrib[index])) rsprintf("