;ς = ΔDc@sΞdkZdkZdkiZdkiZdkTdkiZdk i Z dk i Z d„Z deifd„ƒYZdeifd„ƒYZeidhde<ƒZde ifd „ƒYZeZdS( N(s*cCsttiƒƒSdS(N(sintstime(((s./Memo/plugin.pysnow(ss MemoRecordcBs)tZddddeieffgZRS(Nsatsbystextsappends(s__name__s __module__sutilsssafeEvalslists __fields__(((s./Memo/plugin.pys MemoRecord+ss DbiMemoDBcBs/tZdZeZd„Zd„Zd„ZRS(NsflatcOs)tt|ƒ|_|ii||ŽdS(N(ssupers DbiMemoDBsselfs_DbiMemoDB__parents__init__sargsskwargs(sselfsargsskwargs((s./Memo/plugin.pys__init__6scCs/|ii|idtƒd|d|ƒƒSdS(Nsatsbystext(sselfs_DbiMemoDB__parentsaddsRecordsnowsuseridstext(sselfsuseridstext((s./Memo/plugin.pysadd:scCs?|i|ƒ}|iitƒ||gƒ|i ||ƒdS(N( sselfsgetsidsmemosappendssappendsnowsuseridstextsset(sselfsidsuseridstextsmemo((s./Memo/plugin.pysappend>s(s__name__s __module__sMappings MemoRecordsRecords__init__saddsappend(((s./Memo/plugin.pys DbiMemoDB3s   sMemosflatcBsΉtZd„Zd„Zd„ZeeddgƒZd„Zd„Zeedd fgƒZd „Zeed gƒZd „Z ee ddd fdgƒZ d „Z ee ƒZ RS(NcCs2tt|ƒ|_|ii|ƒtƒ|_dS(N(ssupersMemosselfs _Memo__parents__init__sircsMemoDBsdb(sselfsirc((s./Memo/plugin.pys__init__HscCs|iiƒ|iiƒdS(N(sselfs _Memo__parentsdiesdbsclose(sself((s./Memo/plugin.pysdieMs cCs2|ii|i|ƒ}|itd|ƒƒdS(s> Adds a new memo with the text . sMemo #%s added.N( sselfsdbsaddsusersidstextsircs replySuccesssformat(sselfsircsmsgsargssuserstextsid((s./Memo/plugin.pysaddQssuserstextcCs’ti|iƒ}td|i||iƒg}x?|i D]4\}}}|i td|ti|ƒ|ƒƒq:Wt i dƒ}|i|ƒSdS(Ns%s (added by %s at %t)s%s (appended by %s at %t)s :: (spluginss getUserNamesmemosbysusersformatstextsatsLsappendssappendsircutilssboldssepsjoin(sselfsmemostextssepsLsbysusersat((s./Memo/plugin.pys _formatMemoZs  cCsVy,|ii|ƒ}|i|i|ƒƒWn#tj o|i d|ƒnXdS(s7 Retrieves the memo with id . smemo idN( sselfsdbsgetsidsmemosircsreplys _formatMemosKeyErrors errorInvalid(sselfsircsmsgsargssidsmemo((s./Memo/plugin.pysmemocs sidsmemoc s―ˆiƒ‰‡d†} gi}|ii| ƒD]}||i ƒq2~}|oI|i ƒ|i tdgi}|D]}|d|ƒqy~ƒƒn|i dƒdS(sJ Searches for in the memo database. csjti|iiƒˆƒotSn?x;|iD]0\}}}ti|iƒˆƒotSq.q.Wt SdS(N( sfnmatchsmemostextslowersglobsTruesappendssatsbysFalse(smemostextsbysat(sglob(s./Memo/plugin.pyspus  s %L matched.s#%ssThere were no matching memos.N(sglobslowerspsappends_[1]sselfsdbsselectsmemosidsidsssortsircsreplysformat( sselfsircsmsgsargssglobsmemosidssids_[1]sp((sglobs./Memo/plugin.pyssearchos  6 ?sglobcCsQy'|ii||i|ƒ|iƒWn#tj o|i d|ƒnXdS(sX Appends to the end of the memo with the given . smemo idN( sselfsdbsappendsidsuserstextsircs replySuccesssKeyErrors errorInvalid(sselfsircsmsgsargssusersidstext((s./Memo/plugin.pysappend…s cCsfd}d}x.|iD]#}|d7}|t|iƒ7}qW|itd|df|dfƒƒdS(sbtakes no arguments Returns the number of memos and appends in the memo database. iis(There are %n and %n in my memo database.smemosappendN( smemossappendssselfsdbsmemoslensircsreplysformat(sselfsircsmsgsargssmemossappendssmemo((s./Memo/plugin.pysstats‘s   ( s__name__s __module__s__init__sdiesaddswraps _formatMemosmemossearchsappendsstats(((s./Memo/plugin.pysMemoGs       (stimesfnmatchs supybot.dbisdbis supybot.utilssutilsssupybot.commandsssupybot.pluginsspluginsssupybot.ircutilssircutilsssupybot.callbackss callbackssnowsRecords MemoRecordsDBs DbiMemoDBsMemoDBsPrivmsgsMemosClass( sdbis DbiMemoDBsutilsstimesMemoDBsClasss callbackss MemoRecordspluginssfnmatchsnowsMemosircutils((s./Memo/plugin.pys?s        Z