Skip to content

Commit

Permalink
Fix idle / away format
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelortmann committed Aug 21, 2024
1 parent dcf6e04 commit d4c1819
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/mod/irc.mod/cmdsirc.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ static void cmd_channel(struct userrec *u, int idx, char *par)
maxuserhostlen = 9;

dprintf(idx, "(n = owner, m = master, o = op, d = deop, b = bot)\n"
" %-*s %-*s %-*s JOIN F IDLE USER@HOST\n", maxnicklen,
" %-*s %-*s %-*s JOIN F IDLE USER@HOST\n", maxnicklen,
"NICKNAME", maxhandlen, "HANDLE", maxaccountlen, "ACCOUNT");
for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
if (m->joined > 0) {
Expand Down Expand Up @@ -837,31 +837,31 @@ static void cmd_channel(struct userrec *u, int idx, char *par)
else
chanflag = ' ';
if (chan_issplit(m)) {
dprintf(idx, "%c%-*s %-*s %-*s %-6s %c %-*s <- netsplit, %" PRId64 "s\n",
dprintf(idx, "%c%-*s %-*s %-*s %-6s %c %-*s <- netsplit, %" PRId64 "s\n",
chanflag, maxnicklen, m->nick, maxhandlen, handle,
maxaccountlen, m->account, join, atrflag, maxuserhostlen,
m->userhost, (int64_t) (now - m->split));
} else if (!rfc_casecmp(m->nick, botname)) {
dprintf(idx, "%c%-*s %-*s %-*s %-6s %c %-*s <- it's me!\n",
dprintf(idx, "%c%-*s %-*s %-*s %-6s %c %-*s <- it's me!\n",
chanflag, maxnicklen, m->nick, maxhandlen, handle,
maxaccountlen, m->account, join, atrflag, maxuserhostlen,
m->userhost);
} else {
/* Determine idle time */
if (now - (m->last) > 86400)
snprintf(s, sizeof s, "%" PRId64 "d", ((int64_t) (now - m->last)) / 86400);
snprintf(s, sizeof s, "%4" PRId64 "d", ((int64_t) (now - m->last)) / 86400);
else if (now - (m->last) > 3600)
snprintf(s, sizeof s, "%" PRId64 "h", ((int64_t) (now - m->last)) / 3600);
snprintf(s, sizeof s, "%4" PRId64 "h", ((int64_t) (now - m->last)) / 3600);
else if (now - (m->last) > 180)
snprintf(s, sizeof s, "%" PRId64 "m", ((int64_t) (now - m->last)) / 60);
snprintf(s, sizeof s, "%4" PRId64 "m", ((int64_t) (now - m->last)) / 60);
else
strlcpy(s, "", sizeof s);
strcpy(s, " ");
if (chan_ircaway(m)) {
strlcpy(s+strlen(s), "(away)", ((sizeof s) - strlen(s)));
strlcpy(s + strlen(s), " (away)", ((sizeof s) - strlen(s)));
} else {
strlcpy(s+strlen(s), " ", ((sizeof s) - strlen(s)));
strlcpy(s + strlen(s), " ", ((sizeof s) - strlen(s)));
}
dprintf(idx, "%c%-*s %-*s %-*s %-6s %c %-6s %s\n", chanflag,
dprintf(idx, "%c%-*s %-*s %-*s %-6s %c %s %s\n", chanflag,
maxnicklen, m->nick, maxhandlen, handle, maxaccountlen,
m->account, join, atrflag, s, m->userhost);
}
Expand Down
4 changes: 2 additions & 2 deletions src/mod/irc.mod/help/irc.help
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ See also: deluser, +host, -host, +user, -user
#hiya, 0 members, mode +:" instead. Next is a list of the users on the
channel, with each entry looking like this:

<D|Ares> NICKNAME HANDLE ACCOUNT JOIN F IDLE USER@HOST
<D|Ares> @Wcc Wcc * 00:42 Wcc@foo.adelphia.net
<D|Ares> NICKNAME HANDLE ACCOUNT JOIN F IDLE USER@HOST
<D|Ares> @Wcc Wcc * 00:42 Wcc@example.org

The "@Wcc" means that the user's nickname is Wcc and that he is a chanop.
The second "Wcc" is the user's handle. Sometimes this will differ from the
Expand Down

0 comments on commit d4c1819

Please sign in to comment.