/// <summary>
        /// Returns needed Visitor.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ISpotterVisitor GetSpotterVisitor(String name)
        {
            if (_visitors.ContainsKey(name))
            {
                return(_visitors[name]);
            }
            else
            {
                switch (name)
                {
                case "Yahoo/GetListedMessages":
                    var yl = new YahooGetListedMessages();
                    _visitors.Add("Yahoo/GetListedMessages", yl);
                    return(yl);

                case "Yahoo/GetDisplayMessage":
                    var yd = new YahooGetDisplayMessage();
                    _visitors.Add("Yahoo/GetDisplayMessage", yd);
                    return(yd);

                case "Seznam/GetNewMessage":
                    var sn = new SeznamGetNewMessage();
                    _visitors.Add("Seznam/GetNewMessage", sn);
                    return(sn);

                case "Seznam/GetListedMessages":
                    var sl = new SeznamGetListedMessages();
                    _visitors.Add("Seznam/GetListedMessages", sl);
                    return(sl);

                case "Seznam/GetDisplayMessage":
                    var sd = new SeznamGetDisplayMessage();
                    _visitors.Add("Seznam/GetDisplayMessage", sd);
                    return(sd);

                default:
                    throw new ArgumentOutOfRangeException("name", "Unknown spotter visitor " + name);
                }
            }
        }
        public object applyOn(SpotterFRPC spotter)
        {
            var list = new List <MailMsg>();

            foreach (var item in spotter.Items)
            {
                var methodResponse = item as FRPCparser.FRPCMethodRespone;
                if (methodResponse == null)
                {
                    continue;
                }

                foreach (var data in methodResponse.Data)
                {
                    var msgStruct = data as FRPCparser.FRPCStruct;
                    if (msgStruct == null)
                    {
                        continue;
                    }

                    foreach (var msgItem in msgStruct.Items)
                    {
                        if (!msgItem.Key.Equals("messages"))
                        {
                            continue;
                        }
                        var msgArray = msgItem.Value as FRPCparser.FRPCArray;
                        if (msgArray == null)
                        {
                            continue;
                        }

                        foreach (var msg in msgArray.Items)
                        {
                            var mailMsg = new MailMsg();
                            var email   = msg as FRPCparser.FRPCStruct;
                            if (email == null)
                            {
                                continue;
                            }
                            foreach (var it in email.Items)
                            {
                                if (it.Key.Equals("subject"))
                                {
                                    var itSubj = it.Value as FRPCparser.FRPCString;
                                    mailMsg.Subject = itSubj?.Value;
                                }
                                else if (it.Key.Equals("abstract"))
                                {
                                    var itBody = it.Value as FRPCparser.FRPCString;
                                    mailMsg.Body = itBody?.Value;
                                }
                                else if (it.Key.Equals("to"))
                                {
                                    var recips = it.Value as FRPCparser.FRPCArray;
                                    if (recips != null)
                                    {
                                        mailMsg.To = SeznamGetNewMessage.GetAddresses(recips);
                                    }
                                }
                                else if (it.Key.Equals("from"))
                                {
                                    var senders = it.Value as FRPCparser.FRPCArray;
                                    if (senders != null)
                                    {
                                        mailMsg.From = SeznamGetNewMessage.GetAddresses(senders);
                                    }
                                }
                                else if (it.Key.Equals("folder"))
                                {
                                    var folder = it.Value as FRPCparser.FRPCInteger8;
                                    if (folder != null)
                                    {
                                        mailMsg.SourceFolder = folder.Value.ToString();
                                    }
                                }
                            }

                            list.Add(mailMsg);
                        }
                    }
                }
            }

            return(list);
        }