def __init__(self, conf): qrcodeId = uuid.uuid4().hex self.qrcodePath = conf.QrcodePath(qrcodeId) if conf.mailAccount: self.mailAgent = MailAgent(conf.mailAccount, conf.mailAuthCode, name='QQBot管理员') html = ('<p>您的 QQBot 正在登录,请尽快用手机 QQ 扫描下面的二维码。' '若二维码已过期,请将本邮件设为已读邮件,之后 QQBot 会在' '1~2分钟内将最新的二维码发送到本邮箱。</p>' '<p>{{png}}</p>') html += '<p>conf.user=%r, conf.qq=%r</p>' % (conf.user, conf.qq) self.qrcodeMail = { 'to_addr': conf.mailAccount, 'html': html, 'subject': ('%s[%s]' % ('QQBot二维码', qrcodeId)), 'to_name': '我' } self.qrcode = LockedValue(None) else: self.mailAgent = None
def __init__(self, conf): qrcodeId = uuid.uuid4().hex self.qrcodePath = conf.QrcodePath(qrcodeId) if conf.httpServerName: self.qrcodeServer = QrcodeServer(conf.httpServerName, conf.httpServerPort, conf.QrcodePath) self.qrcodeURL = self.qrcodeServer.QrcodeURL(qrcodeId) else: self.qrcodeServer = None if conf.mailAccount: self.mailAgent = MailAgent(conf.mailAccount, conf.mailAuthCode, name='QQBot管理员') if self.qrcodeServer: html = ('<p>您的 QQBot 正在登录,请尽快用手机 QQ 扫描下面的二维码。' '若二维码已过期,请重新打开本邮件。若您看不到二维码图片,请确保' '图片地址 <a href="{0}">{0}</a> 可以通过公网访问。</p>' '<p><img src="{0}"></p>').format(self.qrcodeURL) else: html = ('<p>您的 QQBot 正在登录,请尽快用手机 QQ 扫描下面的二维码。' '若二维码已过期,请将本邮件删除,删除后 QQBot 会在几分钟后将' '最新的二维码发送到本邮箱。</p>' '<p>{{png}}</p>') self.qrcodeMail = { 'to_addr': conf.mailAccount, 'html': html, 'subject': ('%s[%s]' % ('QQBot二维码', qrcodeId)), 'png_content': '', 'to_name': '我' } self.hasSent = False else: self.mailAgent = None
def __init__(self, conf): qrcodeId = uuid.uuid4().hex if conf.mailAccount: self.mailAgent = MailAgent(conf.mailAccount, conf.mailAuthCode, name='QQBot管理员') self.qrcodeMail = { 'to_addr': conf.mailAccount, 'html': ('<p>您的 QQBot 正在登录,请尽快用手机 QQ 扫描下面的二维码。' '若您用手机 QQ 客户端打开此邮件,请直接长按二维码后扫码。若二' '维码已过期,请将本邮件设为已读或删除,之后 QQBot 会将最新的' '二维码发送到本邮箱。</p>' '<p>{{png}}</p>'), 'subject': ('%s[%s]' % ('QQBot二维码', qrcodeId)), 'to_name': '我' } self.hasSent = False else: self.mailAgent = None self.qrcodePath = conf.QrcodePath(qrcodeId)
def __init__(self, conf): qrcodeId = uuid.uuid4().hex self.qrcodePath = conf.QrcodePath(qrcodeId) if conf.httpServerIP: self.qrcodeServer = QrcodeServer(conf.httpServerIP, conf.httpServerPort, os.path.dirname(self.qrcodePath)) self.qrcodeURL = self.qrcodeServer.qrcodeURL else: self.qrcodeServer = None if conf.mailAccount: self.mailAgent = MailAgent(conf.mailAccount, conf.mailAuthCode, name='QQBot管理员') if self.qrcodeServer: html = ('<p>您的 QQBot 正在登录,请尽快用手机 QQ 扫描下面的二维码。' '若二维码已过期,请重新打开本邮件。若您看不到二维码图片,请确保' '图片地址 <a href="{0}">{0}</a> 可以通过公网访问。</p>' '<p><img src="{0}"></p>').format(self.qrcodeURL) else: html = ('<p>您的 QQBot 正在登录,请尽快用手机 QQ 扫描下面的二维码。' '若二维码已过期,请将本邮件设为已读邮件,之后 QQBot 会在' '1~2分钟内将最新的二维码发送到本邮箱。</p>' '<p>{{png}}</p>') self.qrcodeMail = { 'to_addr': conf.mailAccount, 'html': html, 'subject': ('%s[%s]' % ('QQBot二维码', qrcodeId)), 'to_name': '我' } self.qrcode = LockedValue(None) else: self.mailAgent = None