*/
void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from,
int unread, calview *calv) {
+ StrBuf *Buf;
char buf[SIZ];
icalproperty *prop;
icalcomponent *vevent, *encaps;
serv_puts("Content-type: text/calendar");
serv_puts("Content-Transfer-Encoding: quoted-printable");
serv_puts("");
- text_to_server_qp(icalcomponent_as_ical_string(encaps));
+ Buf = NewStrBufPlain(icalcomponent_as_ical_string(encaps), -1);
+ text_to_server_qp(Buf);
+ FreeStrBuf(&Buf);
// serv_puts(icalcomponent_as_ical_string(encaps));
serv_puts("000");
case '4':
/* Remember, serv_printf() appends an extra newline */
if (include_text_alt) {
+ StrBuf *Buf;
serv_printf("Content-type: multipart/alternative; "
"boundary=\"%s\"\n", alt_boundary);
serv_printf("This is a multipart message in MIME format.\n");
serv_puts("Content-Transfer-Encoding: quoted-printable");
serv_puts("");
txtmail = html_to_ascii(bstr("msgtext"), 0, 80, 0);
- text_to_server_qp(txtmail); /* Transmit message in quoted-printable encoding */
+ Buf = NewStrBufPlain(txtmail, -1);
free(txtmail);
+ text_to_server_qp(Buf); /* Transmit message in quoted-printable encoding */
+ FreeStrBuf(&Buf);
serv_printf("\n--%s", alt_boundary);
}
serv_puts("Content-type: text/x-markdown; charset=utf-8");
serv_puts("Content-Transfer-Encoding: quoted-printable");
serv_puts("");
- text_to_server_qp(bstr("msgtext")); /* Transmit message in quoted-printable encoding */
+ text_to_server_qp(sbstr("msgtext")); /* Transmit message in quoted-printable encoding */
}
else
{
serv_puts("Content-Transfer-Encoding: quoted-printable");
serv_puts("");
serv_puts("<html><body>\r\n");
- text_to_server_qp(bstr("msgtext")); /* Transmit message in quoted-printable encoding */
+ text_to_server_qp(sbstr("msgtext")); /* Transmit message in quoted-printable encoding */
serv_puts("</body></html>\r\n");
}
/*
* Transmit message text (in memory) to the server, converting to Quoted-Printable encoding as we go.
*/
-void text_to_server_qp(char *ptr)
+void text_to_server_qp(const StrBuf *SendMeEncoded)
{
- unsigned char ch, buf[256];
- int pos;
- int output_len = 0;
+ StrBuf *ServBuf;
- pos = 0;
- buf[0] = 0;
- output_len = 0;
-
- while (ptr[pos] != 0) {
- ch = (unsigned char)(ptr[pos++]);
-
- if (ch == 13) {
- /* ignore carriage returns */
- }
- else if (ch == 10) {
- /* hard line break */
- if (output_len > 0) {
- if (isspace(buf[output_len-1])) {
- sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
- output_len += 2;
- }
- }
- buf[output_len++] = 0;
- serv_puts((char *)buf);
- output_len = 0;
- }
- else if (ch == 9) {
- buf[output_len++] = ch;
- }
- else if ( (ch >= 32) && (ch <= 60) ) {
- buf[output_len++] = ch;
- }
- else if ( (ch >= 62) && (ch <= 126) ) {
- buf[output_len++] = ch;
- }
- else {
- sprintf((char *)&buf[output_len], "=%02X", ch);
- output_len += 3;
- }
-
- if (output_len > 72) {
- /* soft line break */
- if (isspace(buf[output_len-1])) {
- sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
- output_len += 2;
- }
- buf[output_len++] = '=';
- buf[output_len++] = 0;
- serv_puts((char *)buf);
- output_len = 0;
- }
- }
-
- /* end of data - transmit anything that's left */
- if (output_len > 0) {
- if (isspace(buf[output_len-1])) {
- sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
- output_len += 2;
- }
- buf[output_len++] = 0;
- serv_puts((char *)buf);
- output_len = 0;
- }
+ ServBuf = StrBufRFC2047encodeMessage(SendMeEncoded);
+ serv_putbuf(ServBuf);
+ FreeStrBuf(&ServBuf);
}
</div>
</div>
+<div class="entmsg" id="entmsg">
+<form id="theenterform" 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="hidden" name="nonce" value="<?NONCE>">
+<input type="hidden" name="force_room" value="<?THISROOM:NAME("X")>">
+<input type="hidden" name="references" value="<?BSTR("references")>">
+<input type="hidden" name="page" value="<?BSTR("page")>">
+<input type="hidden" name="markdown" value="1">
+<textarea style="display:none" name="msgtext" id="submitmsgtext" cols="80" rows="15"><?MAIL:EDITWIKI("edit", "X")></textarea>
+</form>
+
<div id="Author">
<select name="display_name" size=1 id="from_id">
<?ITERATE("PREF:VALID:EMAIL:NAME", ="prefs_section_msg_handle_select")>
<?!("X", 3)>
</select>
</div>
-<div id="epiceditor">
+<div id="epiceditor" />
-<textarea id="msgtext" cols="80" rows="15"><?MAIL:EDITWIKI("edit", "X")></textarea>
-</div>
+</div>
</div>
</div>
</div>
<script type="text/javascript">
- console.log('blarg');
$("navbar").innerHTML = $("submit-o-matic").innerHTML;
- console.log('blub');
function submit_post(which_action) {
-
- var p = { "postseq":"<?DATE:NOW:NO>",
- "return_to":"<?BSTR("return_to")>",
- "nonce":"<?NONCE>",
- "force_room":"<?THISROOM:NAME("X")>",
- "references":"<?BSTR("references")>",
- "page":"<?BSTR("page")>",
- "display_name":"willi",
- "submit_action":"",
- "markdown":"1",
- "msgtext" : editor.exportFile()
- };
-
- new Ajax.Request('post', {
- method: 'post',
- parameters: p,
- onComplete: function(transport) { ajax_important_message(transport.responseText.substr(4));}
- });
+ var textarea=document.getElementById('submitmsgtext');
+ textarea.value = editor.exportFile();
+ editor.unload();
+ document.getElementById("theenterform").submit();
}
function hide_attachments_form() {
<script type="text/javascript">
var editor = new EpicEditor().load();
+editor.importFile('CitadelEditBuffer', document.getElementById('submitmsgtext').value);
</script>
<?=("addressbook_popup")>
<?=("trailing")>
int read_server_text(StrBuf *Buf, long *nLines);
void text_to_server(char *ptr);
-void text_to_server_qp(char *ptr);
+void text_to_server_qp(const StrBuf *SendMeEncoded);
void server_to_text(void);
int lingering_close(int fd);