|
| 1 | +""" |
| 2 | +Copyright (c) 2014, Sam Dodrill |
| 3 | +All rights reserved. |
| 4 | +
|
| 5 | +This software is provided 'as-is', without any express or implied |
| 6 | +warranty. In no event will the authors be held liable for any damages |
| 7 | +arising from the use of this software. |
| 8 | +
|
| 9 | +Permission is granted to anyone to use this software for any purpose, |
| 10 | +including commercial applications, and to alter it and redistribute it |
| 11 | +freely, subject to the following restrictions: |
| 12 | +
|
| 13 | + 1. The origin of this software must not be misrepresented; you must not |
| 14 | + claim that you wrote the original software. If you use this software |
| 15 | + in a product, an acknowledgment in the product documentation would be |
| 16 | + appreciated but is not required. |
| 17 | +
|
| 18 | + 2. Altered source versions must be plainly marked as such, and must not be |
| 19 | + misrepresented as being the original software. |
| 20 | +
|
| 21 | + 3. This notice may not be removed or altered from any source |
| 22 | + distribution. |
| 23 | +""" |
| 24 | + |
| 25 | +import sys |
| 26 | + |
| 27 | +from structures import * |
| 28 | +from utils import * |
| 29 | + |
| 30 | +NAME="plexus protocol module" |
| 31 | +DESC="Handles login and protocol commands for PleXus" |
| 32 | + |
| 33 | +CHANMODES=["eIb", "k" ,"l" ,"BCMNORScimnpstz", "qaohv"] |
| 34 | + |
| 35 | +def initModule(cod): |
| 36 | + cod.loginFunc = login |
| 37 | + cod.burstClient = burstClient |
| 38 | + |
| 39 | + cod.loadmod("charybdis") |
| 40 | + |
| 41 | +def destroyModule(cod): |
| 42 | + del cod.loginFunc |
| 43 | + cod.loginFunc = None |
| 44 | + |
| 45 | +def rehash(): |
| 46 | + pass |
| 47 | + |
| 48 | +def login(cod): |
| 49 | + """ |
| 50 | + Sends the commands needed to authenticate to the remote IRC server. |
| 51 | + """ |
| 52 | + |
| 53 | + cod.sendLine("PASS %s TS 6 :%s" % \ |
| 54 | + (cod.config["uplink"]["pass"], cod.sid)) |
| 55 | + cod.sendLine("CAPAB :QS EX CHW IE EOB KLN UNKLN GLN HUB KNOCK TBURST PARA ENCAP SVS") |
| 56 | + cod.sendLine("SERVER %s 1 :%s" % \ |
| 57 | + (cod.config["me"]["name"], cod.config["me"]["desc"])) |
| 58 | + |
| 59 | +def burstClient(cod, client): |
| 60 | + # UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname; |
| 61 | + burst = ":%s UID %s 1 %d +iUo %s %s 0 %s 0 %s :%s" %\ |
| 62 | + (cod.sid, client.nick, int(time.time), client.user, client.host, |
| 63 | + client.uid, client.host, client.gecos) |
| 64 | + cod.sendLine(burst) |
| 65 | + |
0 commit comments