if ( (encaps != NULL) && (havebstr("save_button")) ) {
serv_puts("ENT0 1|||4|||1|");
serv_getln(buf, sizeof buf);
- if (buf[0] == '8') {
+ switch (buf[0]) {
+ case '8':
serv_puts("Content-type: text/calendar");
serv_puts("Content-Transfer-Encoding: quoted-printable");
serv_puts("");
text_to_server_qp(icalcomponent_as_ical_string(encaps));
// serv_puts(icalcomponent_as_ical_string(encaps));
serv_puts("000");
- }
- if ( (buf[0] == '8') || (buf[0] == '4') ) {
- while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- }
- }
- if (buf[0] == '2') {
- StrBufAppendBufPlain(WC->ImportantMsg, buf, -1, 4);
+ case '4':
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {}
+ break;
+ case '2':
+ AppendImportantMessage(buf + 4, - 1);
+ break;
+ default:
+ break;
}
icalmemory_free_ring ();
icalcomponent_free(encaps);
GetHash(WCC->InetCfg, ChrPtr(eType), StrLength(eType), &vHash);
Hash = (HashList*) vHash;
if (Hash == NULL) {
- StrBufPrintf(WCC->ImportantMsg, _("Invalid Parameter"));
+ AppendImportantMessage(_("Invalid Parameter"), -1);
url_do_template();
return;
}
eNum = sbstr("ename");
if (!GetHash(Hash, ChrPtr(eNum), StrLength(eNum), &vStr) ||
(vStr == NULL)) {
- StrBufPrintf(WCC->ImportantMsg, _("Invalid Parameter"));
+ AppendImportantMessage(_("Invalid Parameter"), -1);
url_do_template();
return;
}
Str = (StrBuf*)vStr;
- StrBufPrintf(WCC->ImportantMsg, _("%s has been deleted."), ChrPtr(Str));
+ AppendImportantMessage(SKEY(Str));
+ AppendImportantMessage(_(" has been deleted."), -1);
FlushStrBuf(Str);
}
else if (!strcasecmp(bstr("oper"), "add")) {
StrBuf *name;
eName = sbstr("ename");
if (eName == NULL) {
- StrBufPrintf(WCC->ImportantMsg, _("Invalid Parameter"));
+ AppendImportantMessage(_("Invalid Parameter"), -1);
url_do_template();
return;
}
name = NewStrBufDup(eName);
StrBufTrim(name);
Put(Hash, nnn, nUsed, name, HFreeStrBuf);
- StrBufPrintf(WCC->ImportantMsg, "%s %s",
- /*<domain> added status message*/ _("added."),
- ChrPtr(eName));
+ AppendImportantMessage(SKEY(eName));
+ AppendImportantMessage( /*<domain> added status message*/ _(" added."), -1);
}
Buf = NewStrBuf();
serv_printf("MOVE %ld|_TRASH_|0", msgnum);
}
StrBuf_ServGetln(CmdBuf);
- FlushStrBuf(WCC->ImportantMsg);
- StrBufAppendBuf(WCC->ImportantMsg, CmdBuf, 4);
- GetServerStatus(CmdBuf, &CitStatus);
+ GetServerStatusMsg(CmdBuf, &CitStatus, 1, 0);
HttpStatus(CitStatus);
break;
case eCOPY:
Destination = (StrBuf*) vLine;
serv_printf("MOVE %ld|%s|%d", msgnum, ChrPtr(Destination), CopyMessage);
StrBuf_ServGetln(CmdBuf);
- FlushStrBuf(WCC->ImportantMsg);
- StrBufAppendBuf(WCC->ImportantMsg, CmdBuf, 4);
+ GetServerStatusMsg(CmdBuf, NULL, 1, 0);
GetServerStatus(CmdBuf, &CitStatus);
HttpStatus(CitStatus);
}
serv_printf("MOVE %ld|_TRASH_|0", msgnum);
}
StrBuf_ServGetln(CmdBuf);
- FlushStrBuf(WCC->ImportantMsg);
- StrBufAppendBuf(WCC->ImportantMsg, CmdBuf, 4);
+ GetServerStatusMsg(CmdBuf, NULL, 1, 0);
break;
default:
break;
/* temporarily change to the drafts room */
serv_puts("GOTO _DRAFTS_");
StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) != 2) {
+ if (GetServerStatusMsg(Buf, NULL, 1, 2) != 2) {
/* You probably don't even have a dumb Drafts folder */
- StrBufCutLeft(Buf, 4);
- syslog(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
- StrBufAppendBufPlain(WCC->ImportantMsg, _("Saved to Drafts failed: "), -1, 0);
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 0);
+ syslog(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf) + 4);
+ AppendImportantMessage(_("Saved to Drafts failed: "), -1);
display_enter();
FreeStrBuf(&Buf);
return;
if ((HeaderLen + StrLength(sbstr("msgtext")) < 10) &&
(GetCount(WCC->attachments) == 0)){
- StrBufAppendBufPlain(WCC->ImportantMsg, _("Refusing to post empty message.\n"), -1, 0);
+ AppendImportantMessage(_("Refusing to post empty message.\n"), -1);
FreeStrBuf(&CmdBuf);
}
}
post_mime_to_server();
if (save_to_drafts) {
- StrBufAppendBufPlain(WCC->ImportantMsg, _("Message has been saved to Drafts.\n"), -1, 0);
+ AppendImportantMessage(_("Message has been saved to Drafts.\n"), -1);
gotoroom(WCC->CurRoom.name);
display_enter();
FreeStrBuf(&Buf);
|| (havebstr("cc" ))
|| (havebstr("bcc" ))
) {
- StrBufAppendBufPlain(WCC->ImportantMsg, _("Message has been sent.\n"), -1, 0);
+ AppendImportantMessage(_("Message has been sent.\n"), -1);
}
else {
- StrBufAppendBufPlain(WCC->ImportantMsg, _("Message has been posted.\n"), -1, 0);
+ AppendImportantMessage(_("Message has been posted.\n"), -1);
}
dont_post = lbstr("postseq");
} else {
- StrBufCutLeft(Buf, 4);
-
- syslog(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 0);
+ syslog(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf) + 4);
+ AppendImportantMessage(ChrPtr(Buf) + 4, StrLength(Buf) - 4);
if (save_to_drafts) gotoroom(WCC->CurRoom.name);
display_enter();
FreeStrBuf(&Buf);
1,
NULL);
if (ProhibitSave == 1)
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("This isn't allowed to become the start page."),
- -1, 0);
+ AppendImportantMessage(_("This isn't allowed to become the start page."), -1);
else
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("You no longer have a start page selected."),
- -1, 0);
+ AppendImportantMessage(_("You no longer have a start page selected."), -1);
display_main_menu();
return;
}
HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP)
{
- wcsession *WCC = WC;
StrBuf *Line;
StrBuf *Token;
long State;
}
}
else if (State == 550)
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("Higher access is required to access this function."), -1, 0);
+ AppendImportantMessage(_("Higher access is required to access this function."), -1);
FreeStrBuf(&Line);
}
}
else if (State == 550)
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("Higher access is required to access this function."), -1, 0);
+ AppendImportantMessage(_("Higher access is required to access this function."), -1);
return WCC->CurRoom.IgnetCfgs[WantThisOne];
WCC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|');
}
else if (State == 550)
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("Higher access is required to access this function."), -1, 0);
+ AppendImportantMessage(_("Higher access is required to access this function."), -1);
FreeStrBuf(&Buf);
}
StrBuf_ServGetln(Buf);
GetServerStatus(Buf, &State);
if (State == 550)
- StrBufAppendBufPlain(WC->ImportantMsg,
- _("Higher access is required to access this function."), -1, 0);
+ AppendImportantMessage(_("Higher access is required to access this function."), -1);
FreeStrBuf(&Buf);
}
* usernum the citadel-uid of the user
*/
void display_edit_address_book_entry(const char *username, long usernum) {
- wcsession *WCC = WC;
message_summary *VCMsg = NULL;
wc_mime_attachment *VCAtt = NULL;
StrBuf *roomname;
GetServerStatus(Buf, NULL);
serv_printf("GOTO %s||1", ChrPtr(roomname));
StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) != 2) {
- FlushStrBuf(WCC->ImportantMsg);
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 4);
+ if (GetServerStatusMsg(Buf, NULL, 1, 2) != 2) {
select_user_to_edit(username);
FreeStrBuf(&Buf);
FreeStrBuf(&roomname);
locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
if (VCMsg == NULL) {
- StrBufPlain(WCC->ImportantMsg,
- _("An error occurred while trying to create or edit this address book entry."),
- 0);
+ AppendImportantMessage(_("An error occurred while trying to create or edit this address book entry."), -1);
select_user_to_edit(username);
FreeStrBuf(&roomname);
return;
* username the name of the user to remove
*/
void delete_user(char *username) {
- wcsession *WCC = WC;
StrBuf *Buf;
Buf = NewStrBuf();
serv_printf("ASUP %s|0|0|0|0|0|", username);
StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) != 2)
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 4);
+ GetServerStatusMsg(Buf, NULL, 1, 2);
select_user_to_edit( bstr("username"));
FreeStrBuf(&Buf);
void display_edituser(const char *supplied_username, int is_new) {
const char *Pos;
- wcsession *WCC = WC;
UserListEntry* UL;
StrBuf *Buf;
char username[256];
Buf = NewStrBuf();
serv_printf("AGUP %s", username);
StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) != 2) {
- FlushStrBuf(WCC->ImportantMsg);
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 4);
+ if (GetServerStatusMsg(Buf, NULL, 1, 2) != 2) {
select_user_to_edit(username);
FreeStrBuf(&Buf);
return;
* do the backend operation of the user edit on the server
*/
void edituser(void) {
- wcsession *WCC = WC;
int is_new = 0;
unsigned int flags = 0;
const char *username;
username = bstr("username");
if (!havebstr("ok_button")) {
- StrBufPlain(WCC->ImportantMsg, _("Changes were not saved."), -1);
+ AppendImportantMessage(_("Changes were not saved."), -1);
}
else {
StrBuf *Buf = NewStrBuf();
if ((havebstr("newname")) && (strcasecmp(bstr("username"), bstr("newname")))) {
serv_printf("RENU %s|%s", bstr("username"), bstr("newname"));
StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) == 2) {
- FlushStrBuf(WCC->ImportantMsg);
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 4);
- }
- else {
+ if (GetServerStatusMsg(Buf, NULL, 1, 2) != 2) {
username = bstr("newname");
}
}
bstr("purgedays")
);
StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) == 2) {
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 4);
- }
+ GetServerStatusMsg(Buf, NULL, 1, 2);
FreeStrBuf(&Buf);
}
* take the web environment username and create it on the citadel server
*/
void create_user(void) {
- wcsession *WCC = WC;
long FullState;
StrBuf *Buf;
const char *username;
display_edituser(username, 1);
}
else if (FullState == 570) {
- StrBufPlain(WCC->ImportantMsg,
- _("You are attempting to create a new user from within Citadel "
- "while running in host based authentication mode. In this mode, "
- "you must create new users on the host system, not within Citadel."),
- 0);
+ AppendImportantMessage(_("You are attempting to create a new user from within Citadel "
+ "while running in host based authentication mode. In this mode, "
+ "you must create new users on the host system, not within Citadel."),
+ -1);
select_user_to_edit(NULL);
}
else {
- StrBufAppendBuf(WCC->ImportantMsg, Buf, 4);
+ AppendImportantMessage(ChrPtr(Buf) + 4, StrLength(Buf) - 4);
select_user_to_edit(NULL);
}
FreeStrBuf(&Buf);
}
}
if (is_qp) {
- // %ff can become 6 bytes in utf8
+ /* %ff can become 6 bytes in utf8 */
*storename = malloc(len * 2 + 3);
j = CtdlDecodeQuotedPrintable(
*storename, name,
(*storename)[j] = 0;
}
else if (is_b64) {
- // ff will become one byte..
+ /* ff will become one byte.. */
*storename = malloc(len + 50);
CtdlDecodeBase64(
*storename, name,
* parse edited vcard from the browser
*/
void submit_vcard(void) {
- wcsession *WCC = WC;
struct vCard *v;
char *serialized_vcard;
char buf[SIZ];
StrBuf *Buf;
+ const StrBuf *ForceRoom;
int i;
if (!havebstr("ok_button")) {
}
if (havebstr("force_room")) {
- if (gotoroom(sbstr("force_room")) != 200) {
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("Unable to enter the room to save your message"),
- -1, 0);
- StrBufAppendBufPlain(WCC->ImportantMsg,
- HKEY(": "), 0);
- StrBufAppendBuf(WCC->ImportantMsg, sbstr("force_room"), 0);
- StrBufAppendBufPlain(WCC->ImportantMsg,
- HKEY("; "), 0);
-
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("Aborting."),
- -1, 0);
+ ForceRoom = sbstr("force_room");
+ if (gotoroom(ForceRoom) != 200) {
+ AppendImportantMessage(_("Unable to enter the room to save your message"), -1);
+ AppendImportantMessage(HKEY(": "));
+ AppendImportantMessage(SKEY(ForceRoom));
+ AppendImportantMessage(HKEY("; "));
+ AppendImportantMessage(_("Aborting."), -1);
if (!strcmp(bstr("return_to"), "select_user_to_edit")) {
select_user_to_edit(NULL);