- port = tmp->port;
- /*
- * On K line the passwd contents can be
- * displayed on STATS reply. -Vesa
- */
- /* Special-case 'k' or 'K' lines as appropriate... -Kev */
- if ((tmp->status & CONF_UWORLD))
- send_reply(sptr, p[1], c, host, pass, name, port, get_conf_class(tmp));
- else if ((tmp->status & (CONF_SERVER | CONF_HUB)))
- send_reply(sptr, p[1], c, "*", name, port, get_conf_class(tmp));
- else if ((tmp->status & CONF_CLIENT))
- {
- if(tmp->passwd && IsDigit(*tmp->passwd) && (!tmp->passwd[1] ||
- (IsDigit(tmp->passwd[1]) && !tmp->passwd[2])))
- send_reply(sptr, p[1], c, host, pass, name, port, get_conf_class(tmp));
- else
- send_reply(sptr, p[1], c, host, "*", name, port, get_conf_class(tmp));
- }
- else
- send_reply(sptr, p[1], c, host, name, port, get_conf_class(tmp));
+ username = BadPtr(tmp->username) ? null : tmp->username;
+ hub_limit = BadPtr(tmp->hub_limit) ? null : tmp->hub_limit;
+ maximum = tmp->maximum;
+ port = tmp->address.port;
+
+ if (tmp->status & CONF_UWORLD)
+ send_reply(sptr, RPL_STATSULINE, host);
+ else if (tmp->status & CONF_SERVER)
+ send_reply(sptr, RPL_STATSCLINE, name, port, maximum, hub_limit, get_conf_class(tmp));
+ else if (tmp->status & CONF_CLIENT)
+ send_reply(sptr, RPL_STATSILINE,
+ (tmp->username ? tmp->username : ""), (tmp->username ? "@" : ""),
+ (tmp->host ? tmp->host : "*"), maximum,
+ (name[0] == ':' ? "0" : ""), (tmp->name ? tmp->name : "*"),
+ port, get_conf_class(tmp));
+ else if (tmp->status & CONF_OPERATOR)
+ send_reply(sptr, RPL_STATSOLINE,
+ ((FlagHas(&tmp->privs_dirty, PRIV_PROPAGATE)
+ && FlagHas(&tmp->privs, PRIV_PROPAGATE))
+ || (FlagHas(&tmp->conn_class->privs_dirty, PRIV_PROPAGATE)
+ && FlagHas(&tmp->conn_class->privs, PRIV_PROPAGATE)))
+ ? 'O' : 'o', username, host, name, get_conf_class(tmp));