update email config section as discussed on ML
This commit is contained in:
parent
96f547b3df
commit
09f3205e77
|
@ -256,6 +256,20 @@ class Layout:
|
|||
|
||||
return temp + "\n"
|
||||
|
||||
class Email:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
self.host= node.getAttribute("host")
|
||||
self.username = node.getAttribute("username")
|
||||
self.password = node.getAttribute("password")
|
||||
self.useSsl = node.getAttribute("useSsl")
|
||||
self.folder = node.getAttribute("folder")
|
||||
self.fetchType = node.getAttribute("fetchType")
|
||||
|
||||
def __str__(self):
|
||||
return " fetchType=%s\n host = %s\n username = %s\n password = %s\n useSsl = %s\n folder = %s\n" \
|
||||
% (self.fetchType, self.host, self.username, self.password, self.useSsl, self.folder)
|
||||
|
||||
class Site:
|
||||
def __init__(self, node):
|
||||
def normalizePath(path):
|
||||
|
@ -284,6 +298,7 @@ class Site:
|
|||
self.xshift = node.getAttribute("xshift")
|
||||
self.yshift = node.getAttribute("yshift")
|
||||
self.layout = {}
|
||||
self.emails = {}
|
||||
|
||||
print _("Loading site"), self.site_name
|
||||
|
||||
|
@ -291,6 +306,10 @@ class Site:
|
|||
lo = Layout(layout_node)
|
||||
self.layout[lo.max] = lo
|
||||
|
||||
for email_node in node.getElementsByTagName('email'):
|
||||
email = Email(email_node)
|
||||
self.emails[email.fetchType] = email
|
||||
|
||||
# Site defaults
|
||||
self.xpad = 1 if self.xpad == "" else int(self.xpad)
|
||||
self.ypad = 0 if self.ypad == "" else int(self.ypad)
|
||||
|
@ -467,21 +486,6 @@ class Import:
|
|||
return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s\n saveActions = %s\n fastStoreHudCache = %s\n" \
|
||||
% (self.interval, self.callFpdbHud, self.hhArchiveBase, self.saveActions, self.fastStoreHudCache)
|
||||
|
||||
class Email:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
self.host= node.getAttribute("host")
|
||||
self.username = node.getAttribute("username")
|
||||
self.password = node.getAttribute("password")
|
||||
self.useSsl = node.getAttribute("useSsl")
|
||||
self.folder = node.getAttribute("folder")
|
||||
self.siteName = node.getAttribute("siteName")
|
||||
self.fetchType = node.getAttribute("fetchType")
|
||||
|
||||
def __str__(self):
|
||||
return " siteName=%s\n fetchType=%s\n host = %s\n username = %s\n password = %s\n useSsl = %s\n folder = %s\n" \
|
||||
% (self.siteName, self.fetchType, self.host, self.username, self.password, self.useSsl, self.folder)
|
||||
|
||||
class HudUI:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
|
@ -716,11 +720,6 @@ class Config:
|
|||
imp = Import(node = imp_node)
|
||||
self.imp = imp
|
||||
|
||||
for email_node in doc.getElementsByTagName("email"):
|
||||
email = Email(node = email_node)
|
||||
if email.siteName!="": #FIXME: Why on earth is this needed?
|
||||
self.emails[email.siteName+"_"+email.fetchType]=email
|
||||
|
||||
for hui_node in doc.getElementsByTagName('hud_ui'):
|
||||
hui = HudUI(node = hui_node)
|
||||
self.ui = hui
|
||||
|
@ -767,9 +766,12 @@ class Config:
|
|||
return site_node
|
||||
|
||||
def getEmailNode(self, siteName, fetchType):
|
||||
for emailNode in self.doc.getElementsByTagName("email"):
|
||||
if emailNode.getAttribute("siteName") == siteName and emailNode.getAttribute("fetchType") == fetchType:
|
||||
siteNode = self.get_site_node(siteName)
|
||||
for emailNode in siteNode.getElementsByTagName("email"):
|
||||
if emailNode.getAttribute("fetchType") == fetchType:
|
||||
print "found emailNode"
|
||||
return emailNode
|
||||
break
|
||||
#end def getEmailNode
|
||||
|
||||
def getGameNode(self,gameName):
|
||||
|
|
|
@ -72,19 +72,14 @@ class GuiImapFetcher (threading.Thread):
|
|||
|
||||
siteName=columns[0].get_text()
|
||||
fetchType=columns[1].get_text()
|
||||
code=siteName+"_"+fetchType
|
||||
|
||||
for email in self.config.emails:
|
||||
toSave=self.config.emails[email]
|
||||
break
|
||||
toSave.siteName=siteName
|
||||
toSave.fetchType=fetchType
|
||||
toSave=self.config.supported_sites[siteName].emails[fetchType]
|
||||
|
||||
toSave.host=columns[2].get_text()
|
||||
toSave.username=columns[3].get_text()
|
||||
|
||||
if columns[4].get_text()=="***":
|
||||
toSave.password=self.passwords[code]
|
||||
toSave.password=self.passwords[siteName+fetchType]
|
||||
else:
|
||||
toSave.password=columns[4].get_text()
|
||||
|
||||
|
@ -101,16 +96,17 @@ class GuiImapFetcher (threading.Thread):
|
|||
|
||||
def importAllClicked(self, widget, data=None):
|
||||
self.statusLabel.set_label(_("Starting import. Please wait.")) #FIXME: why doesnt this one show?
|
||||
for email in self.config.emails:
|
||||
try:
|
||||
result=ImapFetcher.run(self.config.emails[email], self.db)
|
||||
self.statusLabel.set_label(_("Finished import without error."))
|
||||
except IMAP4.error as error:
|
||||
if str(error)=="[AUTHENTICATIONFAILED] Authentication failed.":
|
||||
self.statusLabel.set_label(_("Login to mailserver failed: please check mailserver, username and password"))
|
||||
except gaierror as error:
|
||||
if str(error)=="[Errno -2] Name or service not known":
|
||||
self.statusLabel.set_label(_("Could not connect to mailserver: check mailserver and use SSL settings and internet connectivity"))
|
||||
for siteName in self.config.supported_sites:
|
||||
for fetchType in self.config.supported_sites[siteName].emails:
|
||||
try:
|
||||
result=ImapFetcher.run(self.config.supported_sites[siteName].emails[fetchType], self.db)
|
||||
self.statusLabel.set_label(_("Finished import without error."))
|
||||
except IMAP4.error as error:
|
||||
if str(error)=="[AUTHENTICATIONFAILED] Authentication failed.":
|
||||
self.statusLabel.set_label(_("Login to mailserver failed: please check mailserver, username and password"))
|
||||
except gaierror as error:
|
||||
if str(error)=="[Errno -2] Name or service not known":
|
||||
self.statusLabel.set_label(_("Could not connect to mailserver: check mailserver and use SSL settings and internet connectivity"))
|
||||
#def importAllClicked
|
||||
|
||||
def get_vbox(self):
|
||||
|
@ -128,38 +124,42 @@ class GuiImapFetcher (threading.Thread):
|
|||
self.rowVBox = gtk.VBox()
|
||||
self.mainVBox.add(self.rowVBox)
|
||||
|
||||
for email in self.config.emails:
|
||||
config=self.config.emails[email]
|
||||
box=gtk.HBox(homogeneous=True)
|
||||
for siteName in self.config.supported_sites:
|
||||
for fetchType in self.config.supported_sites[siteName].emails:
|
||||
config=self.config.supported_sites[siteName].emails[fetchType]
|
||||
box=gtk.HBox(homogeneous=True)
|
||||
|
||||
for field in (config.siteName, config.fetchType):
|
||||
label=gtk.Label(field)
|
||||
box.add(label)
|
||||
for field in (siteName, config.fetchType):
|
||||
label=gtk.Label(field)
|
||||
box.add(label)
|
||||
|
||||
for field in (config.host, config.username):
|
||||
entry=gtk.Entry()
|
||||
entry.set_text(field)
|
||||
box.add(entry)
|
||||
|
||||
for field in (config.host, config.username):
|
||||
entry=gtk.Entry()
|
||||
entry.set_text(field)
|
||||
self.passwords[siteName+fetchType]=config.password
|
||||
entry.set_text("***")
|
||||
box.add(entry)
|
||||
|
||||
entry=gtk.Entry()
|
||||
self.passwords[email]=config.password
|
||||
entry.set_text("***")
|
||||
box.add(entry)
|
||||
entry=gtk.Entry()
|
||||
entry.set_text(config.folder)
|
||||
box.add(entry)
|
||||
|
||||
entry=gtk.Entry()
|
||||
entry.set_text(config.folder)
|
||||
box.add(entry)
|
||||
sslBox = gtk.combo_box_new_text()
|
||||
sslBox.append_text(_("Yes"))
|
||||
sslBox.append_text(_("No"))
|
||||
if config.useSsl:
|
||||
sslBox.set_active(0)
|
||||
else:
|
||||
sslBox.set_active(1)
|
||||
box.add(sslBox)
|
||||
|
||||
sslBox = gtk.combo_box_new_text()
|
||||
sslBox.append_text(_("Yes"))
|
||||
sslBox.append_text(_("No"))
|
||||
sslBox.set_active(0)
|
||||
box.add(sslBox)
|
||||
#TODO: "run just this one" button
|
||||
|
||||
#TODO: "run just this one" button
|
||||
|
||||
self.rowVBox.pack_start(box, expand=False)
|
||||
#print
|
||||
self.rowVBox.pack_start(box, expand=False)
|
||||
#print
|
||||
|
||||
self.mainVBox.show_all()
|
||||
#end def displayConfig
|
||||
|
|
|
@ -156,6 +156,7 @@ Left-Drag to Move"
|
|||
xshift="0"
|
||||
yshift="0"
|
||||
supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
|
||||
<email fetchType="request-summary" host="YOUR_EMAIL_SERVER" username="YOUR_EMAIL_USERNAME" password="YOUR_EMAIL_PASSWORD" useSsl="True" folder="INBOX"/>
|
||||
<layout max="8" width="792" height="546" fav_seat="0">
|
||||
<location seat="1" x="684" y="61"> </location>
|
||||
<location seat="2" x="689" y="239"> </location>
|
||||
|
@ -708,10 +709,6 @@ Left-Drag to Move"
|
|||
<!-- <database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="YOUR MYSQL PASSWORD"></database> -->
|
||||
<database db_ip="localhost" db_server="sqlite" db_name="fpdb.db3" db_user="fpdb" db_pass="fpdb"/>
|
||||
</supported_databases>
|
||||
|
||||
<email>
|
||||
<email siteName="PokerStars" fetchType="request-summary" host="YOUR_EMAIL_SERVER" username="YOUR_EMAIL_USERNAME" password="YOUR_EMAIL_PASSWORD" useSsl="True" folder="INBOX"/>
|
||||
</email>
|
||||
</FreePokerToolsConfig>
|
||||
<!-- IMPORTANT: Please note that fpdb stores your email password in clear text.
|
||||
So do not post a config containing a password on the Internet or anywhere else without removing the password! -->
|
||||
|
|
Loading…
Reference in New Issue
Block a user