From: Perry Lorier Date: Sat, 1 Apr 2000 23:51:18 +0000 (+0000) Subject: Author: Isomer X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=7ec4144c6b646292025b62ebeb1f974e02c03698 Author: Isomer Log message: * another attempt at fixing ping (sigh...) * added all the flags to extended who, so you can figure out if someone is op'd /and/ voice'd on a channel. * added %l specifier to list peoples idle time, as requested by iamabot. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@131 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 24d02fd..a7b7727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-03-30 Perry Lorier + * ircd/ircd.c: Lets see if this helps the ping problem at all. + * ircd/whocmds.c, /doc/readme.who: Added %l specifier to get idle + time for local clients. (as requested), extended who now returns all + the flags (@+!) so you can tell the complete state of a client. + 2000-03-30 Thomas Helvey * m_rping.c m_rpong.c: add Gte's rping/rpong fixes @@ -287,7 +293,7 @@ # # ChangeLog for ircu2.10.11 # -# $Id: ChangeLog,v 1.58 2000-04-01 22:53:49 bleep Exp $ +# $Id: ChangeLog,v 1.59 2000-04-01 23:51:18 isomer Exp $ # # Insert new changes at beginning of the change list. # diff --git a/doc/readme.who b/doc/readme.who index d0acefa..49d6d00 100644 --- a/doc/readme.who +++ b/doc/readme.who @@ -91,6 +91,7 @@ in which: f : Include flags (all of them) h : Include hostname i : Include IP + l : Include idle time (0 for remote users) [2.10.11+] n : Include nick r : Include real name s : Include server name @@ -110,7 +111,7 @@ out-of-standard 352 crashes EPIC and confuses several other clients. I used :"source" 354 "target" ["querytype"] ["channel"] ["user"] ["IP"] ["host"] ["server"] ["nick"] - ["flags"] ["hops"] [:"realname"] + ["flags"] ["hops"] ["idle"] [:"realname"] Where only the fields specified in the %fields options are present. @@ -153,7 +154,7 @@ Note that: Oslo-R.NO.EU.Undernet.org Niels So that he can have in example a script that does - "on 354 * 166" display "There is an oper ..." + on ^354 "% 166" display "There is an oper ..." - The client will have to sort/format the fields by itself, the _order_ in which flags are passed is not significant, the fields in the @@ -273,5 +274,10 @@ Miscellaneous bug fixes / "undocumented feature" changes: recomended way for GUI based clients to get a channel's userlist and all the infos they want about users on the channel. +- If you use the new numeric, flags will contain all the information about + a user on a channel. @ for op'd, + for voiced, and ! for zombie. eg: + Isomer #coder-com H@+, where the old behavor of just displaying one of + them has been preserved for the old numeric. [2.10.11+] + Regards, Andrea aka Nemesi diff --git a/include/whocmds.h b/include/whocmds.h index 0e4190d..e02358a 100644 --- a/include/whocmds.h +++ b/include/whocmds.h @@ -38,6 +38,7 @@ struct Channel; #define WHO_FIELD_FLA 128 #define WHO_FIELD_DIS 256 #define WHO_FIELD_REN 512 +#define WHO_FIELD_IDL 1024 #define WHO_FIELD_DEF ( WHO_FIELD_NIC | WHO_FIELD_UID | WHO_FIELD_HOS | WHO_FIELD_SER ) diff --git a/ircd/ircd.c b/ircd/ircd.c index 94f49fa..64395cc 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -301,12 +301,16 @@ static time_t check_pings(void) */ max_ping = IsRegistered(cptr) ? get_client_ping(cptr) : CONNECTTIMEOUT; + Debug((DEBUG_DEBUG, "check_pings(%s)=status:%s limit: %d current: %d", + cptr->name, (cptr->flags & FLAGS_PINGSENT) ? "[Ping Sent]" : "[]", + max_ping, (int)(CurrentTime - cptr->lasttime))); + /* Ok, the thing that will happen most frequently, is that someone will * have sent something recently. Cover this first for speed. */ if (CurrentTime-cptr->lasttime < max_ping) { expire=cptr->lasttime + max_ping; - if (next_check=CurrentTime); + Debug((DEBUG_DEBUG, "[%i] check_pings() again in %is",CurrentTime,next_check-CurrentTime)); + return next_check; } @@ -485,6 +493,7 @@ ping_timeout: static void print_usage(void) { printf("Usage: ircd [-f config] [-h servername] [-x loglevel] [-ntv]\n"); + printf("\n -n -t\t Don't detach\n -v\t display version\n\n"); printf("Server not started\n"); } diff --git a/ircd/m_who.c b/ircd/m_who.c index e93320f..a658fbd 100644 --- a/ircd/m_who.c +++ b/ircd/m_who.c @@ -246,6 +246,9 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) case 'I': fields |= WHO_FIELD_NIP; break; + case 'l': + case 'L': + fields |= WHO_FIELD_IDL; case 'n': case 'N': fields |= WHO_FIELD_NIC; diff --git a/ircd/whocmds.c b/ircd/whocmds.c index 0c2b5b4..a34f429 100644 --- a/ircd/whocmds.c +++ b/ircd/whocmds.c @@ -156,12 +156,26 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, *(p1++) = 'H'; if (IsAnOper(acptr)) *(p1++) = '*'; - if (chptr && is_chan_op(acptr, chptr)) - *(p1++) = '@'; - else if (chptr && has_voice(acptr, chptr)) - *(p1++) = '+'; - else if (chptr && is_zombie(acptr, chptr)) - *(p1++) = '!'; + if (fields) { + /* If you specified flags then we assume you know how to parse + * multiple channel status flags, as this is currently the only + * way to know if someone has @'s *and* is +'d. + */ + if (chptr && is_chan_op(acptr, chptr)) + *(p1++) = '@'; + if (chptr && has_voice(acptr, chptr)) + *(p1++) = '+'; + if (chptr && is_zombie(acptr, chptr)) + *(p1++) = '!'; + } + else { + if (chptr && is_chan_op(acptr, chptr)) + *(p1++) = '@'; + else if (chptr && has_voice(acptr, chptr)) + *(p1++) = '+'; + else if (chptr && is_zombie(acptr, chptr)) + *(p1++) = '!'; + } if (IsDeaf(acptr)) *(p1++) = 'd'; if (IsAnOper(sptr)) @@ -183,6 +197,19 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, p1 = sprintf_irc(p1, "%d", acptr->hopcount); } + if (!fields || (fields & WHO_FIELD_IDL)) + { + *p1++ = ' '; + if (!fields) + *p1++ = ':'; /* Place colon here for default reply */ + if (MyUser(acptr)) { + p1 = sprintf_irc(p1, "%d", CurrentTime-acptr->lasttime); + } + else { + *p1++ = '0'; + } + } + if (!fields || (fields & WHO_FIELD_REN)) { char *p2 = acptr->info;