//
// Copyright (c) 1987-2022 by the citadel.org team
//
-// This program is open source software. Use, duplication, and/or
-// disclosure are subject to the GNU General Purpose License version 3.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// This program is open source software. Use, duplication, or disclosure is subject to the GNU General Public License version 3.
#include "textclient.h"
/*
* add a newline to the buffer...
*/
-void add_newline(struct cittext *textlist)
-{
+void add_newline(struct cittext *textlist) {
struct cittext *ptr;
ptr = textlist;
* We can do this "in place" because the converted string will always be smaller than the source string.
*/
void mini_2047_decode(char *s) {
- if (!s) { // no null strings allowed!
+ if (!s) { // no null strings allowed!
return;
}
- char *qstart = strstr(s, "=?UTF-8?Q?"); // Must start with this string
+ char *qstart = strstr(s, "=?UTF-8?Q?"); // Must start with this string
if (!qstart) {
return;
}
- char *qend = strstr(qstart+10, "?="); // Must end with this string
+ char *qend = strstr(qstart + 10, "?="); // Must end with this string
if (!qend) {
return;
}
- if (qend <= qstart) { // And there must be something in between them.
+ if (qend <= qstart) { // And there must be something in between them.
return;
}
// The string has qualified for conversion.
- strcpy(qend, ""); // Strip the trailer
- strcpy(qstart, &qstart[10]); // Strip the header
+ strcpy(qend, ""); // Strip the trailer
+ strcpy(qstart, &qstart[10]); // Strip the header
- char *r = qstart; // Pointer to where in the string we're reading
- char *w = s; // Pointer to where in the string we're writing
+ char *r = qstart; // Pointer to where in the string we're reading
+ char *w = s; // Pointer to where in the string we're writing
- while(*r) { // Loop through the source string
- if (r[0] == '=') { // "=" means read a hex character
+ while (*r) { // Loop through the source string
+ if (r[0] == '=') { // "=" means read a hex character
char ch[3];
ch[0] = r[1];
ch[1] = r[2];
r += 3;
++w;
}
- else if (r[0] == '_') { // "_" is a space
+ else if (r[0] == '_') { // "_" is a space
w[0] = ' ';
++r;
++w;
}
- else { // anything else pass through literally
+ else { // anything else pass through literally
w[0] = r[0];
++r;
++w;
}
}
- w[0] = 0; // null terminate
+ w[0] = 0; // null terminate
}
/*
* Read a message from the server
*/
-int read_message(CtdlIPC *ipc,
- long num, /* message number */
- int pagin, /* 0 = normal read, 1 = read with pagination, 2 = header */
- FILE *dest /* Destination file, NULL for screen */
-) {
+int read_message(CtdlIPC * ipc, long num, /* message number */
+ int pagin, /* 0 = normal read, 1 = read with pagination, 2 = header */
+ FILE * dest /* Destination file, NULL for screen */
+ ) {
char buf[SIZ];
char now[256];
int format_type = 0;
if (rc_display_message_numbers) {
if (dest) {
fprintf(dest, "[#%s] ", message->msgid);
- } else {
+ }
+ else {
color(DIM_WHITE);
scr_printf("[");
color(BRIGHT_WHITE);
* of the client screen.
*/
if (!strcasecmp(message->content_type, "text/html")) {
- converted_text = html_to_ascii(message->text, 0, screenwidth);
+ converted_text = html_to_ascii(message->text, 0, screenwidth, (enable_color ? 1 : 0));
if (converted_text != NULL) {
free(message->text);
message->text = converted_text;
}
if (dest) {
fprintf(dest, "%s\n", lineptr);
- } else {
+ }
+ else {
scr_printf("%s\n", lineptr);
}
}
if (!final_line_is_blank) {
if (dest) {
fprintf(dest, "\n");
- } else {
+ }
+ else {
scr_printf("\n");
fr = sigcaught;
}
// Function to begin composing a new message
-int client_make_message(CtdlIPC * ipc,
- char *filename, // temporary file name
+int client_make_message(CtdlIPC * ipc, char *filename, // temporary file name
char *recipient, // NULL if it's not mail
- int is_anonymous,
- int format_type,
- int mode,
- char *subject, // buffer to store subject line
- int subject_required
-) {
+ int is_anonymous, int format_type, int mode, char *subject, // buffer to store subject line
+ int subject_required) {
FILE *fp;
int a, b, e_ex_code;
long beg;
if (room_flags & QR_ANONONLY && !recipient) {
snprintf(header, sizeof header, " ****");
}
- else {
+ else {
snprintf(header, sizeof header, " %s from %s", datestr, (is_anonymous ? "[anonymous]" : fullname));
if (!IsEmptyStr(recipient)) {
size_t tmp = strlen(header);
}
}
-ME1: switch (mode) {
+ ME1:switch (mode) {
case 0:
fp = fopen(filename, "r+");
break;
}
-MECR: if (mode >= 2) {
+ MECR:if (mode >= 2) {
if (file_checksum(filename) == cksum) {
scr_printf("*** Aborted message.\n");
e_ex_code = 1;
}
b = keymenu("Entry command (? for options)",
- "<A>bort|"
- "<C>ontinue|"
- "<S>ave message|"
- "<P>rint formatted|"
- "add s<U>bject|"
- "<R>eplace string|"
- "<H>old message"
- );
+ "<A>bort|"
+ "<C>ontinue|" "<S>ave message|" "<P>rint formatted|" "add s<U>bject|" "<R>eplace string|" "<H>old message");
if (b == 'a')
goto MEABT;
goto MECR;
}
-MEFIN: return (0);
+ MEFIN:return (0);
-MEABT: scr_printf("Are you sure? ");
+ MEABT:scr_printf("Are you sure? ");
if (yesno() == 0) {
goto ME1;
}
-MEABT2: unlink(filename);
+ MEABT2:unlink(filename);
return (2);
}
int entmsg(CtdlIPC * ipc, int is_reply, /* nonzero if this was a <R>eply command */
int c, /* mode */
int masquerade /* prompt for a non-default display name? */
-) {
+ ) {
char buf[SIZ];
int a, b;
int need_recp = 0;
int r; /* IPC response code */
int subject_required = 0;
+ /*
+ * First, check to see if we have permission to enter a message in
+ * this room. The server will return an error code if we can't.
+ */
if (entmsg_ok == ENTMSG_OK_YES) {
/* no problem, go right ahead */
}
scr_printf("If you want to leave a comment or reply to a comment, use the '<R>eply' command.\n");
scr_printf("Do you really want to create a new blog post? ");
if (!yesno()) {
- return(1);
+ return (1);
}
}
}
strcpy(subject, "");
- /*
- * First, check to see if we have permission to enter a message in
- * this room. The server will return an error code if we can't.
- */
strcpy(message.recipient, "");
strcpy(message.author, "");
strcpy(message.subject, "");
}
if (b == 1) {
- scr_printf("*** 1 additional message has been entered " "in this room by another user.\n");
+ scr_printf("*** 1 additional message has been entered in this room by another user.\n");
}
else if (b > 1) {
- scr_printf("*** %d additional messages have been entered " "in this room by other users.\n", b);
+ scr_printf("*** %d additional messages have been entered in this room by other users.\n", b);
}
free(message.text);
r = CtdlIPCAttachmentDownload(ipc, msg, ptr->number, &file, progress, buf);
if (r / 100 != 2) {
scr_printf("%s\n", buf);
- } else {
+ }
+ else {
size_t len;
len = (size_t) extract_long(buf, 0);
/*
* Read the messages in the current room
*/
-void readmsgs(CtdlIPC *ipc,
- enum MessageList c, // see listing in citadel_ipc.h
- enum MessageDirection rdir, // 1=Forward (-1)=Reverse
- int q // Number of msgs to read (if c==3)
-) {
+void readmsgs(CtdlIPC * ipc, enum MessageList c, // see listing in citadel_ipc.h
+ enum MessageDirection rdir, // 1=Forward (-1)=Reverse
+ int q // Number of msgs to read (if c==3)
+ ) {
int a, e, f, g, start;
int savedpos;
int hold_sw = 0;
if ((quotflag) || (arcflag)) {
screenwidth = hold_sw;
}
-RMSGREAD:
+ RMSGREAD:
highest_msg_read = msg_arr[a];
if (quotflag) {
fclose(dest);
do {
e = (inkey() & 127);
e = tolower(e);
+
/* return key same as <N> */ if (e == 10)
e = 'n';
+
/* space key same as <N> */ if (e == 32)
e = 'n';
+
/* del/move for aides only */
if ((!is_room_aide)
&& ((room_flags & QR_MAILBOX) == 0)
if ((e == 'd') || (e == 'm'))
e = 0;
}
+
/* print only if available */
if ((e == 'p') && (IsEmptyStr(printcmd)))
e = 0;
+
/* can't file if not allowed */
if ((e == 'f')
&& (rc_allow_attachments == 0))
e = 0;
+
/* link only if browser avail*/
if ((e == 'u')
&& (IsEmptyStr(rc_url_cmd)))