Document, in particular use of UTF-8. Simplify code in a couple of
places, but no functional changes.
This commit is contained in:
parent
9046ff0ad2
commit
71e164ed30
17 changed files with 199 additions and 105 deletions
|
@ -74,7 +74,7 @@ flash(void)
|
|||
}
|
||||
|
||||
if (player->argp[2]) {
|
||||
for (sp = &player->combuf[0]; *sp && *sp != ' '; ++sp) ;
|
||||
for (sp = player->combuf; *sp && *sp != ' '; ++sp) ;
|
||||
for (++sp; *sp && *sp != ' '; ++sp) ;
|
||||
buf[0] = ':';
|
||||
if (player->flags & PF_UTF8)
|
||||
|
@ -103,7 +103,7 @@ wall(void)
|
|||
|
||||
us = getnatp(player->cnum);
|
||||
if (player->argp[1]) {
|
||||
for (sp = &player->combuf[0]; *sp && *sp != ' '; ++sp) ;
|
||||
for (sp = player->combuf; *sp && *sp != ' '; ++sp) ;
|
||||
buf[0] = ':';
|
||||
if (player->flags & PF_UTF8)
|
||||
strcpy(buf+1, sp);
|
||||
|
@ -122,23 +122,28 @@ wall(void)
|
|||
return RET_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send flash message MESSAGE from US to TO.
|
||||
* MESSAGE is UTF-8. Long messages are broken into several parts.
|
||||
* A header identifying US is prepended to each part. The first
|
||||
* header is more verbose if ONESHOT.
|
||||
*/
|
||||
int
|
||||
sendmessage(struct natstr *us, struct natstr *to, char *message
|
||||
/* message is message text */, int oneshot)
|
||||
sendmessage(struct natstr *us, struct natstr *to, char *message, int oneshot)
|
||||
{
|
||||
struct player *other;
|
||||
struct tm *tm;
|
||||
time_t now;
|
||||
int sent = 0;
|
||||
struct natstr *wto;
|
||||
char c; /* c is message text */
|
||||
char c;
|
||||
int pos;
|
||||
|
||||
pos = ufindpfx(message, 60);
|
||||
c = message[pos];
|
||||
if (c)
|
||||
message[pos] = '\0';
|
||||
|
||||
|
||||
time(&now);
|
||||
tm = localtime(&now);
|
||||
for (other = player_next(0); other != 0; other = player_next(other)) {
|
||||
|
|
|
@ -70,7 +70,7 @@ static int
|
|||
play_list(struct player *joe)
|
||||
{
|
||||
time_t now;
|
||||
char com[1 + 6*20 + 2]; /* user text */
|
||||
char com[1 + 6*20 + 2]; /* UTF-8 */
|
||||
struct natstr *natp;
|
||||
struct natstr *us;
|
||||
int n;
|
||||
|
|
|
@ -64,7 +64,7 @@ rea(void)
|
|||
int size;
|
||||
unsigned int nbytes;
|
||||
char buf[1024];
|
||||
char msgbuf[4096]; /* message text */
|
||||
char msgbuf[4096]; /* UTF-8 */
|
||||
int lasttype;
|
||||
int lastcnum;
|
||||
time_t lastdate;
|
||||
|
|
|
@ -47,9 +47,9 @@ shut(void)
|
|||
int shutdown_minutes;
|
||||
int shutdown_was_pending;
|
||||
char buf[1024];
|
||||
s_char msgbuf[100]; /* user text */
|
||||
char msgbuf[100];
|
||||
struct natstr *us;
|
||||
s_char *p;
|
||||
char *p;
|
||||
|
||||
if (update_pending) {
|
||||
pr("Update is pending\n");
|
||||
|
|
|
@ -46,8 +46,7 @@ tele(void)
|
|||
{
|
||||
natid to;
|
||||
struct natstr *natp;
|
||||
int teltype;
|
||||
s_char buf[MAXTELSIZE + 1];
|
||||
char buf[MAXTELSIZE + 1]; /* UTF-8 */
|
||||
int n;
|
||||
|
||||
natp = getnatp(player->cnum);
|
||||
|
@ -113,8 +112,7 @@ tele(void)
|
|||
pr("%s is rejecting your telegrams.\n", cname(to));
|
||||
return RET_SYN;
|
||||
}
|
||||
teltype = /* player->god ? TEL_BULLETIN : */ TEL_NORM;
|
||||
if (typed_wu(player->cnum, to, buf, teltype) < 0) {
|
||||
if (typed_wu(player->cnum, to, buf, TEL_NORM) < 0) {
|
||||
logerror("tele: typed_wu failed to #%d", n);
|
||||
return RET_FAIL;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ turn(void)
|
|||
struct telstr tgm;
|
||||
char *p;
|
||||
char buf[1024];
|
||||
char msgbuf[MAXTELSIZE + 1]; /* message text */
|
||||
char msgbuf[MAXTELSIZE + 1]; /* UTF-8 */
|
||||
char *msgfilepath;
|
||||
|
||||
p = getstarg(player->argp[1], "on, off or motd? ", buf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue