Ñò +z2Wc@s‡dZddkZddkZddklZdefd„ƒYZdefd„ƒYZd efd „ƒYZd d d „ƒYZdS(schat file handlingiÿÿÿÿNi(tConftConfChatcBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(sÞConfChat(Conf): Not a dictionary! This reads chat files, and writes a subset of chat files that has all items enclosed in '' and has one expect/send pair on each line. Uses a list of two-element tuples.cCs&ti||dddƒd|_dS(Nts t (Rt__init__tNonetlist(tselftfilename((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyRscCsti|ƒ|iƒdS(N(Rtreadtinitlist(R((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR s cCs*g|_d}d}g}x|iD]}||d}q%Wx3|t|ƒjo||djo|d}q@WxT|t|ƒjo@d}||djož|d}xƒ|t|ƒjoo||djo^||djo1||ddjo|d}n|d}n|||}|d}q­W|d}nExA|t|ƒjo-||djo|||}|d}qAW|i|ƒx3|t|ƒjo||djo|d}q’WqvWt|ƒd o|idƒnx7|o/|ii|d|dfƒg|dd +qïWdS( NiRRs it's\s 'i(Rtlinestlentappend(Rtitstchatlisttlinetmstr((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR sL  $ $$ $cCs|iS(N(R(R((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pytgetlist<scCs ||_dS(N(R(Rtmlist((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pytputlist>scCs~g|_xa|iD]V\}}tidd|ƒ}tidd|ƒ}|iid|d|dƒqWti|ƒdS(NR s\'s' '(R RtretsubRRtwrite(Rtptq((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR@s  $( t__name__t __module__t__doc__RR R RRR(((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyRs   '  t ConfChatFilecBs5eZdZdd„Zd„Zd„Zd„ZRS(säConfChatFile(ConfChat): This class is a ConfChat which it interprets as a netcfg-written chat file with a certain amount of structure. It interprets it relative to information in an "ifcfg-" file (devconf) and has a set of abortstrings that can be turned on and off. It exports the following data items: abortstrings list of standard strings on which to abort abortlist list of alternative strings on which to abort defabort boolean: use the default abort strings or not dialcmd string containing dial command (ATDT, for instance) phonenum string containing phone number chatlist list containing chat script after CONNECT chatfile ConfChat instance cCs0ti||ƒ||_||_|iƒdS(N(RRt abortstringstdevconft _initlist(RRR!R ((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyRYs  cCsEg|_d|_d|_d|_g|_tidƒ}|ioûxø|iD]é\}}t|dƒp.||i jo|ii ||gƒq9qPt||i dƒpqP|i oO|i |ƒo?ti d|ƒ}|i dƒ}|| |_|||_qPt|dƒpqP|ii ||gƒqPWndS(NiRs^ATD[TP]?[-0-9,. #*()+]+tABORTt INITSTRINGs[-0-9, . #*()+]+tCONNECT(t abortlisttdefaborttdialcmdtphonenumRRtcompileRtcmpR RR!tsearchtgroup(RtdialexpRRttmptindex((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR"^s,        cCsàg|_|io.x+|iD]}|iid|fƒqWnx'|iD]}|iid|fƒqKW|iid|idfƒ|iid|i|ifƒ|iidƒx!|iD]}|ii|ƒqÂWdS(NR#RR$tOKR%(sCONNECTR( RR'R RR&R!R(R)R(Rtstringtpair((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyt _makelist{s      cCs|iƒti|ƒdS(N(R4RR(R((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR‡s N(RRRRRR"R4R(((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyRJs    tConfChatFileClonecBseZdd„Zd„ZRS(cCsk||_ti||||ƒ|ip>g|_x$|iiD]}|ii|ƒq?W|iƒndS(N(tciRRRRR"(Rt cloneInstanceRR!R titem((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR‘s    cCs¾|iƒt|iƒt|iiƒjoxPtt|iƒƒD]9}t|i||ii|ƒoti|ƒdSqBWti i |i ƒoti |i ƒqºnti|ƒdS(N( R4R RR6trangeR+RRtostpathtisfileRtunlink(RR((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR™s "!  N(RRRRR(((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR5s tConfDIPcBseZd„Zd„ZRS(cCs||_||_||_dS(N(t dipfilenametchatfiletcf(RR@R?t configfile((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR°s  cCs°t|iddƒ}ti|idƒ|id|iddddd |id dd |id dd |iddd|iddƒ|ido |id|iddƒnx‰|iiD]{}t|ddƒoat|ddƒoM|do!|id|dddƒn|id|dddƒqÓqÓWt|iddƒp|idƒn|id|id dd!d"d#ƒ|i ƒdS($Ntwiÿÿÿÿi€s# dip script for interface tDEVICEs s²# DO NOT HAND-EDIT; ALL CHANGES *WILL* BE LOST BY THE netcfg PROGRAM # This file is created automatically from several other files by netcfg # Re-run netcfg to modify this file smain: s get $local tIPADDRs get $remote tREMIPs port t MODEMPORTs speed t LINESPEEDtMTUs get $mtu iR#tTIMEOUTs wait s 30 s if $errlvl != 0 goto error s send is\r\n tDEFROUTEtyess default s mode tMODEs exit serror: s& print connection to $remote failed. ( topenR?R:tchmodRRAR@RR+tclose(RtmfileR3((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR´s( j  (  (RRRR(((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyR>¯s ((RR:RRRRR5R>(((s</usr/share/system-config-network/netconfpkg/conf/ConfChat.pyts  BF