From: konrad Date: Wed, 6 Oct 2010 19:32:54 +0000 (+0000) Subject: add re-login X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=3689df8f7c0a0950f33ff749ba4f4d8132ebe260;p=web%2Fkonrad%2Fsmoke.git add re-login git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@602 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/iface/msinterface.cpp b/src/iface/msinterface.cpp index 9aaad32..6fb983e 100644 --- a/src/iface/msinterface.cpp +++ b/src/iface/msinterface.cpp @@ -15,12 +15,15 @@ #include "sslexception.h" #include "templates.h" +#include #include #include #include #include #include +#include #include +#include MSInterface::MSInterface(QString pid) :MInterface() @@ -63,6 +66,11 @@ bool MSInterface::login(QString username,QString passwd) else setSessionId(lg.getsessionid()); if(lg.stage()!=lg.Success)return false; + //schedule re-login before session times out + int msecs=QDateTime::currentDateTime().msecsTo(QDateTime::fromTime_t(lg.getvalidtill())); + msecs-=120000;//do it 2 min before session runs out + if(msecs>100000)//but only if it does not become annoying... + QTimer::singleShot(msecs,this,SLOT(relogin())); //get rights MTGetMyRights mrt=MTGetMyRights::query(); QStringList rsl=mrt.getright();