/*
* Text client functions for reading and writing of messages
*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2016 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
#include <stdarg.h>
#include <libcitadel.h>
-///#include "citadel.h"
#include "citadel_ipc.h"
#include "citadel_decls.h"
#include "messages.h"
#include "commands.h"
#include "tuiconfig.h"
#include "rooms.h"
-//#ifndef HAVE_SNPRINTF
-///#include "snprintf.h"
-//#endif
#include "screen.h"
#define MAXWORDBUF SIZ
}
/* Extract URL's */
+ static char *urlprefixes[] = {
+ "http://",
+ "https://",
+ "ftp://"
+ };
+ int p = 0;
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;
+ for (p=0; p<(sizeof urlprefixes / sizeof(char *)); ++p) {
+ searchptr = message->text;
+ while ( (searchptr != NULL) && (num_urls < MAXURLS) ) {
+ searchptr = strstr(searchptr, urlprefixes[p]);
+ 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;
}
- num_urls++;
- ++searchptr;
}
}
long msglen = 0L;
int rv;
- newprompt("Enter test to be replaced: ", srch_str, (sizeof(srch_str)-1) );
+ newprompt("Enter text to be replaced: ", srch_str, (sizeof(srch_str)-1) );
if (IsEmptyStr(srch_str)) {
return;
}