From: Michael Poole Date: Sun, 16 May 2004 17:59:40 +0000 (+0000) Subject: Forward port account timestamp feature from 2.10.11. X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=5f8c9f41ca145bb7d94dd2c608da613bbeb8b35b;p=ircu2.10.12-pk.git Forward port account timestamp feature from 2.10.11. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1069 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 6086aed..6e209de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-05-14 Kevin L Mitchell + + * 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 * doc/example.conf: Document operator privilege settings. diff --git a/include/struct.h b/include/struct.h index b173c30..015ae0f 100644 --- a/include/struct.h +++ b/include/struct.h @@ -76,6 +76,7 @@ struct User { char host[HOSTLEN + 1]; char realhost[HOSTLEN + 1]; char account[ACCOUNTLEN + 1]; + time_t acc_create; }; #endif /* INCLUDED_struct_h */ diff --git a/ircd/m_account.c b/ircd/m_account.c index 9a7cfe8..3b00133 100644 --- a/ircd/m_account.c +++ b/ircd/m_account.c @@ -86,10 +86,12 @@ #include "ircd_string.h" #include "msg.h" #include "numnicks.h" +#include "s_debug.h" #include "s_user.h" #include "send.h" #include +#include #include /* @@ -126,11 +128,20 @@ int ms_account(struct Client* cptr, struct Client* sptr, int parc, "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; } diff --git a/ircd/s_user.c b/ircd/s_user.c index 34e341a..ed641eb 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -710,8 +710,17 @@ int set_nick_name(struct Client* cptr, struct Client* sptr, 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)); @@ -1384,6 +1393,18 @@ char *umode_str(struct Client *cptr) *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';