int doing_whois_hook;
int doing_whois_global_hook;
+int doing_whois_channel_visibility_hook;
mapi_clist_av1 whois_clist[] = { &whois_msgtab, NULL };
mapi_hlist_av1 whois_hlist[] = {
- { "doing_whois", &doing_whois_hook },
- { "doing_whois_global", &doing_whois_global_hook },
+ { "doing_whois", &doing_whois_hook },
+ { "doing_whois_global", &doing_whois_global_hook },
+ { "doing_whois_channel_visibility", &doing_whois_channel_visibility_hook },
{ NULL, NULL }
};
char *t;
int tlen;
hook_data_client hdata;
- int visible;
int extra_space = 0;
#ifdef RB_IPV6
struct sockaddr_in ip4;
t = buf + mlen;
+ hdata.client = source_p;
+ hdata.target = target_p;
+
if (!IsService(target_p))
{
RB_DLINK_FOREACH(ptr, target_p->user->channel.head)
msptr = ptr->data;
chptr = msptr->chptr;
- visible = ShowChannel(source_p, chptr);
+ hdata.chptr = chptr;
+
+ hdata.approved = ShowChannel(source_p, chptr);
+ call_hook(doing_whois_channel_visibility_hook, &hdata);
- if(visible || operspy)
+ if(hdata.approved || operspy)
{
if((cur_len + strlen(chptr->chname) + 3) > (BUFSIZE - 5))
{
}
tlen = rb_sprintf(t, "%s%s%s ",
- visible ? "" : "!",
+ hdata.approved ? "" : "!",
find_channel_status(msptr, 1),
chptr->chname);
t += tlen;
sendto_one_numeric(source_p, RPL_AWAY, form_str(RPL_AWAY),
target_p->name, target_p->user->away);
- if(IsOper(target_p))
+ if(IsOper(target_p) && (!ConfigFileEntry.hide_opers_in_whois || IsOper(source_p)))
{
sendto_one_numeric(source_p, RPL_WHOISOPERATOR, form_str(RPL_WHOISOPERATOR),
target_p->name,
GlobalSetOptions.operstring));
}
+ if(MyClient(target_p) && !EmptyString(target_p->localClient->opername) && IsOper(source_p))
+ {
+ char buf[512];
+ rb_snprintf(buf, sizeof(buf), "is opered as %s, privset %s",
+ target_p->localClient->opername, target_p->localClient->privset->name);
+ sendto_one_numeric(source_p, RPL_WHOISSPECIAL, form_str(RPL_WHOISSPECIAL),
+ target_p->name, buf);
+ }
+
if(IsSSLClient(target_p))
+ {
+ char cbuf[256] = "is using a secure connection";
+
+ if (MyClient(target_p) && target_p->localClient->cipher_string != NULL)
+ rb_snprintf_append(cbuf, sizeof(cbuf), " [%s]", target_p->localClient->cipher_string);
+
sendto_one_numeric(source_p, RPL_WHOISSECURE, form_str(RPL_WHOISSECURE),
- target_p->name);
- if((source_p == target_p || IsOper(source_p)) &&
- target_p->certfp != NULL)
- sendto_one_numeric(source_p, RPL_WHOISCERTFP,
- form_str(RPL_WHOISCERTFP),
- target_p->name, target_p->certfp);
+ target_p->name, cbuf);
+ if((source_p == target_p || IsOper(source_p)) &&
+ target_p->certfp != NULL)
+ sendto_one_numeric(source_p, RPL_WHOISCERTFP,
+ form_str(RPL_WHOISCERTFP),
+ target_p->name, target_p->certfp);
+ }
if(MyClient(target_p))
{
}
}
- hdata.client = source_p;
- hdata.target = target_p;
-
/* doing_whois_hook must only be called for local clients,
* doing_whois_global_hook must only be called for local targets
*/