~ubuntu-branches/ubuntu/precise/gozerbot/precise

« back to all changes in this revision

Viewing changes to build/lib/gozerplugs/plugs/underauth.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Malcolm
  • Date: 2008-06-02 19:26:39 UTC
  • mfrom: (1.1.3 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080602192639-3rn65nx4q1sgd6sy
Tags: 0.8.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# plugs/underauth.py
2
 
#
3
 
#
4
 
 
5
 
"""Handle non-ident connection on undernet"""
6
 
 
7
 
__copyright__ = 'this file is in the public domain'
8
 
__author__ = 'aafshar@gmail.com'
9
 
 
10
 
from gozerbot.callbacks import callbacks
11
 
 
12
 
def pre_underauth_cb(bot, ievent):
13
 
    """
14
 
    Only respond to the message like:
15
 
 
16
 
    NOTICE AUTH :*** Your ident is disabled or broken, to continue
17
 
    to connect you must type /QUOTE PASS 16188
18
 
    """
19
 
    args = ievent.arguments
20
 
    try:
21
 
        return (args[0] == u'AUTH' and
22
 
                args[-3] == u'/QUOTE' and
23
 
                args[-2] == u'PASS')
24
 
    except Exception, ex:
25
 
        return 0
26
 
 
27
 
def underauth_cb(bot, ievent):
28
 
    """
29
 
    Send the raw command to the server
30
 
    """
31
 
    # last two elements of the arguments list are PASS <id>
32
 
    bot.sendraw(' '.join(ievent.arguments[-2:]))
33
 
 
34
 
 
35
 
callbacks.add('NOTICE', underauth_cb, pre_underauth_cb)