From 10d0e109cf8ec4fa98b93976c357f94d0499154b Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 5 Aug 2003 03:06:58 +0000 Subject: [PATCH] * Added a README.txt file because some Joker kept bugging me about it * Reloaded the code that extracts embedded URL's to a place where it'll get picked up on *every* message, not just the old variformat stuff --- citadel/ChangeLog | 6 +++++- citadel/README.txt | 12 ++++++++++++ citadel/commands.c | 28 ---------------------------- citadel/commands.h | 4 ---- citadel/messages.c | 28 +++++++++++++++++++++++++++- citadel/messages.h | 5 +++++ 6 files changed, 49 insertions(+), 34 deletions(-) create mode 100644 citadel/README.txt diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 7a4151f78..8d3f8f8cb 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 608.17 2003/08/05 03:06:58 ajc + * Added a README.txt file because some Joker kept bugging me about it + * Reloaded the code that extracts embedded URL's to a place where it'll + get picked up on *every* message, not just the old variformat stuff + Revision 608.16 2003/08/03 17:51:52 ajc * Clear out all masqueraded wholist fields when logging out, in case another user logs in without reconnecting. @@ -4935,4 +4940,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/README.txt b/citadel/README.txt new file mode 100644 index 000000000..3db12c5fe --- /dev/null +++ b/citadel/README.txt @@ -0,0 +1,12 @@ + + * A full set of documentation may be found in the docs/ directory. + + * The condensed version: + + 1. Create a user on your system under which to run Citadel + 2. Install a supported version of Berkeley DB + 3. ./configure && make && make install + 4. Run the "setup" program + + * Keep in mind that there is a FAQ at http://www.citadel.org + diff --git a/citadel/commands.c b/citadel/commands.c index a3d471978..d969539c1 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -76,10 +76,8 @@ int rc_force_mail_prompts; int rc_remember_passwords; int rc_ansi_color; int rc_color_use_bg; -int num_urls = 0; int rc_prompt_control = 0; time_t rc_idle_threshold = (time_t)900; -char urls[MAXURLS][SIZ]; char rc_url_cmd[SIZ]; char rc_gotmail_cmd[SIZ]; @@ -1312,8 +1310,6 @@ int fmout( int column = 0; /* Current column */ size_t i; /* Generic counter */ - num_urls = 0; /* Start with a clean slate of embedded URL's */ - /* Space for a single word, which can be at most screenwidth */ word = (char *)calloc(1, width); if (!word) { @@ -1410,30 +1406,6 @@ int fmout( if (e[i] == '\t' || e[i] == '\f' || e[i] == '\v') e[i] = ' '; - /* - * Check for and copy URLs - * We will get the entire URL even if it's longer than the - * screen width, as long as the server didn't break it up - */ - if (!strncasecmp(e, "http://", 7) || - !strncasecmp(e, "ftp://", 6)) { - int j; - - strncpy(urls[num_urls], e, i); - urls[num_urls][i] = 0; - for (j = 0; j < strlen(e); j++) { - char c; - - c = urls[num_urls][j]; - if (c == '>' || c == '\"' || c == ')' || - c == ' ' || c == '\n') { - urls[num_urls][j] = 0; - break; - } - } - num_urls++; - } - /* Break up really long words */ /* TODO: auto-hyphenation someday? */ if (i >= width) diff --git a/citadel/commands.h b/citadel/commands.h index 8a4180b84..79c39809e 100644 --- a/citadel/commands.h +++ b/citadel/commands.h @@ -26,8 +26,6 @@ #define COLOR_POP 17 /* Restore saved color */ #define ORIGINAL_PAIR -1 /* Default terminal colors */ -#define MAXURLS 50 /* Max embedded URL's per message */ - /* * declarations */ @@ -65,8 +63,6 @@ void pprintf(const char *format, ...); -extern int num_urls; -extern char urls[MAXURLS][SIZ]; extern char rc_url_cmd[SIZ]; extern char rc_gotmail_cmd[SIZ]; extern int lines_printed; diff --git a/citadel/messages.c b/citadel/messages.c index 659007769..b125bea2a 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -87,6 +87,8 @@ extern int rc_display_message_numbers; extern int rc_force_mail_prompts; extern int editor_pid; extern CtdlIPC *ipc_for_signal_handlers; /* KLUDGE cover your eyes */ +int num_urls = 0; +char urls[MAXURLS][SIZ]; void ka_sigcatch(int signum) { @@ -363,6 +365,9 @@ int read_message(CtdlIPC *ipc, char *converted_text = NULL; char *lineptr; char *nextline; + char *searchptr; + int i; + char ch; int linelen; int final_line_is_blank = 0; @@ -590,6 +595,26 @@ int read_message(CtdlIPC *ipc, format_type = 1; } + /* Extract URL's */ + num_urls = 0; /* Start with a clean slate */ + searchptr = message->text; + while (searchptr != NULL) { + searchptr = strstr(searchptr, "http://"); + if (searchptr != NULL) { + safestrncpy(urls[num_urls], searchptr, sizeof(urls[num_urls])); + for (i = 0; i < strlen(urls[num_urls]); i++) { + ch = urls[num_urls][i]; + if (ch == '>' || ch == '\"' || ch == ')' || + ch == ' ' || ch == '\n') { + urls[num_urls][i] = 0; + break; + } + } + num_urls++; + ++searchptr; + } + } + /* * Here we go */ @@ -1612,7 +1637,8 @@ RMSGREAD: scr_flush(); char buf[SIZ]; int founda = 0; - snprintf(buf, sizeof buf, "MSG0 %ld|1", msg_arr[finda]); /* read the header so we can get 'from=' */ + /* read the header so we can get 'from=' */ + snprintf(buf, sizeof buf, "MSG0 %ld|1", msg_arr[finda]); CtdlIPC_putline(ipc, buf); CtdlIPC_getline(ipc, buf); while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) diff --git a/citadel/messages.h b/citadel/messages.h index 1ed820e20..4453190b4 100644 --- a/citadel/messages.h +++ b/citadel/messages.h @@ -1,4 +1,9 @@ /* $Id$ */ + +#define MAXURLS 50 /* Max embedded URL's per message */ +extern int num_urls; +extern char urls[MAXURLS][SIZ]; + int ka_system(char *shc); int entmsg(CtdlIPC *ipc, int is_reply, int c); void readmsgs(CtdlIPC *ipc, enum MessageList c, enum MessageDirection rdir, int q); -- 2.39.2