]> code.citadel.org Git - citadel.git/commitdiff
Quick hack to improve embedded URL extraction
authorArt Cancro <ajc@citadel.org>
Mon, 2 Apr 2007 21:28:05 +0000 (21:28 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 2 Apr 2007 21:28:05 +0000 (21:28 +0000)
webcit/messages.c

index 640c5d32219564c2b3f9e49073f2fdda76451d74..1e79860a54649518b84d80468d7f93faef608d47 100644 (file)
@@ -254,14 +254,10 @@ void url(char *buf)
 
        int pos;
        int start, end;
-       char ench, eench;
        char urlbuf[SIZ];
        char outbuf[1024];
-
        start = (-1);
        end = strlen(buf);
-       ench = 0;
-       eench = 0;
 
        for (pos = 0; pos < strlen(buf); ++pos) {
                if (!strncasecmp(&buf[pos], "http://", 7))
@@ -273,22 +269,23 @@ void url(char *buf)
        if (start < 0)
                return;
 
-       if ((start > 0) && (buf[start - 1] == '<'))
-               ench = '>';
-       if ((start > 0) && (buf[start - 1] == '('))
-               ench = ')';
-       if ((start > 0) && (buf[start - 1] == '{'))
-               ench = '}';
-       if ((start > 0) && (buf[start - 1] == '[')) {
-               ench = ']';
-               eench = '|';
-       }
-
        for (pos = strlen(buf); pos > start; --pos) {
-               if ((buf[pos] == ' ')  || 
-                   (buf[pos] == ench) ||
-                   (buf[pos] == eench))
+               if (  (buf[pos] == ' ')
+                  || (buf[pos] == '{')
+                  || (buf[pos] == '}')
+                  || (buf[pos] == '|')
+                  || (buf[pos] == '\\')
+                  || (buf[pos] == '^')
+                  || (buf[pos] == '[')
+                  || (buf[pos] == ']')
+                  || (buf[pos] == '`')
+                  || (buf[pos] == '<')
+                  || (buf[pos] == '>')
+                  || (buf[pos] == '(')
+                  || (buf[pos] == ')')
+               ) {
                        end = pos;
+               }
        }
 
        strncpy(urlbuf, &buf[start], end - start);