Here are the examples of the python api twisted.words.protocols.irc.ERR_NOTREGISTERED taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
54 Examples
0
Example 51
def processParams(self, user, params):
if user.registered > 0:
user.sendMessage(irc.ERR_NOTREGISTERED, "SAKICK", ":You have not registered")
return {}
if "o" not in user.mode:
user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
return {}
if not params or len(params) < 2:
user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SAKICK", ":Not enough parameters")
return {}
if params[0] not in self.ircd.channels:
user.sendMessage(irc.ERR_NOSUCHCHANNEL, params[0], ":No such channel")
return {}
if params[1] not in self.ircd.users:
user.sendMessage(irc.ERR_NOSUCHNICK, params[1], ":No such nick")
return {}
cdata = self.ircd.channels[params[0]]
udata = self.ircd.users[params[1]]
if udata not in cdata.users:
user.sendMessage(irc.ERR_USERNOTINCHANNEL, udata.nickname, cdata.name, ":They are not on that channel")
return {}
if len(params) >= 3:
reason = " ".join(params[2:])
else:
reason = user.nickname
return {
"user": user,
"targetchan": self.ircd.channels[params[0]],
"targetuser": self.ircd.users[params[1]],
"reason": reason
}
0
Example 52
def processParams(self, user, params):
if user.registered > 0:
user.sendMessage(irc.ERR_NOTREGISTERED, "SAMODE", ":You have not registered")
return {}
if "o" not in user.mode:
user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
return {}
if not params or len(params) < 2:
user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SAMODE", ":Not enough parameters")
return {}
if params[0] in self.ircd.users:
return {
"user": user,
"targetuser": self.ircd.users[params[0]],
"modes": params[1],
"params": params[2:]
}
if params[0] in self.ircd.channels:
return {
"user": user,
"targetchan": self.ircd.channels[params[0]],
"modes": params[1],
"params": params[2:]
}
user.sendMessage(irc.ERR_NOSUCHNICK, params[0], ":No such nick/channel")
return {}
0
Example 53
def processParams(self, user, params):
if user.registered > 0:
user.sendMessage(irc.ERR_NOTREGISTERED, "SANICK", ":You have not registered")
return {}
if "o" not in user.mode:
user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
return {}
if not params or len(params) < 2:
user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SANICK", ":Not enough parameters")
return {}
if params[0] not in self.ircd.users:
user.sendMessage(irc.ERR_NOSUCHNICK, params[0], ":No such nick/channel")
return {}
target = self.ircd.users[params[0]]
if "o" in target.mode:
user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You cannot SANICK another oper")
return {}
if not VALID_NICKNAME.match(params[1]):
user.sendMessage(irc.ERR_ERRONEUSNICKNAME, params[1], ":Erroneous nickname")
return {}
if params[0] == params[1]:
return {}
return {
"user": user,
"targetuser": target,
"newnick": params[1]
}
0
Example 54
Project: txircd Source File: shun.py
def processParams(self, user, params):
if user.registered > 0:
user.sendMessage(irc.ERR_NOTREGISTERED, "SHUN", ":You have not registered")
return {}
if "o" not in user.mode:
user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
return {}
if not params:
user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SHUN", ":Not enough parameters")
return {}
banmask = params[0]
if banmask in self.ircd.users:
udata = self.ircd.users[banmask]
banmask = "{}@{}".format(udata.username, udata.hostname)
elif "@" not in banmask:
banmask = "*@{}".format(banmask)
self.expire_shuns()
if banmask[0] == "-":
banmask = banmask[1:]
if not banmask:
user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SHUN", ":Not enough parameters")
return {}
if banmask not in self.shunList:
user.sendMessage("NOTICE", ":*** Shun {} not found; check /stats S for a list of active shuns.".format(banmask))
return {}
return {
"user": user,
"mask": banmask
}
if len(params) < 3 or not params[2]:
user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SHUN", ":Not enough parameters")
return {}
if banmask[0] == "+":
banmask = banmask[1:]
if not banmask:
user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SHUN", ":Not enough parameters")
return {}
if banmask in self.shunList:
user.sendMessage("NOTICE", ":*** Shun {} is already set! Check /stats S for a list of active shuns.".format(banmask))
return {}
return {
"user": user,
"mask": banmask,
"duration": parse_duration(params[1]),
"reason": " ".join(params[2:])
}