;ò > ÄDc@sdkiZdkiZdkTdkiZdkiZdk i Z dk i Z dk lZdkiiZdkiiZdkZdkZdkZedƒZedƒZeZd„Zde ifd„ƒYZdeifd „ƒYZd ei fd „ƒYZ!eZ"dS( N(s*(sbasici i cCstitid|ƒƒSdS(s&convert long int to dotted quad strings>LN(ssockets inet_ntoasstructspacksn(sn((s./Dcc/plugin.pysnumToDottedQuad7ssDcccBswtZdZd„Zd„Zd„ZeegƒZd„Zd„Zd„Z d„Z d„Z d „Z d „Z RS( sÕ A plugin to allow users to connect with Dcc. To use, load the plugin, and initiate a dcc request. There are no configuration variables, but to control which users connect, use the Dcc capability.cCsAtii||ƒ||_t|ƒ|_h|_h|_dS(N( s callbackssPlugins__init__sselfsircsSupyDccFactorysfactorys hostmaskss connections(sselfsirc((s./Dcc/plugin.pys__init__Bs   cCsO|io=|iio(|ii}|i|idƒtSqK|Sn|SdS(s9 Checks messages for those sent via Dcc and routes them. iN(smsgs inReplyTosfromDccscons sendReplysargssNone(sselfsircsmsgscon((s./Dcc/plugin.pys outFilterIs   cCs2|io|i}|iƒn|idƒdS(sŽ[takes no arguments] Exit a Dcc session. This command can only be called from Dcc, and not from standard IRC s#"exit" may only be called from DCC.N(smsgsfromDccs connectionsclosesircsreply(sselfsircsmsgsargss connection((s./Dcc/plugin.pysexitYs   cCs;x"|iD]}|i|iƒq Wh|_h|_dS(s Shut down all the connections. N(sselfs connectionsshostportscloses hostmasks(sselfshostport((s./Dcc/plugin.pysdiefs   cCsti|||iƒdS(s Connect to a DCC connection. N(sreactors connectTCPshostsportsselfsfactory(sselfshostsport((s./Dcc/plugin.pys _connectDccmscCs˜|iƒ}|didƒotyAt|iƒƒ}tt|iƒƒƒ}|i |||ƒWq”t j o |i id|iƒƒq”XndS(s Handle a DCC request. isCHATsBad DCC request: %sN(scommandssplitsargss startswithsintspopsportsnumToDottedQuadshostsselfs_dccChatRequestshostmasks ValueErrorslogsdebugsstrip(sselfshostmaskscommandsargsshostsport((s./Dcc/plugin.pys _dccRequestqs cCsN|i|ƒo'||i||f<|i||ƒn|iid|ƒdS(s Handle a Dcc chat request. s(Failed connection attempt, incapable %s.N( sselfs _isDccCapableshostmasks hostmasksshostsports _connectDccslogsdebug(sselfshostmaskshostsport((s./Dcc/plugin.pys_dccChatRequest|s  cCsti|dƒSdS(s# Check if the user is DCC capable. sDccN(sircdbscheckCapabilityshostmask(sselfshostmask((s./Dcc/plugin.pys _isDccCapable…sc Cs~||f|ijod|i||f}|iƒ}|ii }t i |||ƒ}|id|ƒ|ii|ƒndS(s" Handle a line received over DCC. sfromDccN(shostsportsselfs hostmasksshmslinesstripscmdsircsnickstosircmsgssprivmsgsmstags connectionsfeedMsg( sselfs connectionshostsportslinescmdsmstoshm((s./Dcc/plugin.pys _lineReceived‰s  cCsA|ididƒ}|idƒo|i|i|ƒndS(s+ Check whether a privmsg is a DCC request. issDCCN(smsgsargssstripstexts startswithsselfs _dccRequestsprefix(sselfsircsmsgstext((s./Dcc/plugin.pys doPrivmsg“s(s__name__s __module__s__doc__s__init__s outFiltersexitswrapsdies _connectDccs _dccRequests_dccChatRequests _isDccCapables _lineReceiveds doPrivmsg(((s./Dcc/plugin.pysDcc<s        s SupyDccChatcBsMtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(s Basic line protocol cCs#||_tt|_d|_dS(Ns(scbsselfsCRsNLs delimitersrbuffer(sselfscb((s./Dcc/plugin.pys__init__s  cCsN|iiƒ\}|_|_||ii|i|if<|iidƒdS(s+ Called when the connection has been made. s%Connected to Supybot Dcc interface. N( sselfs transportsgetPeerstshostsportscbs connectionsswrite(sselfst((s./Dcc/plugin.pysconnectionMade¢scCs6|ii|i|if=|ii|i|if=dS(s6 Called when the connection has been lost, or closed. N(sselfscbs connectionsshostsports hostmasks(sselfsreason((s./Dcc/plugin.pysconnectionLost¨scCsr|i||_|iitƒ}|iƒ|_x:|D]2}|dtjo|d }n|i |ƒq8WdS(s Called when data is received. iÿÿÿÿN( sselfsrbuffersdatassplitsLFslinesspopslinesCRs lineReceived(sselfsdataslinessline((s./Dcc/plugin.pys dataReceived­scCs#|ii||i|i|ƒdS(s% Called on the receipt of each line. N(sselfscbs _lineReceivedshostsportsline(sselfsline((s./Dcc/plugin.pys lineReceived¹scCs|iid|ƒdS(s Send a reply. s%s N(sselfs transportswritesreply(sselfsreply((s./Dcc/plugin.pys sendReply½scCs|idƒ|iiƒdS(Ns* Closing connection down.(sselfs sendReplys transportsloseConnection(sself((s./Dcc/plugin.pyscloseÁs ( s__name__s __module__s__doc__s__init__sconnectionMadesconnectionLosts dataReceiveds lineReceiveds sendReplysclose(((s./Dcc/plugin.pys SupyDccChatšs      sSupyDccFactorycBs tZdZd„Zd„ZRS(s" Client connector factory for Dcc cCs||_t|_dS(N(scbsselfs SupyDccChatsprotocol(sselfscb((s./Dcc/plugin.pys__init__Ès cCs#|i|iƒ}||_|SdS(s/ Called to create an instance of the protocol. N(sselfsprotocolscbspsfactory(sselfsaddrsp((s./Dcc/plugin.pys buildProtocolÌs (s__name__s __module__s__doc__s__init__s buildProtocol(((s./Dcc/plugin.pysSupyDccFactoryÅs  (#s supybot.ircdbsircdbs supybot.utilssutilsssupybot.commandsssupybot.ircmsgssircmsgsssupybot.pluginsspluginsssupybot.ircutilssircutilsssupybot.callbackss callbacksstwisted.protocolssbasicstwisted.internet.reactorsinternetsreactorstwisted.internet.protocolsprotocolssysssocketsstructschrsCRsNLsLFsnumToDottedQuadsPluginsDccs LineReceivers SupyDccChats ClientFactorysSupyDccFactorysClass(sNLsLFsircdbsprotocolsreactors SupyDccChatsnumToDottedQuadsutilssbasicsircmsgssstructssyss callbacksssocketspluginssSupyDccFactorysCRsClasssDccsircutils((s./Dcc/plugin.pys?s(             ^+