public bool ImportContacts()
        {
            String adrUrl,htmlResponse,referer;
            names = new ArrayList();
            emails = new ArrayList();
            int count=0,counter;
            String tmpName = "";
            String tmpEmail = "";

            adrUrl = "http://"+this.dediurl+".libero.it/"+this.addressBookURL;
            referer="http://"+this.dediurl+".libero.it/email.php";

            htmlResponse = httpUtils.GetHttpResponse(adrUrl,true,"",this.dediurl);

            String id=this.addressBookURL.Substring(this.addressBookURL.IndexOf("?ID=")+"?ID=".Length);
            id = id.Substring(0,id.IndexOf("&"));
            String addurl="http://"+this.dediurl+".libero.it/cgi-bin/abook.cgi";
            referer="http://"+this.dediurl+".libero.it/cgi-bin/toolbar.cgi?ID="+id;
            String postString="ID="+id+"&Act_ABook=1&DIRECT=1&Template=&Language=&ab_list_mode=1&C_Folder=";

            htmlResponse = httpUtils.GetHttpResponse(addurl,true,postString,referer);

            String form = htmlResponse.Substring(htmlResponse.IndexOf("<form name=\"abookForm\""));
            form = form.Substring(0,form.IndexOf("</form>"));
            String hidden = StringUtils.HiddenFields(form);
            hidden = hidden.Replace("&SUB_DUMMY=0","&AB_PATTERN=");
            postString = hidden+"&Act_AB_Export=export";
            String exprturl = "http://"+this.dediurl+".libero.it/cgi-bin/abook.cgi";

            htmlResponse = httpUtils.GetHttpResponse(exprturl,true,postString,addurl);

            form = htmlResponse.Substring(htmlResponse.IndexOf("<form ACTION=\""));
            form = form.Substring(0,form.IndexOf("</form>"));
            String hiddenfld = StringUtils.HiddenFields(form);
            hiddenfld = hiddenfld.Replace("&SUB_DUMMY=0","");
            hiddenfld = hiddenfld.Replace("AB_Export_Type=Export_Ldif","AB_Export_Type=Export_Csv");
            postString = hiddenfld+"&Act_AB_Export=1&AB_PATTERN=&exp=";

            htmlResponse = httpUtils.GetHttpResponse(exprturl,true,postString,addurl);

            String contacts=htmlResponse.Substring(htmlResponse.IndexOf("<a href=\"")+"<a href=\"".Length);
            contacts = contacts.Substring(0,contacts.IndexOf("\""));
            contacts = "http://"+this.dediurl+".libero.it"+contacts;

            htmlResponse = httpUtils.GetHttpResponse(contacts,true,"",addurl);

            System.IO.MemoryStream strm = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlResponse));
            System.IO.StreamReader str = new System.IO.StreamReader(strm);
            CSVReader csv = new CSVReader(str);
            string[] fields;
            string[] temp_line;

            while ((fields = csv.GetCSVLine()) != null)
            {
                //					if(fields.Length < 5)
                //						continue;
                temp_line=new string[100];
                //if(fields.Length< 81)
                //{
                //	fields = StringUtils.Split(fields[0].ToString(),";");
                //}
                if(count!=0)
                {
                    counter=0;
                    foreach (string field in fields)
                    {
                        temp_line[counter]=field;
                        counter++;
                    }

                    tmpName=(temp_line[4]=="") ? temp_line[3]:temp_line[0];
                    tmpName=(temp_line[0]=="" && temp_line[1]=="") ? temp_line[3]:((temp_line[0]!="" && temp_line[1]!="") ? temp_line[0]+" "+temp_line[2]+" "+temp_line[1]:tmpName) ;
                    tmpEmail = (temp_line[5]!="") ? temp_line[5]:(((temp_line[12]!="")? temp_line[12]:((temp_line[13]!="") ? temp_line[13]:"")));

                    if(tmpEmail!=null)
                    {
                        if(tmpEmail.IndexOf(":")!=-1)
                        {
                            tmpEmail=tmpEmail.Substring(tmpEmail.IndexOf(":")+1);

                        }
                    }

                if(tmpEmail!=null)
                {
                    tmpName =  tmpName.Replace("\""," ").Trim();
                    tmpEmail = tmpEmail.Replace("\""," ").Trim();

                    if(StringUtils.IsValidEmail(tmpEmail) && tmpName=="")
                    {
                        tmpName=tmpEmail.Substring(0,tmpEmail.IndexOf("@"));
                    }

                    if(StringUtils.IsValidEmail(tmpEmail))
                    {
                        names.Add(tmpName);
                        emails.Add(tmpEmail);
                    }
                }
            }
            count++;
            }
            if(names.Count>0)
                return true;
            else
                return false;
        }
        public bool ImportContacts()
        {
            this.names = new ArrayList();
            this.emails = new ArrayList();

            addressBookURL=domain+".indiatimes.com/service/home/~/Contacts?auth=co&fmt=csv";

            try
            {
                htmlResponse = httpUtils.GetHttpResponse(this.addressBookURL,false);

                System.IO.MemoryStream strm = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlResponse));
                System.IO.StreamReader str = new System.IO.StreamReader(strm);
                int count=0,counter;
                addresses b=new addresses();
                String temp_name="",temp_email="";
                CSVReader csv = new CSVReader(str);
                string[] fields;
                string[] temp_line;
                while ((fields = csv.GetCSVLine()) != null)
                {
                    temp_line=new string[100];
                    if(count!=0)
                    {
                        counter=0;
                        foreach (string field in fields)
                        {
                            temp_line[counter]=field;
                            counter++;
                        }
                        if(fields.Length==5)
                        {
                            temp_name=temp_line[2]+" "+temp_line[3];
                            temp_email=temp_line[0];
                        }
                        else
                        {
                            temp_name=(temp_line[5]+" "+temp_line[10]+" "+temp_line[9]);
                            temp_email=(temp_line[1]!="") ? temp_line[1]:(((temp_line[2]!="")? temp_line[2]:((temp_line[3]!="") ? temp_line[3]:"")));
                        }

                        if(temp_email!=null && temp_name==null)
                        {
                            temp_name=temp_email.Substring(0,temp_email.IndexOf("@"));
                        }
                        if(temp_email!=null && temp_name!=null)
                        {
                            names.Add(temp_name);
                            emails.Add(temp_email);
                        }
                    }
                    count++;
                }
                if(names.Count>0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch(WebException ex)
            {
                Logout();
                return false;
            }
        }
        public bool ImportContacts()
        {
            names = new ArrayList();
            emails = new ArrayList();
            String tmpName = "";
            String tmpEmail = "";
            int count=0,counter;
            String frm = "";
            String strHidden = "";
            Random r = new Random();
            String number = r.Next(1,9999).ToString("0000");
            addressBookURL ="http://"+this.domain+"/coremail/fcg/ldvcapp?funcid=xportadd&sid="+this.sid+"&"+number;
            String exportUrl = "http://"+this.domain+"/coremail/fcg/ldvcapp";
            try
            {
                htmlResponse = httpUtils.GetHttpResponse(addressBookURL,false,"",addressBookURL);
                if(htmlResponse.IndexOf("<form name=\"outport\"")> -1)
                {
                    frm = htmlResponse.Substring(htmlResponse.IndexOf("<form name=\"outport\""));
                    frm = frm.Substring(0,frm.IndexOf("</form"));
                    strHidden = StringUtils.HiddenFields(frm);
                    postString = strHidden+"&outformat=8&outport.x=%BF%AA%CA%BC%B5%BC%B3%F6";
                    htmlResponse = httpUtils.GetHttpResponse(exportUrl,false,postString,addressBookURL);
                    System.IO.MemoryStream strm = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlResponse));
                    System.IO.StreamReader str = new System.IO.StreamReader(strm);
                    CSVReader csv = new CSVReader(str);
                    string[] fields;
                    string[] temp_line;
                    while ((fields = csv.GetCSVLine()) != null)
                    {
                        //					if(fields.Length < 5)
                        //						continue;
                        temp_line=new string[1024];

                        if(count!=0)
                        {
                            counter=0;
                            foreach (string field in fields)
                            {
                                temp_line[counter]=field;
                                counter++;
                            }
                            tmpName=temp_line[4];
                            tmpEmail = temp_line[3];
                            if(StringUtils.IsValidEmail(tmpEmail) && tmpName=="")
                            {
                                tmpName=tmpEmail.Substring(0,tmpEmail.IndexOf("@"));
                            }

                            if(StringUtils.IsValidEmail(tmpEmail))
                            {
                                names.Add(tmpName);
                                emails.Add(tmpEmail);
                            }
                        }
                        count++;
                    }
                }
                else
                {

                }
                if(names.Count>0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

            catch(WebException ex)
            {
                Logout();
                return false;
            }
        }
Exemplo n.º 4
0
        public bool ImportContacts()
        {
            names = new ArrayList();
            emails = new ArrayList();
            String tmpName = "";
            String tmpEmail = "";
            int count=0,counter;
            addresses b=new addresses();
            addressBookURL = "https://www.plaxo.com/export";
            String exportUrl = "https://www.plaxo.com/export/plaxo_ab_yahoo.csv";
            try
            {
                htmlResponse = httpUtils.GetHttpResponse(addressBookURL,false);
                this.strFrm = htmlResponse.Substring(htmlResponse.IndexOf("<form"));
                this.strFrm = this.strFrm.Substring(0,this.strFrm.IndexOf("</form>"));
                this.strHidden = StringUtils.HiddenFields(this.strFrm);
                postString = strHidden+"&paths.0.checked=on&type=Y&x=36&y=19";
                reffer = addressBookURL;
                htmlResponse = httpUtils.GetHttpResponse(exportUrl,false,postString,reffer);
                System.IO.MemoryStream strm = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlResponse));
                System.IO.StreamReader str = new System.IO.StreamReader(strm);
                CSVReader csv = new CSVReader(str);
                string[] fields;
                string[] temp_line;
                while ((fields = csv.GetCSVLine()) != null)
                {
                    if(fields.Length < 5)
                        continue;
                    temp_line=new string[1024];

                    if(count!=0)
                    {
                        counter=0;
                        foreach (string field in fields)
                        {
                            temp_line[counter]=field;

                            counter++;

                        }

                        tmpName=(temp_line[0]=="") ? temp_line[1]:temp_line[0];
                        tmpName=(temp_line[0]=="" && temp_line[1]=="") ? temp_line[2]:((temp_line[2]!="" && temp_line[0]!="") ? temp_line[0]+" "+temp_line[1]+" "+temp_line[2]:tmpName) ;

                        tmpEmail = (temp_line[3]=="") ? temp_line[4]:temp_line[3];
                        if(StringUtils.IsValidEmail(tmpEmail) && tmpName=="")
                        {
                            tmpName=tmpEmail.Substring(0,tmpEmail.IndexOf("@"));
                        }

                        if(StringUtils.IsValidEmail(tmpEmail))
                        {
                            names.Add(tmpName);
                            emails.Add(tmpEmail);
                        }
                    }
                    count++;
                }
                if(names.Count>0)
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch(Exception e)
            {
                Dispose();
                return false;
            }
        }
Exemplo n.º 5
0
        public bool ImportContacts()
        {
            this.names = new ArrayList();
            this.emails = new ArrayList();

            try
            {

                addressBookURL="http://ksiazka-adresowa.wp.pl/import-export.html";
                htmlResponse=httpUtils.GetHttpResponse(addressBookURL,false);
                String post="gr_id=0&program=yh&x=29&y=3";
                String exportUrl="http://ksiazka-adresowa.wp.pl/csv.html";
                String addressresponse=httpUtils.GetHttpResponse(exportUrl,false,post,addressBookURL,"");

                System.IO.MemoryStream strm = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(addressresponse));
                System.IO.StreamReader str = new System.IO.StreamReader(strm);
                int count=0,counter;
                addresses b=new addresses();
                String temp_name="",temp_email="";
                CSVReader csv = new CSVReader(str);
                string[] fields;
                string[] temp_line;
                while ((fields = csv.GetCSVLine()) != null)
                {
                    temp_line=new string[100];
                    if(count!=0)
                    {
                        counter=0;
                        foreach (string field in fields)
                        {
                            temp_line[counter]=field;
                            counter++;
                        }
                        temp_name=(temp_line[0]+" "+temp_line[1]+" "+temp_line[4]);

                        temp_email=(temp_line[2]!="") ? temp_line[2]:(((temp_line[22]!="")? temp_line[22]:""));
                        if(temp_email!=null && temp_name==null)
                        {
                            temp_name=temp_email.Substring(0,temp_email.IndexOf("@"));
                        }
                        if(temp_email!=null && temp_name!=null)
                        {
                            names.Add(temp_name);
                            emails.Add(temp_email);
                        }
                    }
                    count++;
                }
                if(names.Count>0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

            catch(WebException ex)
            {
                Logout();
                return false;
            }
        }
Exemplo n.º 6
0
        public bool ImportContacts()
        {
            names = new ArrayList();
            emails = new ArrayList();
            String tmpName = "";
            String tmpEmail = "";
            int count=0,counter;

            addressBookURL = "http://"+this.domain+".sinamail.sina.com.cn/cgismarty/addr_export.php";
            try
            {
                htmlResponse = httpUtils.GetHttpResponse(addressBookURL,false);
                System.IO.MemoryStream strm = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlResponse));
                System.IO.StreamReader str = new System.IO.StreamReader(strm);
                CSVReader csv = new CSVReader(str);
                string[] fields;
                string[] temp_line;
                while ((fields = csv.GetCSVLine()) != null)
                {
                    //					if(fields.Length < 5)
                    //						continue;
                    temp_line=new string[1024];

                    if(count!=0)
                    {
                        counter=0;
                        foreach (string field in fields)
                        {
                            temp_line[counter]=field;
                            counter++;
                        }
                        tmpName=temp_line[0];
                        tmpEmail = temp_line[3];
                        if(StringUtils.IsValidEmail(tmpEmail) && tmpName=="")
                        {
                            tmpName=tmpEmail.Substring(0,tmpEmail.IndexOf("@"));
                        }

                        if(StringUtils.IsValidEmail(tmpEmail))
                        {
                            names.Add(tmpName);
                            emails.Add(tmpEmail);
                        }
                    }
                    count++;
                }
                if(names.Count>0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch(WebException ex)
            {
                Logout();
                return false;
            }
        }
        public bool ImportContacts()
        {
            String adrUrl,htmlResponse;
            names = new ArrayList();
            emails = new ArrayList();
            adrUrl = "http://mail01.mail.com/scripts/addr/addressbook.cgi?showaddressbook=1";

            htmlResponse = httpUtils.GetHttpResponse(adrUrl,false);
            String tempStr="<a href=\"http://mail01.mail.com/scripts/addr/external.cgi?.ob=";
            String ob="";
            if(htmlResponse.IndexOf(tempStr)!=-1)
            {
                ob=htmlResponse.Substring(htmlResponse.IndexOf(tempStr)+tempStr.Length);
                ob=ob.Substring(0,ob.IndexOf("&gab"));
            }

            String exportUrl="http://mail01.mail.com/scripts/addr/external.cgi?.ob="+ob+"&gab=1";
            String postStrig="showexport=showexport&action=export&format=csv";
            htmlResponse=httpUtils.GetHttpResponse(exportUrl,false,postStrig,"");
            System.IO.MemoryStream strm = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlResponse));
            System.IO.StreamReader str = new System.IO.StreamReader(strm);

            int count=0,counter;
            addresses b=new addresses();
            string temp_name="",temp_email="";

            CSVReader csv = new CSVReader(str);

            string[] fields;
            string[] temp_line;
            while ((fields = csv.GetCSVLine()) != null)
            {
                temp_line=new string[100];

                if(count!=0)
                {
                    counter=0;
                    foreach (string field in fields)
                    {
                        temp_line[counter]=field;

                        counter++;

                    }

                    temp_name=(temp_line[2]=="") ? temp_line[0]:temp_line[2];
                    temp_name=(temp_line[2]=="" && temp_line[0]=="") ? temp_line[3]:((temp_line[2]!="" && temp_line[0]!="") ? temp_line[2]+", "+temp_line[0]+" "+temp_line[1]:temp_name) ;

                    temp_email=(temp_line[4]!="") ? temp_line[4]:(((temp_line[12]!="")? temp_line[12]:((temp_line[13]!="") ? temp_line[13]:"")));

                    if(StringUtils.IsValidEmail(temp_email) && temp_name=="")
                    {
                        temp_name=temp_email.Substring(0,temp_email.IndexOf("@"));
                    }

                    if(StringUtils.IsValidEmail(temp_email))
                    {
                        names.Add(temp_name);
                        emails.Add(temp_email);
                    }
                }
                count++;
            }

            if(names.Count>0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        //Parse yahoo csv address file
        private void yahoo_parser(StreamReader str)
        {
            int count=0,counter,ncount=0;
            addresses b=new addresses();
            string temp_name="",temp_email="";

            CSVReader csv = new CSVReader(str);

            string[] fields;
            string[] temp_line;
            while ((fields = csv.GetCSVLine()) != null)
            {
                temp_line=new string[100];

                if(count!=0)
                {
                    counter=0;
                    foreach (string field in fields)
                    {
                        temp_line[counter]=field;

                        counter++;

                    }

                    temp_name=(temp_line[2]=="") ? temp_line[0]:temp_line[2];
                    temp_name=(temp_line[2]=="" && temp_line[0]=="") ? temp_line[7]:((temp_line[2]!="" && temp_line[0]!="") ? temp_line[2]+", "+temp_line[0]+" "+temp_line[1]:temp_name) ;

                    temp_email=(temp_line[4]!="") ? temp_line[4]:temp_line[7]+"@yahoo.com";
                    try
                    {
                        if(temp_email.IndexOf(':')!=-1)
                            temp_email=temp_email.Substring(temp_email.IndexOf(':')+1);
                    }
                    catch
                    {}
                    if(temp_email!=null && temp_email!="@yahoo.com")
                        b.Add(temp_name+"<html></tr></html>"+temp_email);
                    else
                        ncount++;

                }
                count++;
            }

            count=count-ncount;

            this.emailArray=new string[count-1];
            this.nameArray=new string[count-1];
            count=0;

            Regex r=new Regex(@"\s*<html></tr></html>\s*");

            string[] addressD;
            foreach(string s in b)
            {
                addressD=r.Split(s);

                nameArray[count]=addressD[0];
                emailArray[count]=addressD[1];
                count++;

            }
        }