be either the account's display name or the vCard's friendly name.
formout(ipc, "help");
break;
case 4:
- entmsg(ipc, 0, ((userflags & US_EXTEDIT) ? 2 : 0));
+ entmsg(ipc, 0, ((userflags & US_EXTEDIT) ? 2 : 0), 0);
break;
case 36:
- entmsg(ipc, 0, 1);
+ entmsg(ipc, 0, 1, 0);
break;
case 46:
- entmsg(ipc, 0, 2);
+ entmsg(ipc, 0, 2, 0);
break;
case 78:
- {
- /* Only m.author is used */
- struct ctdlipcmessage m;
- newprompt("What do you want your username to be? ",
- m.author, USERNAME_SIZE - 1);
- m.text = "";
- r = CtdlIPCPostMessage(ipc, 2, &m, aaa);
- if (r / 100 != 2)
- scr_printf("%s\n", aaa);
- else
- entmsg(ipc, 0, 0);
- }
+ entmsg(ipc, 0, ((userflags & US_EXTEDIT) ? 2 : 0), 1);
break;
case 5: /* <G>oto */
updatels(ipc);
if (mcmd >= 100 && mcmd < (100+MAX_EDITORS))
{
/* entmsg mode >=2 select editor */
- entmsg(ipc, 0, mcmd - 100 + 2);
+ entmsg(ipc, 0, mcmd - 100 + 2, 0);
break;
}
} /* end switch */
strcpy(con->curr_user, NLI);
strcpy(con->net_node, "");
strcpy(con->fake_username, "");
- strcpy(con->fake_postname, "");
strcpy(con->fake_hostname, "");
strcpy(con->fake_roomname, "");
generate_nonce(con);
*/
int entmsg(CtdlIPC *ipc,
int is_reply, /* nonzero if this was a <R>eply command */
- int c) /* mode */
-{
+ int c, /* mode */
+ int masquerade /* prompt for a non-default display name? */
+) {
char buf[SIZ];
int a, b;
int need_recp = 0;
strcpy(message.recipient, "");
strcpy(message.author, "");
strcpy(message.subject, "");
- message.text = message.author; /* point to "", changes later */
+ message.text = ""; /* point to "", changes later */
message.anonymous = 0;
message.type = mode;
+
+ if (masquerade) {
+ newprompt("Display name for this message: ", message.author, 40);
+ }
+
r = CtdlIPCPostMessage(ipc, 0, &message, buf);
if (r / 100 != 2 && r / 10 != 57) {
goto RMSGREAD;
case 'r':
savedpos = num_msgs;
- entmsg(ipc, 1, ((userflags & US_EXTEDIT) ? 2 : 0));
+ entmsg(ipc, 1, ((userflags & US_EXTEDIT) ? 2 : 0), 0);
num_msgs = savedpos;
goto RMSGREAD;
case 'u':
extern char urls[MAXURLS][SIZ];
int ka_system(char *shc);
-int entmsg(CtdlIPC *ipc, int is_reply, int c);
+int entmsg(CtdlIPC *ipc, int is_reply, int c, int masquerade);
void readmsgs(CtdlIPC *ipc, enum MessageList c, enum MessageDirection rdir, int q);
void edit_system_message(CtdlIPC *ipc, char *which_message);
pid_t ka_wait(int *kstatus);
char *supplied_euid, /* ...or NULL if this is irrelevant */
char *preformatted_text /* ...or NULL to read text from client */
) {
- char dest_node[SIZ];
- char buf[SIZ];
+ char dest_node[256];
+ char buf[1024];
struct CtdlMessage *msg;
msg = malloc(sizeof(struct CtdlMessage));
msg->cm_fields['M'] = preformatted_text;
}
else {
- msg->cm_fields['M'] = CtdlReadMessageBody("000",
- config.c_maxmsglen, NULL, 0);
+ msg->cm_fields['M'] = CtdlReadMessageBody("000", config.c_maxmsglen, NULL, 0);
}
return(msg);
char cc[SIZ];
char bcc[SIZ];
char supplied_euid[128];
- char masquerade_as[SIZ];
int anon_flag = 0;
int format_type = 0;
- char newusername[SIZ];
+ char newusername[256];
struct CtdlMessage *msg;
int anonymous = 0;
char errmsg[SIZ];
anon_flag = extract_int(entargs, 2);
format_type = extract_int(entargs, 3);
extract_token(subject, entargs, 4, '|', sizeof subject);
+ extract_token(newusername, entargs, 5, '|', sizeof newusername);
do_confirm = extract_int(entargs, 6);
extract_token(cc, entargs, 7, '|', sizeof cc);
extract_token(bcc, entargs, 8, '|', sizeof bcc);
/* Check some other permission type things. */
- if (post == 2) {
- if (CC->user.axlevel < 6) {
- cprintf("%d You don't have permission to masquerade.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
- extract_token(newusername, entargs, 5, '|', sizeof newusername);
- memset(CC->fake_postname, 0, sizeof(CC->fake_postname) );
- safestrncpy(CC->fake_postname, newusername,
- sizeof(CC->fake_postname) );
- cprintf("%d ok\n", CIT_OK);
+ if ( (CC->user.axlevel < 6)
+ && (strcasecmp(newusername, CC->user.fullname))
+ && (strcasecmp(newusername, CC->cs_inet_fn))
+ ) {
+ cprintf("%d You don't have permission to author messages as '%s'.\n",
+ ERROR + HIGHER_ACCESS_REQUIRED,
+ newusername
+ );
return;
}
+
CC->cs_flags |= CS_POSTING;
/* In the Mail> room we have to behave a little differently --
free(valid_cc);
free(valid_bcc);
- /* Handle author masquerading */
- if (CC->fake_postname[0]) {
- strcpy(masquerade_as, CC->fake_postname);
- }
- else if (CC->fake_username[0]) {
- strcpy(masquerade_as, CC->fake_username);
- }
- else {
- strcpy(masquerade_as, "");
- }
-
/* Read in the message from the client. */
if (do_confirm) {
cprintf("%d send message\n", START_CHAT_MODE);
msg = CtdlMakeMessage(&CC->user, recp, cc,
CC->room.QRname, anonymous, format_type,
- masquerade_as, subject,
+ newusername, subject,
((strlen(supplied_euid) > 0) ? supplied_euid : NULL),
NULL);
CtdlFreeMessage(msg);
}
- CC->fake_postname[0] = '\0';
if (valid != NULL) {
free(valid);
}
int disable_exp; /* Set to 1 to disable incoming pages */
int newmail; /* Other sessions increment this */
- /* Masquerade... */
- char fake_username[USERNAME_SIZE]; /* Fake username <bc> */
- char fake_postname[USERNAME_SIZE]; /* Fake postname <bc> */
- char fake_hostname[64]; /* Fake hostname <bc> */
- char fake_roomname[ROOMNAMELEN]; /* Fake roomname <bc> */
+ /* Masqueraded values in the 'who is online' list */
+ char fake_username[USERNAME_SIZE];
+ char fake_hostname[64];
+ char fake_roomname[ROOMNAMELEN];
char preferred_formats[256]; /* Preferred MIME formats */
* make that assumption.
*/
strcpy(who->fake_username, "");
- strcpy(who->fake_postname, "");
strcpy(who->fake_hostname, "");
strcpy(who->fake_roomname, "");
who->logged_in = 0;