Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2004-05-16 17:59:51 UTC
Modified files:
ChangeLog include/struct.h ircd/m_account.c ircd/s_user.c
Log message:
Forward port account timestamp feature from 2.10.11.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.418 ircu2.10/ChangeLog:1.419
--- ircu2.10/ChangeLog:1.418 Sun May 16 07:27:37 2004
+++ ircu2.10/ChangeLog Sun May 16 10:59:40 2004
@@ -1,3 +1,15 @@
+2004-05-14 Kevin L Mitchell <[EMAIL PROTECTED]>
+
+ * 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 <[EMAIL PROTECTED]>
* doc/example.conf: Document operator privilege settings.
Index: ircu2.10/include/struct.h
diff -u ircu2.10/include/struct.h:1.4 ircu2.10/include/struct.h:1.5
--- ircu2.10/include/struct.h:1.4 Tue Jan 7 02:06:43 2003
+++ ircu2.10/include/struct.h Sun May 16 10:59:40 2004
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: struct.h,v 1.4 2003/01/07 10:06:43 a1kmm Exp $
+ * $Id: struct.h,v 1.5 2004/05/16 17:59:40 entrope Exp $
*/
#ifndef INCLUDED_struct_h
#define INCLUDED_struct_h
@@ -76,6 +76,7 @@
char host[HOSTLEN + 1];
char realhost[HOSTLEN + 1];
char account[ACCOUNTLEN + 1];
+ time_t acc_create;
};
#endif /* INCLUDED_struct_h */
Index: ircu2.10/ircd/m_account.c
diff -u ircu2.10/ircd/m_account.c:1.4 ircu2.10/ircd/m_account.c:1.5
--- ircu2.10/ircd/m_account.c:1.4 Tue Jan 7 19:17:19 2003
+++ ircu2.10/ircd/m_account.c Sun May 16 10:59:40 2004
@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_account.c,v 1.4 2003/01/08 03:17:19 klmitch Exp $
+ * $Id: m_account.c,v 1.5 2004/05/16 17:59:40 entrope Exp $
*/
/*
@@ -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 <assert.h>
+#include <stdlib.h>
#include <string.h>
/*
@@ -126,11 +128,20 @@
"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;
}
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.70 ircu2.10/ircd/s_user.c:1.71
--- ircu2.10/ircd/s_user.c:1.70 Sun May 16 06:55:48 2004
+++ ircu2.10/ircd/s_user.c Sun May 16 10:59:40 2004
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: s_user.c,v 1.70 2004/05/16 13:55:48 entrope Exp $
+ * $Id: s_user.c,v 1.71 2004/05/16 17:59:40 entrope Exp $
*/
#include "config.h"
@@ -710,8 +710,17 @@
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 @@
*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';
----------------------- End of diff -----------------------