~bnrubin/bantrackertwo/devel

« back to all changes in this revision

Viewing changes to BantrackerTwo/plugin.py

  • Committer: Benjamin Rubin
  • Date: 2010-04-22 12:52:10 UTC
  • Revision ID: bnrubin@romulus-20100422125210-68ez41ig3okw2rpt
- Since we're now using ircd7, it makes sense to sepatate mutes (+q) into a separate class

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        <channel> is only needed when send in /msg
83
83
        """
84
84
        host = ircutils.hostFromHostmask(msg.prefix)
85
 
        if not self.isOp(host)
 
85
        if not self.isOp(host):
86
86
            irc.error('User not recognized.')
87
87
            return
88
88
        
140
140
                ban = Ban.objects.create(channel=channel,operator=op,create_date=self.now(),hostmask=target,mask=target,log=self.getLog(channel))
141
141
                ban.save()
142
142
            if param[0] == '-b':
143
 
                # Grab the oldest matching ban, just in case we missed a removal
 
143
                # Grab the newest matching ban, just in case we missed a removal
144
144
                try:
145
145
                    ban = Ban.objects.filter(channel=channel,hostmask=target,mask=target,removal_date=None).order_by('create_date')[0:1].get()
146
146
                    ban.removal_date = self.now()
148
148
                    ban.save()
149
149
                except Ban.DoesNotExist,e:
150
150
                    self.log.info('%s: %s' % (e,target))
 
151
            if param[0] == '+q':
 
152
                mute = Mute.objects.create(channel=channel,operator=op,create_date=self.now(),hostmask=target,mask=target,log=self.getLog(channel))
 
153
                mute.save()
 
154
            if param[0] == '-q':
 
155
                # Grab the newest matching mute, just in case we missed a removal
 
156
                try:
 
157
                    mute = Mute.objects.filter(channel=channel,hostmask=target,mask=target,removal_date=None).order_by('create_date')[0:1].get()
 
158
                    mute.removal_date = self.now()
 
159
                    mute.removed_by = op
 
160
                    mute.save()
 
161
                except Ban.DoesNotExist,e:
 
162
                    self.log.info('%s: %s' % (e,target))
 
163
                                                                                                                                                    
151
164
    
152
165
    def doPrivmsg(self,irc,msg):
153
166
        recipients, text = msg.args