about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2010-11-11 12:39:19 +0100
committerAlexander Barton <alex@barton.de>2010-11-11 12:39:19 +0100
commit9bc5d565bbbd1131aaa7608076598167036f261b (patch)
treec0210950baf02d57a009f9b501b4050a1393d0a4
parent0d19f2b43a0c5cc5c2c87e949bd3d32efcd2f935 (diff)
downloadngircd-9bc5d565bbbd1131aaa7608076598167036f261b.tar.gz
ngircd-9bc5d565bbbd1131aaa7608076598167036f261b.zip
Save channel creation time; new function Channel_CreationTime()
-rw-r--r--src/ngircd/channel.c11
-rw-r--r--src/ngircd/channel.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c
index 175f23b2..edbbc38b 100644
--- a/src/ngircd/channel.c
+++ b/src/ngircd/channel.c
@@ -697,6 +697,14 @@ Channel_TopicWho(CHANNEL *Chan)
 	return Chan->topic_who;
 } /* Channel_TopicWho */
 
+
+GLOBAL unsigned int
+Channel_CreationTime(CHANNEL *Chan)
+{
+	assert(Chan != NULL);
+	return (unsigned int) Chan->creation_time;
+} /* Channel_CreationTime */
+
 #endif
 
 
@@ -834,6 +842,9 @@ Channel_Create( const char *Name )
 	strlcpy( c->name, Name, sizeof( c->name ));
 	c->hash = Hash( c->name );
 	c->next = My_Channels;
+#ifndef STRICT_RFC
+	c->creation_time = time(NULL);
+#endif
 	My_Channels = c;
 	LogDebug("Created new channel structure for \"%s\".", Name);
 	return c;
diff --git a/src/ngircd/channel.h b/src/ngircd/channel.h
index 46e7e13a..030f9109 100644
--- a/src/ngircd/channel.h
+++ b/src/ngircd/channel.h
@@ -30,6 +30,7 @@ typedef struct _CHANNEL
 	char modes[CHANNEL_MODE_LEN];	/* Channel modes */
 	array topic;			/* Topic of the channel */
 #ifndef STRICT_RFC
+	time_t creation_time;		/* Channel creation time */
 	time_t topic_time;		/* Time when topic was set */
 	char topic_who[CLIENT_NICK_LEN];/* Nickname of user that set topic */
 #endif
@@ -118,6 +119,7 @@ GLOBAL CHANNEL *Channel_Create PARAMS(( const char *Name ));
 #ifndef STRICT_RFC
 GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan ));
 GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan ));
+GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan ));
 #endif
 
 GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask, bool OnlyOnce ));