mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 19:52:54 +01:00
Change changeusername to changename.
This commit is contained in:
parent
fc1fc32a01
commit
fe9bf97a59
@ -1,13 +1,13 @@
|
||||
2003-12-6 Jeremy Fincher <jemfinch@supybot.org>
|
||||
|
||||
* Added Math.icalc, a new command for doing integer arithmetic.
|
||||
It requires...
|
||||
|
||||
* Added a "trusted" capability that defaults to off (-trusted) and
|
||||
is required for Utilities.re (with which it's possible to DoS the
|
||||
bot) and for the new Math.icalc (with which it is trivially
|
||||
possible to DoS the bot).
|
||||
|
||||
* Added Math.icalc, a new command for doing integer arithmetic.
|
||||
It requires the "trusted" capability.
|
||||
|
||||
* Added the Fun.ping command, because MozBot has it.
|
||||
|
||||
* Added Note.unsend command, to allow users to "unsend" notes
|
||||
@ -32,6 +32,8 @@
|
||||
|
||||
* Added a swap function to Math.rpn.
|
||||
|
||||
* Changed the name of User.changeusername to User.changename.
|
||||
|
||||
* Changed the logging infrastructure significantly; each plugin
|
||||
now has its own logger (and thus logfile), in addition to being
|
||||
logged in the main logfile.
|
||||
|
30
src/User.py
30
src/User.py
@ -53,9 +53,7 @@ import callbacks
|
||||
class User(callbacks.Privmsg):
|
||||
def _checkNotChannel(self, irc, msg, password=' '):
|
||||
if password and ircutils.isChannel(msg.args[0]):
|
||||
irc.error(msg, conf.replyRequiresPrivacy)
|
||||
return False
|
||||
else: return True
|
||||
raise callbacks.Error, conf.replyRequiresPrivacy
|
||||
|
||||
def list(self, irc, msg, args):
|
||||
"""[<glob>]
|
||||
@ -98,8 +96,7 @@ class User(callbacks.Privmsg):
|
||||
for (option, arg) in optlist:
|
||||
if option == '--hashed':
|
||||
hashed = True
|
||||
if not self._checkNotChannel(irc, msg, password):
|
||||
return
|
||||
self._checkNotChannel(irc, msg, password)
|
||||
try:
|
||||
ircdb.users.getUserId(name)
|
||||
irc.error(msg, 'That name is already assigned to someone.')
|
||||
@ -128,8 +125,7 @@ class User(callbacks.Privmsg):
|
||||
Unregisters <name> from the user database.
|
||||
"""
|
||||
(name, password) = privmsgs.getArgs(args, required=2)
|
||||
if not self._checkNotChannel(irc, msg, password):
|
||||
return
|
||||
self._checkNotChannel(irc, msg, password)
|
||||
try:
|
||||
id = ircdb.users.getUserId(name)
|
||||
user = ircdb.users.getUser(id)
|
||||
@ -142,7 +138,7 @@ class User(callbacks.Privmsg):
|
||||
else:
|
||||
irc.error(msg, conf.replyIncorrectAuth)
|
||||
|
||||
def changeusername(self, irc, msg, args):
|
||||
def changename(self, irc, msg, args):
|
||||
"""<name> <new name> [<password>]
|
||||
|
||||
Changes your current user database name to the new name given.
|
||||
@ -151,8 +147,7 @@ class User(callbacks.Privmsg):
|
||||
to the bot privately (not on a channel).
|
||||
"""
|
||||
(name,newname,password) = privmsgs.getArgs(args,required=2,optional=1)
|
||||
if not self._checkNotChannel(irc, msg, password):
|
||||
return
|
||||
self._checkNotChannel(irc, msg, password)
|
||||
try:
|
||||
id = ircdb.users.getUserId(name)
|
||||
user = ircdb.users.getUser(id)
|
||||
@ -179,8 +174,7 @@ class User(callbacks.Privmsg):
|
||||
be sent to the bot privately (not on a channel).
|
||||
"""
|
||||
(name, hostmask, password) = privmsgs.getArgs(args, 2, 1)
|
||||
if not self._checkNotChannel(irc, msg, password):
|
||||
return
|
||||
self._checkNotChannel(irc, msg, password)
|
||||
if not ircutils.isUserHostmask(hostmask):
|
||||
irc.error(msg, 'That\'s not a valid hostmask.')
|
||||
return
|
||||
@ -219,8 +213,7 @@ class User(callbacks.Privmsg):
|
||||
this message must be sent to the bot privately (not on a channel).
|
||||
"""
|
||||
(name, hostmask, password) = privmsgs.getArgs(args, 2, 1)
|
||||
if not self._checkNotChannel(irc, msg, password):
|
||||
return
|
||||
self._checkNotChannel(irc, msg, password)
|
||||
try:
|
||||
id = ircdb.users.getUserId(name)
|
||||
user = ircdb.users.getUser(id)
|
||||
@ -253,8 +246,7 @@ class User(callbacks.Privmsg):
|
||||
for (option, arg) in optlist:
|
||||
if option == '--hashed':
|
||||
hashed = True
|
||||
if not self._checkNotChannel(irc, msg, oldpassword+newpassword):
|
||||
return
|
||||
self._checkNotChannel(irc, msg, oldpassword+newpassword)
|
||||
try:
|
||||
id = ircdb.users.getUserId(name)
|
||||
user = ircdb.users.getUser(id)
|
||||
@ -337,8 +329,7 @@ class User(callbacks.Privmsg):
|
||||
not in a channel.
|
||||
"""
|
||||
(name, password) = privmsgs.getArgs(args, 2)
|
||||
if not self._checkNotChannel(irc, msg):
|
||||
return
|
||||
self._checkNotChannel(irc, msg)
|
||||
try:
|
||||
id = ircdb.users.getUserId(name)
|
||||
user = ircdb.users.getUser(id)
|
||||
@ -393,8 +384,7 @@ class User(callbacks.Privmsg):
|
||||
value.
|
||||
"""
|
||||
(password, value) = privmsgs.getArgs(args, optional=1)
|
||||
if not self._checkNotChannel(irc, msg, password):
|
||||
return
|
||||
self._checkNotChannel(irc, msg, password)
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
user = ircdb.users.getUser(id)
|
||||
|
@ -31,12 +31,21 @@
|
||||
|
||||
from testsupport import *
|
||||
|
||||
import world
|
||||
import ircdb
|
||||
|
||||
class UserTestCase(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('User',)
|
||||
prefix1 = 'somethingElse!user@host.tld'
|
||||
prefix2 = 'EvensomethingElse!user@host.tld'
|
||||
## def testHostmasks(self):
|
||||
## self.assertNotError('hostmasks')
|
||||
## original = self.prefix
|
||||
## self.prefix = self.prefix1
|
||||
## self.assertNotError('register foo bar')
|
||||
## self.prefix = original
|
||||
## self.assertRegexp('hostmasks foo', 'only.*your.*own')
|
||||
|
||||
def testRegisterUnregister(self):
|
||||
self.prefix = self.prefix1
|
||||
self.assertNotError('register foo bar')
|
||||
@ -73,8 +82,8 @@ class UserTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.prefix = self.prefix2
|
||||
self.assertNotError('register bar baz')
|
||||
self.prefix = self.prefix1
|
||||
self.assertError('changeusername foo bar')
|
||||
self.assertNotError('changeusername foo baz')
|
||||
self.assertError('changename foo bar')
|
||||
self.assertNotError('changename foo baz')
|
||||
|
||||
def testSetpassword(self):
|
||||
self.prefix = self.prefix1
|
||||
|
Loading…
Reference in New Issue
Block a user