]> code.citadel.org Git - citadel.git/commitdiff
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 30 Jun 2011 21:13:10 +0000 (21:13 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 30 Jun 2011 21:13:10 +0000 (21:13 +0000)
citadel/modules/imap/imap_metadata.c
citadel/modules/inetcfg/serv_inetcfg.c
citadel/modules/vcard/serv_vcard.c
citadel/modules/wiki/serv_wiki.c
libcitadel/lib/stringbuf.c
libcitadel/tests/stringbuf_conversion.c
webcit/static/styles/webcit.css

index cfbc10370675609cf5bbd8d953baaae9879e8e73..705448e459f6d5b2ea5f3474d58f8507b372327b 100644 (file)
@@ -206,11 +206,13 @@ void imap_getmetadata(int num_parms, ConstStr *Params) {
        int ret;
        int found = 0;
 
+/* this doesn't work if you have rooms/floors with spaces. 
+   we need this for the bynari connector.
        if (num_parms > 5) {
                IReply("BAD usage error");
                return;
        }
-
+*/
        ret = imap_grabroom(roomname, Params[2].Key, 1);
        if (ret != 0) {
                IReply("NO Invalid mailbox name or access denied");
index 3ac9339c2045d65573e411c741fe0053b6f3ea49..6d29311b3a5ef1da074abce2edf9f9d5ef2cb33b 100644 (file)
@@ -81,39 +81,6 @@ void inetcfg_setTo(struct CtdlMessage *msg) {
 }
 
 
-#ifdef ___NOT_CURRENTLY_IN_USE___
-void spamstrings_setTo(struct CtdlMessage *msg) {
-       char buf[SIZ];
-       char *conf;
-       struct spamstrings_t *sptr;
-       int i, n;
-
-       /* Clear out the existing list */
-       while (spamstrings != NULL) {
-               sptr = spamstrings;
-               spamstrings = spamstrings->next;
-               free(sptr->string);
-               free(sptr);
-       }
-
-       /* Read in the new list */
-       if (msg->cm_fields['M']==NULL) return;
-       conf = strdup(msg->cm_fields['M']);
-       if (conf == NULL) return;
-
-       n = num_tokens(conf, '\n');
-       for (i=0; i<n; ++i) {
-               extract_token(buf, conf, i, '\n', sizeof buf);
-               sptr = malloc(sizeof(struct spamstrings_t));
-               sptr->string = strdup(buf);
-               sptr->next = spamstrings;
-               spamstrings = sptr;
-       }
-
-}
-#endif
-
-
 /*
  * This handler detects changes being made to the system's Internet
  * configuration.
@@ -160,19 +127,6 @@ void inetcfg_init_backend(long msgnum, void *userdata) {
 }
 
 
-#ifdef ___NOT_CURRENTLY_IN_USE___
-void spamstrings_init_backend(long msgnum, void *userdata) {
-       struct CtdlMessage *msg;
-
-               msg = CtdlFetchMessage(msgnum, 1);
-               if (msg != NULL) {
-               spamstrings_setTo(msg);
-                       CtdlFreeMessage(msg);
-       }
-}
-#endif
-
-
 void inetcfg_init(void) {
        if (CtdlGetRoom(&CC->room, SYSCONFIGROOM) != 0) return;
        CtdlForEachMessage(MSGS_LAST, 1, NULL, INTERNETCFG, NULL,
index 8340d4eebad1a7632d5c03d3376fa6208b9d2fb3..7a0df9ae80f523a01b87a5db31d4e2d5a524f8f8 100644 (file)
@@ -198,7 +198,7 @@ void cmd_igab(char *argbuf) {
        CtdlDirectoryInit();
 
        /* We want *all* vCards in this room */
-       CtdlForEachMessage(MSGS_ALL, 0, NULL, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
+       CtdlForEachMessage(MSGS_ALL, 0, NULL, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
                NULL, vcard_add_to_directory, NULL);
 
        CtdlGetRoom(&CC->room, hold_rm);        /* return to saved room */
@@ -393,7 +393,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
                 * vCard in the user's config room at all times.
                 *
                 */
-               CtdlDeleteMessages(CC->room.QRname, NULL, 0, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$");
+               CtdlDeleteMessages(CC->room.QRname, NULL, 0, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$");
 
                /* Make the author of the message the name of the user. */
                if (msg->cm_fields['A'] != NULL) {
@@ -607,7 +607,7 @@ struct vCard *vcard_get_user(struct ctdluser *u) {
 
        /* We want the last (and probably only) vcard in this room */
        VCmsgnum = (-1);
-       CtdlForEachMessage(MSGS_LAST, 1, NULL, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
+       CtdlForEachMessage(MSGS_LAST, 1, NULL, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
                NULL, vcard_gu_backend, (void *)&VCmsgnum );
        CtdlGetRoom(&CC->room, hold_rm);        /* return to saved room */
 
@@ -1323,7 +1323,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) {
 
        /* First remove any addresses we already have in the address book */
        CtdlUserGoto(aptr->roomname, 0, 0, NULL, NULL);
-       CtdlForEachMessage(MSGS_ALL, 0, NULL, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$", NULL,
+       CtdlForEachMessage(MSGS_ALL, 0, NULL, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$", NULL,
                strip_addresses_already_have, aptr->collected_addresses);
 
        if (!IsEmptyStr(aptr->collected_addresses))
index 0399124b396e44949fccfdc29af3070d37fbbf89..49a039809f6a130237c845fc5e63a6e9826fc5d7 100644 (file)
@@ -239,6 +239,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) {
         */
        if (history_msg->cm_fields['I'] != NULL) {
                free(history_msg->cm_fields['I']);
+               history_msg->cm_fields['I'] = NULL;
        }
 
        /* Figure out the boundary string.  We do this even when we generated the
index b13233c037257b035297ef848deda3879e7d8c26..175abbc57a110f30dc76d5a40155f3a68006567d 100644 (file)
@@ -2282,20 +2282,20 @@ long StrHtmlEcmaEscAppend(StrBuf *Target, const StrBuf *Source, const char *Plai
                        if (((unsigned char)*aptr) >= 0x20)
                        {
                                IsUtf8Sequence =  Ctdl_GetUtf8SequenceLength(aptr, eiptr);
-                               
+
                                *bptr = *aptr;
                                Target->BufUsed ++;
-                               while (IsUtf8Sequence > 1){
-                                       if(bptr + IsUtf8Sequence >= eptr) {
-                                               IncreaseBuf(Target, 1, -1);
-                                               eptr = Target->buf + Target->BufSize - 11; /* our biggest unit to put in...  */
-                                               bptr = Target->buf + Target->BufUsed - 1;
-                                       }
+                               if (IsUtf8Sequence > 1) while (IsUtf8Sequence > 0){
+                                               if(bptr + IsUtf8Sequence >= eptr) {
+                                                       IncreaseBuf(Target, 1, -1);
+                                                       eptr = Target->buf + Target->BufSize - 11; /* our biggest unit to put in...  */
+                                                       bptr = Target->buf + Target->BufUsed - 1;
+                                               }
                                        bptr++; aptr++;
-                                       IsUtf8Sequence --;
-                                       *bptr = *aptr;
-                                       Target->BufUsed ++;
-                               }
+                                               IsUtf8Sequence --;
+                                               *bptr = *aptr;
+                                               Target->BufUsed ++;
+                                       }
                                bptr++;
                        }
 
index a554c82618f5858fe2285e819c66d4c8fe4911d3..cb3dcb667f8c920f67c3f67754dac2156e8cdb25 100644 (file)
@@ -31,6 +31,9 @@
 int fromstdin = 0;
 int parse_email = 0;
 int parse_html = 0;
+int OutputEscape = 0;
+int OutputEscapeAs = 0;
+
 static void TestRevalidateStrBuf(StrBuf *Buf)
 {
        CU_ASSERT(strlen(ChrPtr(Buf)) == StrLength(Buf));
@@ -137,6 +140,127 @@ static void TestRFC822DecodeStdin(void)
 }
 
 
+static void TestHTMLEscEncodeStdin(void)
+{
+       int fdin = 0;// STDIN
+       const char *Err;
+       StrBuf *Target;
+       StrBuf *Source;
+
+       Source = NewStrBuf();
+
+       while (fdin == 0) {
+
+               StrBufTCP_read_line(Source, &fdin, 0, &Err);
+               Target = NewStrBuf();
+               
+               StrEscAppend(Target, Source, NULL, 0, 2);
+               
+               TestRevalidateStrBuf(Target);
+               printf("%s\n", ChrPtr(Target));
+               FreeStrBuf(&Target);
+       }
+       FreeStrBuf(&Source);
+}
+
+static void TestEscEncodeStdin(void)
+{
+       int fdin = 0;// STDIN
+       const char *Err;
+       StrBuf *Target;
+       StrBuf *Source;
+
+       Source = NewStrBuf();
+
+       while (fdin == 0) {
+
+               StrBufTCP_read_line(Source, &fdin, 0, &Err);
+               Target = NewStrBuf();
+               
+               StrEscAppend(Target, Source, NULL, 0, 0);
+               
+               TestRevalidateStrBuf(Target);
+               printf("%s\n", ChrPtr(Target));
+               FreeStrBuf(&Target);
+       }
+       FreeStrBuf(&Source);
+}
+
+
+static void TestECMAEscEncodeStdin(void)
+{
+       int fdin = 0;// STDIN
+       const char *Err;
+       StrBuf *Target;
+       StrBuf *Source;
+
+       Source = NewStrBuf();
+
+       printf("[");
+       while (fdin == 0) {
+
+               StrBufTCP_read_line(Source, &fdin, 0, &Err);
+               Target = NewStrBuf();
+               
+               StrECMAEscAppend(Target, Source, NULL);
+               
+               TestRevalidateStrBuf(Target);
+               printf("\"%s\",\n", ChrPtr(Target));
+               FreeStrBuf(&Target);
+       }
+       printf("]\n");
+       FreeStrBuf(&Source);
+}
+
+static void TestHtmlEcmaEscEncodeStdin(void)
+{
+       int fdin = 0;// STDIN
+       const char *Err;
+       StrBuf *Target;
+       StrBuf *Source;
+
+       Source = NewStrBuf();
+
+       printf("[");
+       while (fdin == 0) {
+
+               StrBufTCP_read_line(Source, &fdin, 0, &Err);
+               Target = NewStrBuf();
+               
+               StrHtmlEcmaEscAppend(Target, Source, NULL, 0, 2);
+               
+               TestRevalidateStrBuf(Target);
+               printf("\"%s\",\n", ChrPtr(Target));
+               FreeStrBuf(&Target);
+       }
+       printf("]");
+       FreeStrBuf(&Source);
+}
+
+static void TestUrlescEncodeStdin(void)
+{
+       int fdin = 0;// STDIN
+       const char *Err;
+       StrBuf *Target;
+       StrBuf *Source;
+
+       Source = NewStrBuf();
+
+       while (fdin == 0) {
+
+               StrBufTCP_read_line(Source, &fdin, 0, &Err);
+               Target = NewStrBuf();
+               
+               StrBufUrlescAppend(Target, Source, NULL);
+               
+               TestRevalidateStrBuf(Target);
+               printf("%s\n", ChrPtr(Target));
+               FreeStrBuf(&Target);
+       }
+       FreeStrBuf(&Source);
+}
+
+
 static void TestEncodeEmail(void)
 {
        StrBuf *Target;
@@ -251,7 +375,31 @@ static void AddStrBufSimlpeTests(void)
                        pTest = CU_add_test(pGroup, "testRFC822Decode3", TestRFC822Decode);
                }
                else
-                       pTest = CU_add_test(pGroup, "testRFC822DecodeSTDIN", TestRFC822DecodeStdin);
+               {
+                       if (!OutputEscape)
+                               pTest = CU_add_test(pGroup, "testRFC822DecodeSTDIN", TestRFC822DecodeStdin);
+                       else switch(OutputEscapeAs)
+                            {
+                            case 'H':
+                                    pTest = CU_add_test(pGroup, "TestHTMLEscEncodeStdin", TestHTMLEscEncodeStdin);
+                                    break;
+                            case 'X':
+                                    pTest = CU_add_test(pGroup, "TestEscEncodeStdin", TestEscEncodeStdin);
+                                    break;
+                            case 'J':
+                                    pTest = CU_add_test(pGroup, "TestECMAEscEncodeStdin", TestECMAEscEncodeStdin);
+                                    break;
+                            case 'K':
+                                    pTest = CU_add_test(pGroup, "TestHtmlEcmaEscEncodeStdin", TestHtmlEcmaEscEncodeStdin);
+                                    break;
+                            case 'U':
+                                    pTest = CU_add_test(pGroup, "TestUrlescEncodeStdin", TestUrlescEncodeStdin);
+                                    break;
+                            default:
+                                    printf("%c not supported!\n", OutputEscapeAs);
+                                    CU_ASSERT(1);
+                            }
+               }
        }
 
 }
@@ -261,8 +409,15 @@ int main(int argc, char* argv[])
 {
        int a;
 
-       while ((a = getopt(argc, argv, "@ih")) != EOF)
+       while ((a = getopt(argc, argv, "@iho:")) != EOF)
                switch (a) {
+               case 'o':
+                       if (optarg)
+                       {
+                               OutputEscape = 1;
+                               OutputEscapeAs = *optarg;
+                       }
+                       break;
                case 'h':
                        parse_html = 1;
                        break;
index 497bf88af028c82ae81fc4f0db6c83487b085230..5fb788d735b8303ada5be8c11ed8010851615ec5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 - 2010 The Citadel Team
+ * Copyright 2005 - 2011 The Citadel Team
  * Licensed under the GPL V3
  */
 
@@ -544,7 +544,7 @@ body {
 }
 
 /* Override to disable list-style-image" */
-.room a, .room a, .room a:visited, .room a:link { color: #333333 }
+.room a, .room a, .room a:visited, .room a:link { color: #f0feff }
 
 .room-private { list-style-image: url("/static/privatemess_16x.gif") }