Forward port of delayed-join.patch from Quakenet's "Asuka" patch set
[ircu2.10.12-pk.git] / ircd / m_topic.c
index a41745c0fca6941bab5ad56e7c2dac68a4a5337d..83e89f22a122f43e8e77f6e677ee4c64e16fa067 100644 (file)
 static void do_settopic(struct Client *sptr, struct Client *cptr, 
                        struct Channel *chptr,char *topic)
 {
+   struct Membership *member;
    int newtopic;
+   member = find_channel_member(sptr, chptr);
    /* if +n and not @'d, return an error and ignore the topic */
-   if ((chptr->mode.mode & MODE_TOPICLIMIT) != 0 && !is_chan_op(sptr, chptr)) 
+   if ((chptr->mode.mode & MODE_TOPICLIMIT) != 0 && (!member || !IsChanOp(member)))
    {
       send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
       return;
    }
+   if (member && IsDelayedJoin(member))
+     RevealDelayedJoin(member);
    /* Note if this is just a refresh of an old topic, and don't
     * send it to all the clients to save bandwidth.  We still send
     * it to other servers as they may have split and lost the topic.