instant messages and displayed in certain types of text messages.
This allows UTF-8 and ISO-8859-1 instant messages in WebCit, for
example.
* (There's a hole in the bucket...)
*/
a = scr_getc(SCR_BLOCK);
- if (a == 127)
+ if (a == 127) {
a = 8;
- if (a > 126)
- a = 0;
- if (a == 13)
+ }
+ if (a == 13) {
a = 10;
+ }
+/* not so fast there dude, we have to handle UTF-8 and ISO-8859-1...
+ if (a > 126) {
+ a = 0;
+ }
if (((a != 23) && (a != 4) && (a != 10) && (a != 8) && (a != NEXT_KEY) && (a != STOP_KEY))
- && ((a < 32) || (a > 126)))
+ && ((a < 32) || (a > 126))) {
a = 0;
+ }
+ */
#ifndef DISABLE_CURSES
#if defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H)
strcpy(string, "");
gl_string = string;
async_ka_start();
- GLA:a = inkey();
- a = (a & 127);
+
+GLA: a = inkey();
+ /* a = (a & 127); ** commented out because it isn't just an ASCII world anymore */
if ((a == 8 || a == 23) && (strlen(string) == 0))
goto GLA;
if ((a != 10) && (a != 8) && (strlen(string) == lim))
old = '\n';
continue;
}
- /* Are we looking at a nonprintable? */
+
+ /* Are we looking at a nonprintable?
+ * (This section is now commented out because we could be displaying
+ * a character set like UTF-8 or ISO-8859-1.)
if ( (*e < 32) || (*e > 126) ) {
e++;
continue;
- }
+ } */
+
/* Or are we looking at a space? */
if (*e == ' ') {
e++;
if (a == 127)
a = 8;
- /******* new ***********/
- if ((a > 32) && (a < 127) && (prev == 13)) {
+ if ((a != 32) && (prev == 13)) {
add_word(textlist, "\n");
scr_printf(" ");
}
- /***********************/
if ((a == 32) && (prev == 13)) {
add_word(textlist, "\n");
* to the client. The client software may reformat it again.
*/
void memfmout(
- int width, /* screen width to use */
char *mptr, /* where are we going to get our text from? */
char subst, /* nonzero if we should do substitutions */
char *nl) /* string to terminate lines with */
cit_uint8_t ch;
char aaa[140];
char buffer[SIZ];
+ static int width = 80;
strcpy(aaa, "");
old = 255;
old = real;
real = ch;
- if (((ch == 13) || (ch == 10)) && (old != 13) && (old != 10))
+ if (((ch == 13) || (ch == 10)) && (old != 13) && (old != 10)) {
ch = 32;
+ }
if (((old == 13) || (old == 10)) && (isspace(real))) {
cprintf("%s", nl);
c = 1;
}
- if (ch > 126)
- continue;
-
if (ch > 32) {
if (((strlen(aaa) + c) > (width - 5)) && (strlen(aaa) > (width - 5))) {
cprintf("%s%s", nl, aaa);
if (mode == MT_MIME) {
cprintf("Content-type: text/x-citadel-variformat\n\n");
}
- memfmout(80, mptr, 0, nl);
+ memfmout(mptr, 0, nl);
}
/* If the message on disk is format 4 (MIME), we've gotta hand it
void cmd_isme (char *cmdbuf);
void help_subst (char *strbuf, char *source, char *dest);
void do_help_subst (char *buffer);
-void memfmout (int width, char *mptr, char subst, char *nl);
+void memfmout (char *mptr, char subst, char *nl);
void output_mime_parts(char *);
void cmd_msg0 (char *cmdbuf);
void cmd_msg2 (char *cmdbuf);
cprintf("Message ");
cprintf("from %s:\n", ptr->sender);
if (ptr->text != NULL)
- memfmout(80, ptr->text, 0, "\n");
+ memfmout(ptr->text, 0, "\n");
holdptr = ptr->next;
if (ptr->text != NULL) free(ptr->text);
cprintf("%d %d|%ld|%d|%s|%s\n",
LISTING_FOLLOWS,
((ptr->next != NULL) ? 1 : 0), /* more msgs? */
- (long)ptr->timestamp, /* time sent */
+ (long)ptr->timestamp, /* time sent */
ptr->flags, /* flags */
ptr->sender, /* sender of msg */
- config.c_nodename); /* static for now */
+ config.c_nodename /* static for now */
+ );
+
if (ptr->text != NULL) {
- memfmout(80, ptr->text, 0, "\n");
+ memfmout(ptr->text, 0, "\n");
if (ptr->text[strlen(ptr->text)-1] != '\n') cprintf("\n");
free(ptr->text);
- }
+ }
+
cprintf("000\n");
free(ptr);
}
int send_instant_message(char *lun, char *x_user, char *x_msg)
{
int message_sent = 0; /* number of successful sends */
-
struct CitContext *ccptr;
struct ExpressMessage *newmsg;
char *un;
if (strlen(x_msg) > 0) {
msglen = strlen(x_msg) + 4;
do_send = 1;
- }
+ }
/* find the target user's context and append the message */
begin_critical_section(S_SESSION_TABLE);
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
- if (ccptr->fake_username[0]) /* <bc> */
+ if (ccptr->fake_username[0]) {
un = ccptr->fake_username;
- else
+ }
+ else {
un = ccptr->user.fullname;
+ }
if ( ((!strcasecmp(un, x_user))
|| (!strcasecmp(x_user, "broadcast")))
}
/*
- * send instant messages <bc>
+ * send instant messages
*/
void cmd_sexp(char *argbuf)
{
int message_sent = 0;
char x_user[USERNAME_SIZE];
char x_msg[1024];
- char *lun; /* <bc> */
+ char *lun;
char *x_big_msgbuf = NULL;
if ((!(CC->logged_in)) && (!(CC->internal_pgm))) {