]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/fjoin.cpp
Configurable prefixes for chanmodes +qa: prefixes can be turned on or off individuall...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / fjoin.cpp
index dd288b82100059bd9515c504d361d99f0da14722..0f33d65bdeebb753be2c70a0222a7fbbd572031f 100644 (file)
@@ -68,7 +68,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
        irc::tokenstream users((params.size() > 2) ? params[2] : "");   /* users from the user list */
        bool apply_other_sides_modes = true;                            /* True if we are accepting the other side's modes */
        Channel* chan = this->Instance->FindChan(channel);              /* The channel we're sending joins to */
-       time_t ourTS = chan ? chan->age : Instance->Time(true)+600;     /* The TS of our side of the link */
+       time_t ourTS = chan ? chan->age : Instance->Time()+600; /* The TS of our side of the link */
        bool created = !chan;                                           /* True if the channel doesnt exist here yet */
        std::string item;                                               /* One item in the list of nicks */
 
@@ -79,7 +79,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
 
        if (!TS)
        {
-               Instance->Log(DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped.");
+               Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped.");
                Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", source.c_str());
                return true;
        }
@@ -112,22 +112,26 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
                const char* usr = item.c_str();
                if (usr && *usr)
                {
-                       const char* permissions = usr;
-                       /* Iterate through all the prefix values, convert them from prefixes to mode letters */
+                       const char* unparsedmodes = usr;
                        std::string modes;
-                       while ((*permissions) && (*permissions != ','))
+
+
+                       /* Iterate through all modes for this user and check they are valid. */
+                       while ((*unparsedmodes) && (*unparsedmodes != ','))
                        {
-                               ModeHandler* mh = Instance->Modes->FindPrefix(*permissions);
+                               ModeHandler *mh = Instance->Modes->FindMode(*unparsedmodes, MODETYPE_CHANNEL);
                                if (mh)
-                                       modes = modes + mh->GetModeChar();
+                                       modes += *unparsedmodes;
                                else
                                {
-                                       this->SendError(std::string("Invalid prefix '")+(*permissions)+"' in FJOIN");
+                                       this->SendError(std::string("Invalid prefix '")+(*unparsedmodes)+"' in FJOIN");
                                        return false;
                                }
+
                                usr++;
-                               permissions++;
+                               unparsedmodes++;
                        }
+
                        /* Advance past the comma, to the nick */
                        usr++;
                        
@@ -140,7 +144,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
                                if ((!route_back_again) || (route_back_again->GetSocket() != this))
                                        continue;
 
-                               /* Add any permissions this user had to the mode stack */
+                               /* Add any modes this user had to the mode stack */
                                for (std::string::iterator x = modes.begin(); x != modes.end(); ++x)
                                        modestack.Push(*x, who->nick);
 
@@ -148,7 +152,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
                        }
                        else
                        {
-                               Instance->Log(SPARSE,"Warning! Invalid user %s in FJOIN to channel %s IGNORED", usr, channel.c_str());
+                               Instance->Logs->Log("m_spanningtree",SPARSE,"Warning! Invalid user %s in FJOIN to channel %s IGNORED", usr, channel.c_str());
                                continue;
                        }
                }