+ /* If anyone can think of a way to do this that doesn't make babies cry
+ * I would love to hear it - Taros */
+
+ if(is_admin(msptr))
+ {
+ msptr->flags &= ~CHFL_ADMIN;
+ lpara[count++] = msptr->client_p->name;
+ *mbuf++ = 'a';
+
+ /* Make sure it fits if +h, +o, or +v are involved */
+ if(is_chanop(msptr))
+ {
+ if(count >= MAXMODEPARAMS)
+ {
+ *mbuf = '\0';
+ sendto_channel_local(ALL_MEMBERS, chptr,
+ ":%s MODE %s %s %s %s %s %s",
+ source_p->name, chptr->chname,
+ lmodebuf, lpara[0], lpara[1],
+ lpara[2], lpara[3]);
+
+ /* preserve the initial '-' */
+ mbuf = lmodebuf;
+ *mbuf++ = '-';
+ count = 0;
+
+ for(i = 0; i < MAXMODEPARAMS; i++)
+ lpara[i] = NULL;
+ }
+
+ msptr->flags &= ~CHFL_CHANOP;
+ lpara[count++] = msptr->client_p->name;
+ *mbuf++ = 'o';
+ }
+ if(is_halfop(msptr))
+ {
+ if(count >= MAXMODEPARAMS)
+ {
+ *mbuf = '\0';
+ sendto_channel_local(ALL_MEMBERS, chptr,
+ ":%s MODE %s %s %s %s %s %s",
+ source_p->name, chptr->chname,
+ lmodebuf, lpara[0], lpara[1],
+ lpara[2], lpara[3]);
+
+ /* preserve the initial '-' */
+ mbuf = lmodebuf;
+ *mbuf++ = '-';
+ count = 0;
+
+ for(i = 0; i < MAXMODEPARAMS; i++)
+ lpara[i] = NULL;
+ }
+
+ msptr->flags &= ~CHFL_HALFOP;
+ lpara[count++] = msptr->client_p->name;
+ *mbuf++ = 'h';
+ }
+ if(is_voiced(msptr))
+ {
+ if(count >= MAXMODEPARAMS)
+ {
+ *mbuf = '\0';
+ sendto_channel_local(ALL_MEMBERS, chptr,
+ ":%s MODE %s %s %s %s %s %s",
+ source_p->name, chptr->chname,
+ lmodebuf, lpara[0], lpara[1],
+ lpara[2], lpara[3]);
+
+ /* preserve the initial '-' */
+ mbuf = lmodebuf;
+ *mbuf++ = '-';
+ count = 0;
+
+ for(i = 0; i < MAXMODEPARAMS; i++)
+ lpara[i] = NULL;
+ }
+
+ msptr->flags &= ~CHFL_VOICE;
+ lpara[count++] = msptr->client_p->name;
+ *mbuf++ = 'v';
+ }
+ }
+ else if(is_chanop(msptr))