# End of configuration section
-TARGETS=stringbuf_test stringbuf_IO_test stringbuf_conversion_test hashlist_test mimeparser_test mime_xdg_lookup_test wildfire_test
+TARGETS=stringbuf_test stringbuf_IO_test stringbuf_conversion_test hashlist_test mimeparser_test mime_xdg_lookup_test wildfire_test stripallbut_test
all: $(TARGETS)
-o wildfire_test
+stripallbut_test: $(LIBOBJS) stripallbut_test.o
+ $(CC) $(LDFLAGS) $(LIBOBJS) $(LIBS) \
+ stripallbut_test.o \
+ ../.libs/libcitadel.a \
+ -o stripallbut_test
+
+
.c.o:
$(CC) $(CFLAGS) $(DEFS) -c $<
--- /dev/null
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "../lib/libcitadel.h"
+
+main() {
+ int i;
+ long l;
+
+ char *teststrings[] = {
+ "Nmm <fghjk> tyutyu",
+ "Sdd <> ghhjjkk",
+ "<>",
+ "",
+ "Sdd <",
+ "Df Ghjkl>",
+ ">< bggt",
+ "FSDFSDFSDFSDF<><><>bggt",
+ "FSDFSDFSDF<><eoeo><>bggt",
+ "Abc<QWER>",
+ "><",
+ "Zxcv<dy<<lkj>>>"
+ };
+
+ char *strippedstrings[] = {
+ "fghjk",
+ "",
+ "",
+ "",
+ "Sdd <",
+ "Df Ghjkl>",
+ ">< bggt",
+ "FSDFSDFSDFSDF<><><>bggt",
+ "FSDFSDFSDF<><eoeo><>bggt",
+ "QWER",
+ "><",
+ "lkj"
+ };
+
+ long strippedlens[] = {
+ 5,
+ 0,
+ 0,
+ 0,
+ 5,
+ 9,
+ 7,
+ 23,
+ 24,
+ 4,
+ 2,
+ 3
+ };
+
+ char foo[128];
+
+ for (i=0; i<(sizeof(teststrings) / sizeof (char *)); ++i) {
+ printf("Testing stripallbut()\n");
+ strcpy(foo, teststrings[i]);
+ l = stripallbut(foo, '<', '>');
+
+ assert(!strcmp(foo, strippedstrings[i]));
+ assert(strlen(foo) == strippedlens[i]);
+ }
+
+ exit(0);
+}
att->Data = WCC->upload;
WCC->upload = NULL;
WCC->upload_length = 0;
- display_enter();
- return;
+
+ /* and keep going, because we don't do attachments in two posts anymore */
}
if (!strcasecmp(bstr("submit_action"), "cancel")) {
sprintf(WCC->ImportantMessage,
_("Cancelled. Message was not posted."));
- } else if (havebstr("attach_button")) {
- display_enter();
- return;
} else if (lbstr("postseq") == dont_post) {
sprintf(WCC->ImportantMessage,
_("Automatically cancelled because you have already "
"saved this message."));
- } else if (havebstr("remove_attach_button")) {
- /* now thats st00pit. need to find it by name. */
- void *vAtt;
- StrBuf *WhichAttachment;
- HashPos *at;
- long len;
- const char *key;
-
- WhichAttachment = NewStrBufDup(sbstr("which_attachment"));
- StrBufUnescape(WhichAttachment, 0);
- at = GetNewHashPos(WCC->attachments, 0);
- do {
- GetHashPos(WCC->attachments, at, &len, &key, &vAtt);
-
- att = (wc_mime_attachment*) vAtt;
- if ((att != NULL) &&
- (strcmp(ChrPtr(WhichAttachment),
- ChrPtr(att->FileName) ) == 0))
- {
- DeleteEntryFromHash(WCC->attachments, at);
- break;
- }
- }
- while (NextHashPos(WCC->attachments, at));
- FreeStrBuf(&WhichAttachment);
- display_enter();
- return;
} else {
const char CMD[] = "ENT0 1|%s|%d|4|%s|%s||%s|%s|%s|%s|%s";
StrBuf *Recp = NULL;
}
-
-
void view_mimepart(void) {
mimepart(0);
}
FreeStrBuf(&partnum);
}
+
void h_readnew(void) { readloop(readnew, eUseDefault);}
void h_readold(void) { readloop(readold, eUseDefault);}
void h_readfwd(void) { readloop(readfwd, eUseDefault);}
long keylen;
#ifdef DEBUG_URLSTRINGS
- lprintf(9, "upload_handler() name=%s, type=%s, len=%d\n", name, cbtype, length);
+ lprintf(9, "\033[31mupload_handler() name=%s, type=%s, len=%d\033[0m\n", name, cbtype, length);
#endif
if (WCC->Hdr->urlstrings == NULL)
WCC->Hdr->urlstrings = NewHash(1, NULL);
#endif
}
- /** Uploaded files */
+ /* Uploaded files */
if ( (length > 0) && (!IsEmptyStr(cbtype)) ) {
WCC->upload = NewStrBufPlain(content, length);
WCC->upload_length = length;
WCC->upload_filename = NewStrBufPlain(filename, -1);
- safestrncpy(WCC->upload_content_type, cbtype,
- sizeof(WC->upload_content_type));
+ safestrncpy(WCC->upload_content_type, cbtype, sizeof(WC->upload_content_type));
+#ifdef DEBUG_URLSTRINGS
+ lprintf(9, "File: <%s> len: [%ld]\n", filename, length);
+#endif
}
font-size: 100%;
font-style: italic;
}
+
+#attachments_form {
+ display:none;
+ position:absolute;
+ top:5%;
+ bottom:5%;
+ right:5%;
+ left:5%;
+ z-index: 10;
+ padding: 5px;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #022750;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ background: #FFFFFF;
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF), to(#DDDDEE));
+ background: -moz-linear-gradient(#FFFFFF, #DDDDEE);
+ background: linear-gradient(#FFFFFF, #DDDDEE);
+ -pie-background: linear-gradient(#FFFFFF, #DDDDEE);
+ -webkit-box-shadow: #666 0px 2px 3px;
+ -moz-box-shadow: #666 0px 2px 3px;
+ box-shadow: #666 0px 2px 3px;
+ behavior: url(/static/styles/PIE.htc);
+}
--- /dev/null
+<div align="right">
+<a href="javascript:hide_attachments_form();">
+<?_("Close window")> <img src="static/closewindow.gif"></div>
+</a>
+<h2><img src="static/diskette_24x.gif"> <?_("Attachments:")></h2>
+
+<ul>
+<?ITERATE("MSG:ATTACHNAMES", ="edit_message_section_attach_select")>
+</ul>
+
+<?_("Attach file:")>
+<input name="attachfile" class="attachfile" size=16 type="file">
+ <input type="submit" name="attach_button" value="<?_("Add")>">
+ <input type="submit" name="remove_attach_button" value="<?_("Remove")>">
+
+
<?=("important_msg")><?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
<?ROOMBANNER>
<div id="content">
+
+<div id="attachments_form">
+ <div id="loading">
+ <p><img src="static/throbber.gif" alt=""></p>
+ <p><?_("Loading")></p>
+ </div>
+</div>
+
<div class="entmsg" id="entmsg"><form name="enterform" accept-charset="UTF-8" enctype="multipart/form-data" method="POST" action="post">
<input type="hidden" name="postseq" value="<?DATE:NOW:NO>">
<input type="hidden" name="return_to" value="<?BSTR("return_to")>">
<input type="text" name="subject" id="subject_id" value="<?BSTR("subject", "H")>" size=45 maxlength=70>
</td>
</tr>
-
-</td></tr></table>
-
-<div class="attachment buttons">
-<img src="static/diskette_24x.gif" class="imgedit" ><?_("Attachments:")>
-<select name="which_attachment" size=1>
-<?ITERATE("MSG:ATTACHNAMES", ="edit_message_section_attach_select")>
-</select>
- <?_("Attach file:")>
-<input name="attachfile" class="attachfile" size=16 type="file">
- <input type="submit" name="attach_button" value="<?_("Add")>">
- <input type="submit" name="remove_attach_button" value="<?_("Remove")>">
-</div>
+</td></tr>
+</table>
<input type="hidden" name="sig_inserted" value="yes">
</span>
</a>
</li>
+<li>
+ <a href="javascript:show_attachments_form();">
+ <img src="static/diskette_24x.gif" alt="" width="24" height="24">
+ <span class="navbar_link">
+ <?_("Attach")>
+ </span>
+ </a>
+</li>
<li>
<a href="javascript:submit_post('cancel');">
<img src="static/closewindow.gif" alt="">
</a>
</li><?!("X", 1)>
</div>
-
<script type="text/javascript">
+
$("navbar").innerHTML = $("submit-o-matic").innerHTML;
<?!("COND:BSTR", 1, "__RCPTREQUIRED")>
activate_entmsg_autocompleters();
document.enterform.submit_action.value = which_action;
document.enterform.submit();
}
-</script>
+ function hide_attachments_form() {
+ $('attachments_form').style.display = 'none';
+ }
+
+ function show_attachments_form() {
+ $('attachments_form').style.display = 'block';
+
+ p = 'template=attachments_pane&r=' + CtdlRandomString();
+ new Ajax.Updater(
+ 'attachments_form',
+ 'do_template',
+ {
+ method: 'get',
+ parameters: p,
+ evalScripts: true
+ }
+ );
+ }
+
+</script>
</div>
</div>
</div>
-<option value="<?MAIL:MIME:FILENAME("U")>"><?MAIL:MIME:FILENAME("X")> (%<?MAIL:MIME:CONTENTTYPE>, <?MAIL:MIME:LENGTH>Bytes)</option>
+<li>
+ <?MAIL:MIME:FILENAME("U")>
+ <?MAIL:MIME:FILENAME("X")> (%<?MAIL:MIME:CONTENTTYPE>, <?MAIL:MIME:LENGTH>Bytes)
+ <input type="submit" name="remove_attach_button" value="<?_("Remove")>">
+</li>