- /* Initialize aWhoWas struct `newww' */
- ww.newww->hashv = hash_whowas_name(cli_name(cptr));
- ww.newww->logoff = CurrentTime;
- DupString(ww.newww->name, cli_name(cptr));
- DupString(ww.newww->username, cli_user(cptr)->username);
- DupString(ww.newww->hostname, cli_user(cptr)->host);
- /* Should be changed to server numeric */
- DupString(ww.newww->servername, cli_name(cli_user(cptr)->server));
- DupString(ww.newww->realname, cli_info(cptr));
+/** Add a client to the whowas list.
+ * @param[in] cptr Client to add.
+ * @param[in] still_on If non-zero, link the record to the client's personal history.
+ */
+void add_history(struct Client *cptr, int still_on)
+{
+ struct Whowas *ww;
+
+ if (!(ww = whowas_alloc()))
+ return; /* couldn't get a structure */
+
+ ww->hashv = hash_whowas_name(cli_name(cptr)); /* initialize struct */
+ ww->logoff = CurrentTime;
+ DupString(ww->name, cli_name(cptr));
+ DupString(ww->username, cli_user(cptr)->username);
+ DupString(ww->hostname, cli_user(cptr)->host);
+ if (HasHiddenHost(cptr))
+ DupString(ww->realhost, cli_user(cptr)->realhost);
+ DupString(ww->servername, cli_name(cli_user(cptr)->server));
+ DupString(ww->realname, cli_info(cptr));