+ target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", msptr ? find_channel_status(msptr, fmt->fields || IsCapable(source_p, CLICAP_MULTI_PREFIX)) : "");
+
+ if (fmt->fields == 0)
+ sendto_one(source_p, form_str(RPL_WHOREPLY), me.name,
+ source_p->name, msptr ? msptr->chptr->chname : "*",
+ target_p->username, target_p->host,
+ target_p->servptr->name, target_p->name, status,
+ ConfigServerHide.flatten_links && !IsOper(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount,
+ target_p->info);
+ else
+ {
+ str[0] = '\0';
+ pos = 0;
+ append_format(str, sizeof str, &pos, ":%s %d %s",
+ me.name, RPL_WHOSPCRPL, source_p->name);
+ if (fmt->fields & FIELD_QUERYTYPE)
+ append_format(str, sizeof str, &pos, " %s", fmt->querytype);
+ if (fmt->fields & FIELD_CHANNEL)
+ append_format(str, sizeof str, &pos, " %s", msptr ? msptr->chptr->chname : "*");
+ if (fmt->fields & FIELD_USER)
+ append_format(str, sizeof str, &pos, " %s", target_p->username);
+ if (fmt->fields & FIELD_IP)
+ {
+ if (show_ip(source_p, target_p) && !EmptyString(target_p->sockhost) && strcmp(target_p->sockhost, "0"))
+ append_format(str, sizeof str, &pos, " %s", target_p->sockhost);
+ else
+ append_format(str, sizeof str, &pos, " %s", "255.255.255.255");
+ }
+ if (fmt->fields & FIELD_HOST)
+ append_format(str, sizeof str, &pos, " %s", target_p->host);
+ if (fmt->fields & FIELD_SERVER)
+ append_format(str, sizeof str, &pos, " %s", target_p->servptr->name);
+ if (fmt->fields & FIELD_NICK)
+ append_format(str, sizeof str, &pos, " %s", target_p->name);
+ if (fmt->fields & FIELD_FLAGS)
+ append_format(str, sizeof str, &pos, " %s", status);
+ if (fmt->fields & FIELD_HOP)
+ append_format(str, sizeof str, &pos, " %d", ConfigServerHide.flatten_links && !IsOper(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount);
+ if (fmt->fields & FIELD_IDLE)
+ append_format(str, sizeof str, &pos, " %d", (int)(MyClient(target_p) ? rb_current_time() - target_p->localClient->last : 0));
+ if (fmt->fields & FIELD_ACCOUNT)
+ {
+ /* display as in whois */
+ q = target_p->user->suser;
+ if (!EmptyString(q))
+ {
+ while(IsDigit(*q))
+ q++;
+ if(*q == '\0')
+ q = target_p->user->suser;
+ }
+ else
+ q = "0";
+ append_format(str, sizeof str, &pos, " %s", q);
+ }
+ if (fmt->fields & FIELD_OPLEVEL)
+ append_format(str, sizeof str, &pos, " %s", is_chanop(msptr) ? "999" : "n/a");
+ if (fmt->fields & FIELD_INFO)
+ append_format(str, sizeof str, &pos, " :%s", target_p->info);
+
+ if (pos >= sizeof str)
+ {
+ static int warned = 0;
+ if (!warned)
+ sendto_realops_snomask(SNO_DEBUG, L_NETWIDE,
+ "WHOX overflow while sending information about %s to %s",
+ target_p->name, source_p->name);
+ warned = 1;
+ }
+ sendto_one(source_p, "%s", str);
+ }