Update of /cvsroot/wpdev/xmlscripts/scripts/commands
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11017/commands
Modified Files:
kickban.py
Log Message:
I think this should work...
Index: kickban.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/kickban.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** kickban.py 9 Sep 2004 02:31:09 -0000 1.1
--- kickban.py 9 Sep 2004 03:04:04 -0000 1.2
***************
*** 9,12 ****
--- 9,18 ----
"""
+ """
+ \command unban
+ \description Unbans an account with the given account name.
+
+ """
+
import wolfpack
from wolfpack.consts import LOG_MESSAGE
***************
*** 15,18 ****
--- 21,25 ----
wolfpack.registercommand( "kick", commandKick )
wolfpack.registercommand( "ban", commandBan )
+ wolfpack.registercommand( "unban", commandUnban )
def commandKick( socket, cmd, args ):
***************
*** 40,50 ****
return False
def accountAction( socket, account, action ):
if account == None:
socket.sysmessage( "Failed to find an account with the given name." )
return False
! elif account and account.acl == 'player':
if action == 'kick':
! account.block()
for char in account.characters:
if char.socket:
--- 47,102 ----
return False
+ def doKick( char, args, target ):
+ if target.char and target.char.player:
+ accountAction( char.socket, target.char.account, 'kick' )
+ return
+
+ def doBan( char, args, target ):
+ if target.char and target.char.player:
+ accountAction( char.socket, target.char.account, 'ban' )
+ return
+
+ def commandUnban( socket, cmd, args ):
+ player = socket.player
+ playeraccount = player.account
+ myrank = playeraccount.rank
+ if len( args ) > 0:
+ accname = args.lower()
+ account = None
+ account = wolfpack.accounts.find( accname )
+ if account:
+ if account.rank > 1:
+ if playeraccount.authorized( 'Misc', 'May Block Staff Accounts' ):
+ continue
+ else:
+ socket.sysmessage( "You're not authorized to unblock staff members." )
+ return False
+ account.unblock()
+ socket.sysmessage( "You've unblocked the account %s." % account.name )
+ return True
+ else:
+ socket.sysmessage( "You need to specify an account name to unban." )
+ return False
+
def accountAction( socket, account, action ):
+ player = socket.player
+ playeraccount = player.account
+ myrank = playeraccount.rank
if account == None:
socket.sysmessage( "Failed to find an account with the given name." )
return False
! elif account and myrank > account.rank:
! if account.rank == 100:
! socket.sysmessage( "You can not kick or ban admins!" )
! return False
! if account.rank > 1:
! if playeraccount.authorized( 'Misc', 'May Block Staff Accounts' ):
! continue
! else:
! socket.sysmessage( "You're not authorized to kick or ban staff members." )
! return False
!
if action == 'kick':
! account.block()
for char in account.characters:
if char.socket:
|