summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-08 18:22:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-08 18:22:34 +0000
commit5bbea4813d98b981d9277f80cbad5f2349da36a9 (patch)
treeafea4e1dec73391b65bab96b9248f1631943b419 /src
parent81ab39d08198e0b20300175cc9665c8cee87b944 (diff)
Added DisplayCurrentModes which will display the modes of a channel or nick
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4181 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/mode.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 8415a3bf4..808b01388 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -229,6 +229,24 @@ const char* ModeParser::Revoke(userrec *d,chanrec *chan,int MASK)
return "";
}
+void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec* targetchannel, const char* text)
+{
+ if (targetchannel)
+ {
+ /* Display channel's current mode string */
+ WriteServ(user->fd,"324 %s %s +%s",user->nick, targetchannel->name, chanmodes(targetchannel, targetchannel->HasUser(user)));
+ WriteServ(user->fd,"329 %s %s %d", user->nick, targetchannel->name, targetchannel->created);
+ }
+ else if (targetuser)
+ {
+ /* Display user's current mode string */
+ WriteServ(user->fd,"221 %s :+%s",targetuser->nick,targetuser->FormatModes());
+ }
+ /* No such nick/channel */
+ WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, text);
+ return;
+}
+
void ModeParser::Process(char **parameters, int pcnt, userrec *user, bool servermode)
{
std::string target = parameters[0];
@@ -239,11 +257,14 @@ void ModeParser::Process(char **parameters, int pcnt, userrec *user, bool server
log(DEBUG,"ModeParser::Process start");
- if (pcnt > 1)
+ if (pcnt == 1)
+ {
+ this->DisplayCurrentModes(user, targetuser, targetchannel, parameters[0]);
+ }
+ else if (pcnt > 1)
{
if (targetchannel)
{
- log(DEBUG,"Target type is CHANNEL");
type = MODETYPE_CHANNEL;
mask = MASK_CHANNEL;
@@ -270,14 +291,13 @@ void ModeParser::Process(char **parameters, int pcnt, userrec *user, bool server
}
else if (targetuser)
{
- log(DEBUG,"Target type is USER");
type = MODETYPE_USER;
mask = MASK_USER;
}
else
{
/* No such nick/channel */
- log(DEBUG,"Target type is UNKNOWN, bailing");
+ WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
return;
}
std::string mode_sequence = parameters[1];