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");
}
-#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.
}
-#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,
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 */
* 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) {
/* 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 */
/* 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))
*/
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
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++;
}
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));
}
+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;
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);
+ }
+ }
}
}
{
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;
/*
- * Copyright 2005 - 2010 The Citadel Team
+ * Copyright 2005 - 2011 The Citadel Team
* Licensed under the GPL V3
*/
}
/* 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") }