~ubuntu-branches/ubuntu/utopic/gozerbot/utopic

« back to all changes in this revision

Viewing changes to build/lib/gozerbot/plugs/nickcapture.py

  • Committer: Package Import Robot
  • Author(s): Jeremy Malcolm
  • Date: 2012-04-03 21:58:28 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20120403215828-6mik0tzug5na93la
Tags: 0.99.1-2
* Removes logfiles on purge (Closes: #668767)
* Reverted location of installed files back to /usr/lib/gozerbot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# gozerplugs/plugs/nickcapture.py
 
2
#
 
3
#
 
4
 
 
5
""" nick recapture callback. """
 
6
 
 
7
__copyright__ = 'this file is in the public domain'
 
8
 
 
9
from gozerbot.callbacks import callbacks
 
10
from gozerbot.plughelp import plughelp
 
11
 
 
12
plughelp.add('nickcapture', 'nickcapture takes a nick back if a user quits')
 
13
 
 
14
def ncaptest(bot, ievent):
 
15
 
 
16
    """ test if user is splitted. """
 
17
 
 
18
    if '*.' in ievent.txt or bot.server in ievent.txt:
 
19
        return 0
 
20
 
 
21
    if bot.orignick.lower() == ievent.nick.lower():
 
22
        return 1
 
23
 
 
24
    return 0
 
25
 
 
26
def ncap(bot, ievent):
 
27
 
 
28
    """ recapture the nick. """
 
29
 
 
30
    bot.donick(bot.orignick)
 
31
 
 
32
callbacks.add('QUIT', ncap, ncaptest, threaded=True)