]> code.citadel.org Git - citadel.git/blobdiff - citadel/messages.c
* Replaced the DEFAULT_ENTRY definition in sysconfig.h with a new option
[citadel.git] / citadel / messages.c
index fa754faa6938710ce1263d2574942f68ebf8b472..24b051464c9802cee62ff94a425544d4840d7df8 100644 (file)
@@ -65,6 +65,7 @@ unsigned long *msg_arr = NULL;
 int msg_arr_size = 0;
 int num_msgs;
 char rc_alt_semantics;
+char rc_reply_extedit;
 extern char room_name[];
 extern unsigned room_flags;
 extern long highest_msg_read;
@@ -87,6 +88,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 +366,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 +596,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) && (num_urls < MAXURLS) ) {
+               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
         */
@@ -738,7 +764,7 @@ void replace_string(char *filename, long int startpos)
 int client_make_message(CtdlIPC *ipc,
                char *filename,         /* temporary file name */
                char *recipient,        /* NULL if it's not mail */
-               int anon_type,          /* see MES_ types in header file */
+               int is_anonymous,
                int format_type,
                int mode,
                char *subject)          /* buffer to store subject line */
@@ -772,7 +798,10 @@ int client_make_message(CtdlIPC *ipc,
        }
        else {
                snprintf(header, sizeof header,
-                       " %s from %s", datestr, fullname);
+                       " %s from %s",
+                       datestr,
+                       (is_anonymous ? "[anonymous]" : fullname)
+                       );
                if (strlen(recipient) > 0) {
                        size_t tmp = strlen(header);
                        snprintf(&header[tmp], sizeof header - tmp,
@@ -1562,6 +1591,12 @@ RMSGREAD:        scr_flush();
                                scr_printf("%s\n", cmd);
                        } else {
                                extract(filename, cmd, 2);
+                               /*
+                                * Part 1 won't have a filename; use the
+                                * subject of the message instead. IO
+                                */
+                               if (!strlen(filename))
+                                       strcpy(filename, reply_subject);
                                destination_directory(save_to, filename);
                                save_buffer(attachment,
                                                extract_unsigned_long(cmd, 0),
@@ -1585,7 +1620,7 @@ RMSGREAD: scr_flush();
                        goto RMSGREAD;
                case 'r':
                        savedpos = num_msgs;
-                       entmsg(ipc, 1, (DEFAULT_ENTRY == 46 ? 2 : 0));
+                       entmsg(ipc, 1, (rc_reply_extedit ? 2 : 0));
                        num_msgs = savedpos;
                        goto RMSGREAD;
                case 'u':
@@ -1603,7 +1638,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"))