* Added a README.txt file because some Joker kept bugging me about it
authorArt Cancro <ajc@citadel.org>
Tue, 5 Aug 2003 03:06:58 +0000 (03:06 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 5 Aug 2003 03:06:58 +0000 (03:06 +0000)
* 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
citadel/README.txt [new file with mode: 0644]
citadel/commands.c
citadel/commands.h
citadel/messages.c
citadel/messages.h

index 7a4151f78dcd738cd89cabd5eb40f5015d38b899..8d3f8f8cbadc1f418d35b9aa151d62e9291c4fc4 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
diff --git a/citadel/README.txt b/citadel/README.txt
new file mode 100644 (file)
index 0000000..3db12c5
--- /dev/null
@@ -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
+
index a3d471978b2539346c7348e492b564d421090490..d969539c1651bef968ce65836dc441b8c582ed74 100644 (file)
@@ -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) 
index 8a4180b841b893c66ec7468d407d49cfe6a8268f..79c39809e492c2a5db52cc1a06da4de883a63bdc 100644 (file)
@@ -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;
index 6590077691caddc502e334ef1f7dff67bc3a458a..b125bea2a45c4752a828768d43e7a674cf2e5cc7 100644 (file)
@@ -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")) 
index 1ed820e20c130e4dac2f3a4c062a254f02beffe5..4453190b4be938c4e0abb784d704a921d2feb176 100644 (file)
@@ -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);