#NEWLINE# @ internationalizeDocstring #NEWLINE# def remove( self , irc , msg , args , channel , optlist , regexp ) : #NEWLINE# #INDENT# "[<channel>|global] [--id] <regexp>]\n\n        Removes the trigger for <regexp> from the triggers database.\n        <channel> is only necessary if\n        the message isn't sent in the channel itself.\n        If option --id specified, will retrieve by regexp id, not content.\n        " #NEWLINE# if ( not self . _checkManageCapabilities ( irc , msg , channel ) ) : #NEWLINE# #INDENT# capabilities = self . registryValue ( 'requireManageCapability' ) #NEWLINE# irc . errorNoCapability ( capabilities , Raise = True ) #NEWLINE# #UNINDENT# db = self . getDb ( channel ) #NEWLINE# cursor = db . cursor ( ) #NEWLINE# target = 'regexp' #NEWLINE# for ( option , arg ) in optlist : #NEWLINE# #INDENT# if ( option == 'id' ) : #NEWLINE# #INDENT# target = 'id' #NEWLINE# #UNINDENT# #UNINDENT# sql = ( 'SELECT id, locked FROM triggers WHERE %s=?' % ( target , ) ) #NEWLINE# cursor . execute ( sql , ( regexp , ) ) #NEWLINE# results = cursor . fetchall ( ) #NEWLINE# if ( len ( results ) != 0 ) : #NEWLINE# #INDENT# ( id , locked ) = list ( map ( int , results [ 0 ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# irc . error ( _ ( 'There is no such regexp trigger.' ) ) #NEWLINE# return #NEWLINE# #UNINDENT# if locked : #NEWLINE# #INDENT# irc . error ( _ ( 'This regexp trigger is locked.' ) ) #NEWLINE# return #NEWLINE# #UNINDENT# cursor . execute ( 'DELETE FROM triggers WHERE id=?' , ( id , ) ) #NEWLINE# db . commit ( ) #NEWLINE# irc . replySuccess ( )