(sendmessage): Don't split messages into lines of no more than 60
characters. Update info flash and wall. They were wrong, anyway: they claimed long messages were truncated.
This commit is contained in:
parent
8544ef0e8d
commit
7c605a05ed
3 changed files with 6 additions and 18 deletions
|
@ -20,7 +20,6 @@ Or you can send a multi-line message:
|
||||||
.FI
|
.FI
|
||||||
Note that you can end a multi-line flash with either a '.' (period)
|
Note that you can end a multi-line flash with either a '.' (period)
|
||||||
on a line all by itself, or by hitting ^D on a line by itself.
|
on a line all by itself, or by hitting ^D on a line by itself.
|
||||||
Note also that all messages are truncated to 60 characters long!
|
|
||||||
.s1
|
.s1
|
||||||
If you do not wish to receive any flash messages from your friends,
|
If you do not wish to receive any flash messages from your friends,
|
||||||
then you can temporarily turn the feature off by typing "toggle flash".
|
then you can temporarily turn the feature off by typing "toggle flash".
|
||||||
|
|
|
@ -17,7 +17,6 @@ Or you can send a multi-line message:
|
||||||
.FI
|
.FI
|
||||||
Note that you can end a multi-line wall with either a '.' (period)
|
Note that you can end a multi-line wall with either a '.' (period)
|
||||||
on a line all by itself, or by hitting ^D on a line by itself.
|
on a line all by itself, or by hitting ^D on a line by itself.
|
||||||
Note also that all messages are truncated to 60 characters long!
|
|
||||||
.s1
|
.s1
|
||||||
If you do not wish to receive any broadcast messages from your allies,
|
If you do not wish to receive any broadcast messages from your allies,
|
||||||
then you can temporarily turn the feature off by typing "toggle flash".
|
then you can temporarily turn the feature off by typing "toggle flash".
|
||||||
|
|
|
@ -117,25 +117,19 @@ wall(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send flash message MESSAGE from US to TO.
|
* Send flash message MESSAGE from US to TO.
|
||||||
* MESSAGE is UTF-8. Long messages are broken into several parts.
|
* MESSAGE is UTF-8.
|
||||||
* A header identifying US is prepended to each part. The first
|
* Null TO broadcasts to all.
|
||||||
* header is more verbose if ONESHOT.
|
* A header identifying US is prepended to the message. It is more
|
||||||
|
* verbose if VERBOSE.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
sendmessage(struct natstr *us, struct natstr *to, char *message, int oneshot)
|
sendmessage(struct natstr *us, struct natstr *to, char *message, int verbose)
|
||||||
{
|
{
|
||||||
struct player *other;
|
struct player *other;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
time_t now;
|
time_t now;
|
||||||
int sent = 0;
|
int sent = 0;
|
||||||
struct natstr *wto;
|
struct natstr *wto;
|
||||||
char c;
|
|
||||||
int pos;
|
|
||||||
|
|
||||||
pos = ufindpfx(message, 60);
|
|
||||||
c = message[pos];
|
|
||||||
if (c)
|
|
||||||
message[pos] = '\0';
|
|
||||||
|
|
||||||
time(&now);
|
time(&now);
|
||||||
tm = localtime(&now);
|
tm = localtime(&now);
|
||||||
|
@ -152,7 +146,7 @@ sendmessage(struct natstr *us, struct natstr *to, char *message, int oneshot)
|
||||||
continue;
|
continue;
|
||||||
if (player == other)
|
if (player == other)
|
||||||
continue;
|
continue;
|
||||||
if (oneshot)
|
if (verbose)
|
||||||
if (to)
|
if (to)
|
||||||
pr_flash(other, "FLASH from %s (#%d) @ %02d:%02d%s\n",
|
pr_flash(other, "FLASH from %s (#%d) @ %02d:%02d%s\n",
|
||||||
us->nat_cnam, us->nat_cnum, tm->tm_hour,
|
us->nat_cnam, us->nat_cnum, tm->tm_hour,
|
||||||
|
@ -189,9 +183,5 @@ sendmessage(struct natstr *us, struct natstr *to, char *message, int oneshot)
|
||||||
pr("%s is not accepting flashes\n", to->nat_cnam);
|
pr("%s is not accepting flashes\n", to->nat_cnam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c) {
|
|
||||||
message[pos] = c;
|
|
||||||
sendmessage(us, to, &message[pos], 0);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue