m๒ "แธEc@sๅdZdkZeieƒdZdkZdkZdkZdkZdeifd„ƒYZ dei fd„ƒYZ e djo\dk Z ee iƒdjoeie idƒZnd Ze d eƒZeiƒndS( s9$Id: chat_server.py 24763 2004-05-17 05:59:28Z philikon $Nit chat_channelcBshtZd„Zd„Zd„Zd„Zd„Zd„ZeZd„Z d„Z d „Z d „Z RS( NcCsUtii||ƒ||_||_|idƒd|_d|_ |i dƒdS(Ns ts nickname?: ( tasynchatt async_chatt__init__tselftsocktservertaddrtset_terminatortdatatNonetnicktpush(RRRR((t9/data/zmath/zope/lib/python/ZServer/medusa/chat_server.pyRs     cCs|i||_dS(N(RR (RR ((Rtcollect_incoming_datascCsฎ|i}d|_|idjoHti|ƒd|_|ipd|_|idƒqช|iƒnA|pn6|ddjo|i i ||ƒn|i |ƒdS(NRishuh? gimmee a nickname: t/( RR tlineR R tstringtsplitR tgreetRt push_linethandle_command(RR((Rtfound_terminator!s    cCsป|id|iƒt|iiƒd}|djo|idƒnp|idt|iiƒdƒtd„|iiiƒƒ}|it i |dƒdƒ|ii |d ƒdS( Ns Hello, %s iis3[Kinda lonely in here... you're the only caller!] s[There are %d other callers] cCs |iƒS(N(txtget_nick(R((Rt:ss s s[joined]( RR R tlenRtchannelst num_channelstmaptkeystnicksRtjoinR(RR R((RR3s !cCs”dk}ti|ƒ}d|dd}t||ƒoVt||ƒ}t |ƒt |i ƒjo||dƒq|i d|dƒndS(Nscmd_%siisunknown command: %s( ttypesRRtcommandt command_linetnamethasattrRtgetattrtmethodttypeRR (RR#R$R(R"R%((RR>s cCs.|ii|dƒ|idƒ|iƒdS(Ns[left]s Goodbye! (RRRR tclose_when_done(Rtargs((Rtcmd_quitJs cCs|id||fƒdS(Ns%s: %s (RR R R(RR R((RRRscCs|iƒdS(N(Rtclose(R((Rt handle_closeUscCs!|ii|=tii|ƒdS(N(RRRRRR-(R((RR-Xs cCs#|idj o |iSndSdS(NtUnknown(RR R (R((RR\s ( t__name__t __module__RRRRRR,tcmd_qRR.R-R(((RRs      t chat_servercBsQtZdeZeZdZddd„Zd„Zd„Z d„Z d „Z RS( NsChat Server (V%s)iRiF!cCsg||_|ititiƒ|i||fƒd|i|fGH|i dƒh|_ d|_ dS(Ns%s started on port %dii( tportRt create_sockettsockettAF_INETt SOCK_STREAMtbindtipt SERVER_IDENTtlistenRtcount(RR:R4((RRjs   cCs_|iƒ\}}|id|_d|i|d|dfGHd|i|i|||ƒ%ss
Listening on Port: %ds
Total Sessions: %ds
Current Sessions: %d( RR;R4R=RRtlineststatus_handlertlines_producer(RRE((Rtstatuss4cCsdS(Ni((R((RtwritableŠs( R0R1tVERSIONR;RR@RCRRARRHRI(((RR3bs    t__main__iiF!R(tRCS_IDRRRJR6tasyncoreRRFRRt dispatcherR3R0tsysRtargvtatoiR4tstloop( R3RRMRRLRORRRJRFRR4R6((Rt?s     O+