--- extras/channeldumper.c	2013-04-05 10:29:24.000000000 -0400
+++ channeldumper.c	2013-12-04 00:52:25.864004000 -0500
@@ -61,6 +61,12 @@
 
 static ModuleInfo	ChannelDumperModInfo;
 
+#ifndef HOOKTYPE_REHASH_COMPLETE /* 3.2-RC2 */
+static char		modebuf[MAXMODEPARAMS*2+1], parabuf[504];
+#endif
+
+
+
 #ifdef DYNAMIC_LINKING
 DLLFUNC int	Mod_Init(ModuleInfo *modinfo)
 #else
@@ -99,6 +105,96 @@
 	return MOD_SUCCESS;
 }
 
+
+// =================================================================
+// I needed a FULL channel mode string,
+// so hacked up channel_modes() from src/channel.c
+// =================================================================
+
+void full_channel_modes(char *mbuf, char *pbuf, aChannel *chptr)
+{
+	aCtab	*tab = &cFlagTab[0];
+	char	bcbuf[1024];
+#ifdef EXTCMODE
+	int	i;
+#endif
+
+	*mbuf++ = '+';
+	/* Paramless first */
+	while (tab->mode != 0x0)
+	{
+		if ((chptr->mode.mode & tab->mode))
+			if (!tab->parameters)
+				*mbuf++ = tab->flag;
+		tab++;
+	}
+#ifdef EXTCMODE
+	for (i=0; i <= Channelmode_highest; i++)
+	{
+		if (Channelmode_Table[i].flag && !Channelmode_Table[i].paracount &&
+		    (chptr->mode.extmode & Channelmode_Table[i].mode))
+			*mbuf++ = Channelmode_Table[i].flag;
+	}
+#endif
+	if (chptr->mode.limit)
+	{
+		*mbuf++ = 'l';
+		(void)ircsprintf(pbuf, "%d ", chptr->mode.limit);
+	}
+	if (*chptr->mode.key)
+	{
+		*mbuf++ = 'k';
+		/* FIXME: hope pbuf is long enough */
+		(void)snprintf(bcbuf, sizeof bcbuf, "%s ", chptr->mode.key);
+		(void)strcat(pbuf, bcbuf);
+	}
+	if (*chptr->mode.link)
+	{
+		*mbuf++ = 'L';
+		/* FIXME: is pbuf long enough?  */
+		(void)snprintf(bcbuf, sizeof bcbuf, "%s ", chptr->mode.link);
+		(void)strcat(pbuf, bcbuf);
+	}
+	/* if we add more parameter modes, add a space to the strings here --Stskeeps */
+#ifdef NEWCHFLOODPROT
+	if (chptr->mode.floodprot)
+#else
+	if (chptr->mode.per)
+#endif
+	{
+		*mbuf++ = 'f';
+#ifdef NEWCHFLOODPROT
+		ircsprintf(bcbuf, "%s ", channel_modef_string(chptr->mode.floodprot));
+#else
+		if (chptr->mode.kmode == 1)
+			ircsprintf(bcbuf, "*%i:%i ", chptr->mode.msgs, chptr->mode.per);
+		else
+			ircsprintf(bcbuf, "%i:%i ", chptr->mode.msgs, chptr->mode.per);
+#endif
+		(void)strcat(pbuf, bcbuf);
+	}
+
+#ifdef EXTCMODE
+	for (i=0; i <= Channelmode_highest; i++)
+	{
+		if (Channelmode_Table[i].flag && Channelmode_Table[i].paracount &&
+		    (chptr->mode.extmode & Channelmode_Table[i].mode))
+		{
+			*mbuf++ = Channelmode_Table[i].flag;
+			strcat(pbuf, Channelmode_Table[i].get_param(extcmode_get_struct(chptr->mode.extmodeparam, Channelmode_Table[i].flag)));
+			strcat(pbuf, " ");
+		}
+	}
+#endif
+
+	/* Remove the trailing space from the parameters -- codemastr */
+	if (*pbuf)
+		pbuf[strlen(pbuf)-1]=0;
+
+	*mbuf++ = 0;
+	return;
+}
+
 EVENT(e_channeldump)
 {
 	aChannel *chptr;
@@ -116,8 +212,14 @@
 		{
 			if (SecretChannel(chptr))
 				continue;
-		 	fprintf(f, "C %s %s\r\n", 
-		 		chptr->chname, chptr->topic ? chptr->topic : "");
+
+			*modebuf = 0;
+			*parabuf = 0;
+			full_channel_modes(modebuf, parabuf, chptr);
+
+			fprintf(f, "C %s %s\r\n", 
+				chptr->chname, chptr->topic ? chptr->topic : "");
+			fprintf(f, "O %s %s\r\n", modebuf, parabuf);
 			for (m = chptr->members; m; m = m->next)
 				fprintf(f, "M %s\r\n",
 					m->cptr->name);   			
@@ -125,4 +227,4 @@
 	}
 	fclose(f);
 	return;
-}
\ No newline at end of file
+}
