+2004-05-14 Kevin L Mitchell <klmitch@mit.edu>
+
+ * ircd/s_user.c: process account creation timestamp if present in
+ user mode portion of a N protocol message; add account creation
+ timestamp to outgoing N protocol messages if that timestamp is
+ non-zero
+
+ * ircd/m_account.c: process account creation timestamp if present
+ in AC protocol message
+
+ * include/struct.h: add account creation timestamp
+
2004-05-16 Michael Poole <mdpoole@troilus.org>
* doc/example.conf: Document operator privilege settings.
#include "ircd_string.h"
#include "msg.h"
#include "numnicks.h"
+#include "s_debug.h"
#include "s_user.h"
#include "send.h"
#include <assert.h>
+#include <stdlib.h>
#include <string.h>
/*
"Received account (%s) longer than %d for %s; "
"ignoring.",
parv[2], ACCOUNTLEN, cli_name(acptr));
+
+ if (parc > 3) {
+ cli_user(acptr)->acc_create = atoi(parv[3]);
+ Debug((DEBUG_DEBUG, "Received timestamped account: account \"%s\", "
+ "timestamp %Tu", parv[2], cli_user(acptr)->acc_create));
+ }
+
ircd_strncpy(cli_user(acptr)->account, parv[2], ACCOUNTLEN);
hide_hostmask(acptr, FLAG_ACCOUNT);
- sendcmdto_serv_butone(sptr, CMD_ACCOUNT, cptr, "%C %s", acptr,
- cli_user(acptr)->account);
+ sendcmdto_serv_butone(sptr, CMD_ACCOUNT, cptr,
+ cli_user(acptr)->acc_create ? "%C %s %Tu" : "%C %s",
+ acptr, cli_user(acptr)->account,
+ cli_user(acptr)->acc_create);
return 0;
}
ircd_strncpy(cli_user(new_client)->host, parv[5], HOSTLEN);
ircd_strncpy(cli_user(new_client)->realhost, parv[5], HOSTLEN);
ircd_strncpy(cli_info(new_client), parv[parc - 1], REALLEN);
- if (account)
- ircd_strncpy(cli_user(new_client)->account, account, ACCOUNTLEN);
+ if (account) {
+ int len = ACCOUNTLEN;
+ if ((p = strchr(account, ':'))) {
+ len = (p++) - account;
+ cli_user(new_client)->acc_create = atoi(p);
+ Debug((DEBUG_DEBUG, "Received timestamped account in user mode; "
+ "account \"%s\", timestamp %Tu", account,
+ cli_user(new_client)->acc_create));
+ }
+ ircd_strncpy(cli_user(new_client)->account, account, len);
+ }
if (HasHiddenHost(new_client))
ircd_snprintf(0, cli_user(new_client)->host, HOSTLEN, "%s.%s",
account, feature_str(FEAT_HIDDEN_HOST));
*m++ = ' ';
while ((*m++ = *t++))
; /* Empty loop */
+
+ if (cli_user(cptr)->acc_create) {
+ char nbuf[20];
+ Debug((DEBUG_DEBUG, "Sending timestamped account in user mode for "
+ "account \"%s\"; timestamp %Tu", cli_user(cptr)->account,
+ cli_user(cptr)->acc_create));
+ ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%Tu",
+ cli_user(cptr)->acc_create);
+ m--; /* back up over previous nul-termination */
+ while ((*m++ = *t++))
+ ; /* Empty loop */
+ }
}
*m = '\0';