0&&o[2]!="000000000001"){
- var name=o[3];
- name=name.replace(/(\d+);/g,function(){return String.fromCharCode(RegExp.$1);});
- ar.push({id:o[1].replace(/-/g,""),title:name,count:n});
- }
- }
- if(this.showFolders){
- if(ar)obj.folders=ar;
- }
- return obj;
- }
- }else{
- var re=/(.+?)(?:\s\((\d+)\))?<\/a>/g;
- var o;
- this.count=0;
- while ((o = re.exec(aData)) != null){
- if(o[2]=="000000000004"
- ||o[2]=="000000000003"||o[2]=="000000000002")continue;
- if(!this.includeSpam&&o[2]=="000000000005")continue;
- var n=o[4]?parseInt(o[4]):0;
- if(o[2]=="000000000005"){
- if(this.includeSpam==2)this.count+=n;
- }else if(this.inboxOnly){
- if(o[2]=="000000000001")this.count+=n;
- }else this.count+=n;
- if(n>0&&o[2]!="000000000001"){
- var name=o[3];
- name=name.replace(/(\d+);/g,function(){return String.fromCharCode(RegExp.$1);});
- ar.push({id:o[1].replace(/-/g,""),title:name,count:n});
- }
- }
- if(this.showFolders){
- if(ar)obj.folders=ar;
- }
- return obj;
- }
- this.count=-1;
- return obj;
-}
-function getViewURL(aFolder){
- if(aFolder&&this.mailHost){
- if(this.isNew==2)return this.mailHost+"/"+encodeURIComponent(aFolder);
- else if(this.isNew==1)return this.mailHost+"/?fid="+aFolder;
- else if(this.mobile)return this.mailHost+"/m/folders.m?fid="+aFolder;
- var url=this.mailHost+"/mail/InboxLight.aspx?fid="+aFolder
- +"&n="+parseInt(Math.random()*1000000000);
- return url;
- }
- return this.viewURL;
-}
+/***********************************************************
+Live(Hotmail)
+***********************************************************/
+var name="Hotmail";
+var ver="2017-09-10";
+
+var hostString="hotmail.com";
+var supportInboxOnly=true;
+var supportShowFolders=true;
+var supportIncludeSpam=true;
+
+function init(){
+ this.initStage=ST_PRE;
+ this.loginData=["","login","passwd","KMSI=1&LoginOptions=1"];
+ this.dataURL="https://mail.live.com/default.aspx?rru=inbox";
+ this.viewURL="https://mail.live.com/default.aspx?rru=inbox";
+ this.viewDomain="outlook.live.com";
+ if(this.password.length>16)this.password=this.password.substring(0,16);
+
+ this.cookieDomain="live.com";
+
+ this.logoutURL="https://login.live.com/logout.srf";
+}
+function getIconURL(){
+ return "https://outlook.live.com/mail/favicon.ico";
+}
+function checkLogin(aData){
+ switch(this.stage){
+ case ST_CHECK:
+ if(this.cookies){
+ this.stage=ST_DATA;
+ this.setCookies();
+ return true;
+ }
+ this.getHtml(this.viewURL);
+ return false;
+ case ST_CHECK+1:
+ var fnd=aData.match(/urlPost:/);
+ if(!fnd){
+ var reg=new RegExp("\"Address\":\""+this.user.replace(/@/,"\\\\u0040")+"\"","i");
+ var fnd2=aData.match(reg);
+ if(fnd2){//logged in already
+ this.stage=ST_LOGIN_RES;
+ return this.process(aData);
+ }else{
+ var fnd3=aData.match(/clientId:\s*?'(\S+?)'/);
+ var fnd4=aData.match(/window\.clientId/);
+ if(!fnd3&&!fnd4){
+ this.cookieManager.clear();
+ this.stage=this.initStage;
+ this.getHtml(this.logoutURL);
+ return true;
+ }else{
+ if(fnd3)this.viewURL="https://outlook.live.com/mail/";
+ else this.viewURL="https://outlook.live.com/owa/#path=/mail";
+ this.dataURL=["https://outlook.live.com/owa/sessiondata.ashx?appcacheclient=0","appcacheclient=0"];
+ this.getHtml(this.dataURL);
+ return false;
+ }
+ }
+ }else{
+ var fnd=aData.match(/sFT:'(\S+?)'/);
+ if(fnd)this.stage=ST_LOGIN_RES;
+ else this.stage=ST_PRE_RES;
+ return this.process(aData);
+ }
+ case ST_CHECK+2:
+ var f=aData.match(new RegExp('"LogonEmailAddress":"'+this.user+'"',"i"));
+ if(f){
+ this.isNew=2;
+ this.stage=ST_DATA_RES;
+ return this.process(aData);
+ }else{
+ this.viewURL="https://mail.live.com/default.aspx?rru=inbox";
+ this.cookieManager.clear();
+ this.stage=this.initStage;
+ this.getHtml(this.logoutURL);
+ return true;
+ }
+ }
+ this.onError();
+ return true;
+}
+function process(aData,aHttp) {
+if(this.debug)dlog(this.id+"\t"+this.user+"\t"+this.stage,aData);
+ switch(this.stage){
+ case ST_PRE:
+// vs 3 cookieManager code
+ try{
+ var s=this.main.prefBranch.getCharPref("accounts.["+this.id+"#"+this.user+"].cookie");
+ s=s.split("\t");
+ this.cookieManager.addCookies(s[0],s[1]);
+ }catch(e){}
+// END vs 3 cookieManager code
+ this.getHtml("https://mail.live.com");
+ return false;
+ case ST_PRE_RES:
+ var fnd=aData.match(/urlPost:\'([\s\S]+?)\'/);
+ if(fnd){
+ this.loginData[LOGIN_URL]=fnd[1];
+ fnd=aData.match(/PPFT[\s\S]+?value=\"(\S+?)\"/);
+ if(fnd){
+ this.stage=ST_LOGIN;
+ this.getHtml(this.loginData[LOGIN_URL],this.loginData[LOGIN_POST]+"&PPFT="+encodeURIComponent(fnd[1]));
+ return false;
+ }
+ }
+ this.onError();
+ return true;
+ case ST_LOGIN_RES:
+ var fnd=aData.match(/sFT:'(\S+?)'/);
+ if(fnd){//2-step verification
+ var fnd2=aData.match(/urlPost:'(\S+?)'/);
+ var fnd3=aData.match(/data:'([^}]+?)',type:([^}]+?),[^}]*?display:'([^}]+?)',[^}]*?otcSent:([^,]+?),[^}]*?isSADef:true,isVoiceDef:(\S+?)[,}]/);
+ var fnd5=aData.match(/,g:'(\S+?)'/);
+ if(fnd2&&fnd3&&fnd5){
+ this.form=[fnd2[1],
+ "login="+encodeURIComponent(fnd5[1])+"&type="+(fnd3[2]=="10"?19:18)
+ +"&PPFT="+encodeURIComponent(fnd[1])
+ +"&SentProofID="+encodeURIComponent(fnd3[1])];
+ if(fnd3[2]=="10"||fnd3[4]=="true"){//OTP App or Sent
+ this.stage=(ST_LOGIN_RES+6);
+ this.openAuthDialog(this.id,this.user,null);
+ return true;
+ }else{
+ var fnd4=aData.match(//);
+ if(fnd){//Thunderbird(browser check)
+ fnd=fnd[1].replace(/(\d+);/g,function(){return String.fromCharCode(RegExp.$1);});
+ this.stage=ST_LOGIN_RES+4;
+ this.getHtml(fnd);
+ return true;
+ }
+ fnd=aData.match(/"hn":"(\S+?)"/);//Https check
+ if(fnd){
+ this.dataURL="https://"+fnd[1]+"/default.aspx?rru=inbox";
+ this.mailHost="https://"+fnd[1];
+ this.viewURL=this.dataURL;
+ this.stage=ST_DATA;
+ }
+ }
+ break;
+ case ST_LOGIN_RES+4:
+ var fnd=aData.match(/0&&fid!="inbox"){
+ var fname;
+ if(folders[f.ParentFolderId.Id])fname=folders[f.ParentFolderId.Id]+"/"+f.DisplayName;
+ else fname=f.DisplayName;
+ var t={id:fid,title:fname,count:n};
+ ar.push(t);
+ }
+ }
+ if(this.showFolders)obj.folders=ar;
+ }catch(e){}
+ return obj;
+ }
+
+ var reg=new RegExp("\"Address\":\""+this.user.replace(/@/,"\\\\u0040")+"\"","i");
+ var fnd2=aData.match(reg);
+ if(!fnd2)return obj;
+
+ if(this.isNew==1){
+ var fnd=aData.match(/HM.ContainerPoolData\(.+?\{([\s\S]+?)\},\s*\[([\S\s]+?)\]/);
+ if(fnd){
+ var order=fnd[2].split(",");
+ fnd=fnd[1];
+ var re=/Folder\("(\S+?)","(\S+?)".+?"([^"]+?)",(\d+)\)\)/g;
+ var o;
+ this.count=0;
+ while ((o = re.exec(fnd)) != null){
+ if(o[1]=="fldrafts"||o[1]=="flsent"||o[1]=="fltrash")continue;
+ if(!this.includeSpam&&(o[1]=="fljunk"||o[2]=="fljunk"))continue;
+ var n=parseInt(o[4]);
+ if(o[1]=="fljunk"||o[2]=="fljunk"){
+ if(this.includeSpam==2)this.count+=n;
+ }else if(this.inboxOnly){
+ if(o[1]=="flinbox")this.count+=n;
+ }else this.count+=n;
+ if(n>0&&o[1]!="flinbox"){
+ var name=o[3];
+ name=unescape(name.replace(/\\u/g,"%u").replace(/\\x/g,"%"));
+ var i=order.indexOf("\""+o[1]+"\"");
+ var t={id:o[1],title:name,count:n};
+ if(i>=0)ar[i]=t;
+ else ar.push(t);
+ }
+ }
+ if(this.showFolders){
+ if(ar){
+ for(var i=0;i([\s\S]+?)<\/ul>/g);
+ if(fnd){
+ fnd=fnd.toString();
+ var re=/0&&o[2]!="000000000001"){
+ var name=o[3];
+ name=name.replace(/(\d+);/g,function(){return String.fromCharCode(RegExp.$1);});
+ ar.push({id:o[1].replace(/-/g,""),title:name,count:n});
+ }
+ }
+ if(this.showFolders){
+ if(ar)obj.folders=ar;
+ }
+ return obj;
+ }
+ return obj;
+}
+function getViewURL(aFolder){
+ if(aFolder&&this.mailHost){
+ if(this.isNew==2)return this.mailHost+"/"+encodeURIComponent(aFolder);
+ else if(this.isNew==1)return this.mailHost+"/?fid="+aFolder;
+ var url=this.mailHost+"/mail/InboxLight.aspx?fid="+aFolder
+ +"&n="+parseInt(Math.random()*1000000000);
+ return url;
+ }
+ return this.viewURL;
+}
|