def login_tocen(bot, ievent): tocendir = cfg.get('tocendir') user = getuser(ievent) if not user: return ievent.reply(getmessage('unknown_nick')) presencename = 'presence.c-base.org/%s' % user userid = uuid.uuid3(uuid.NAMESPACE_DNS, presencename.encode('utf8')).hex tocenfile = '%s/%s' % (tocendir, userid) if not os.path.exists(tocenfile): f = open('%s/%s' % (tocendir, userid), 'w') f.write(user) f.close() httpurl = "http://10.0.1.27:8080" return ievent.reply('%s/login/%s' % (httpurl, userid))
def lteconvert(): # LTE conversion to ETA day = weekdays[datetime.datetime.now().weekday()] if day != self.oldday: self.oldday = day dayitem = LteItem(day) # convert LTEs to ETAs for current day for user in dayitem.data.ltes.keys(): seteta(user, dayitem.data.ltes[user]) if bot and bot.type == "sxmpp" and cfg.get('suppress-subs') == 0: for etasub in data['etasubs']: bot.say(etasub, 'ETA %s %s' % (user, dayitem.data.ltes[user])) del dayitem.data.ltes[user] # clear LTEs for current day dayitem.data.ltes = {} dayitem.save()