next = (CLIENT *)c->next;
if (c->account_name)
free(c->account_name);
+ if (c->cloaked)
+ free(c->cloaked);
+ if (c->ipa_text)
+ free(c->ipa_text);
free( c );
c = next;
}
free(c->account_name);
if (c->cloaked)
free(c->cloaked);
+ if (c->ipa_text)
+ free(c->ipa_text);
free( c );
break;
}
} /* Client_SetHostname */
+/**
+ * Set IP address to display for a client.
+ *
+ * @param Client The client.
+ * @param IPAText Textual representation of the IP address or NULL to unset.
+ */
+GLOBAL void
+Client_SetIPAText(CLIENT *Client, const char *IPAText)
+{
+ assert(Client != NULL);
+
+ if (Client->ipa_text)
+ free(Client->ipa_text);
+
+ if (*IPAText)
+ Client->ipa_text = strndup(IPAText, CLIENT_HOST_LEN - 1);
+ else
+ Client->ipa_text = NULL;
+}
+
+
GLOBAL void
Client_SetID( CLIENT *Client, const char *ID )
{
free(Client->account_name);
if (*AccountName)
- Client->account_name = strdup(AccountName);
+ Client->account_name = strndup(AccountName,
+ CLIENT_NICK_LEN - 1);
else
Client->account_name = NULL;
}
return Client->cloaked;
}
+GLOBAL const char *
+Client_IPAText(CLIENT *Client)
+{
+ assert(Client != NULL);
+
+ /* Not a local client? */
+ if (Client_Conn(Client) <= NONE)
+ return "0.0.0.0";
+
+ if (!Client->ipa_text)
+ return Conn_GetIPAInfo(Client_Conn(Client));
+ else
+ return Client->ipa_text;
+}
+
/**
* Update (and generate, if necessary) the cloaked hostname of a client.
*