コード例 #1
0
        private void OnRequestResult(object sender, IQ iq, object data)
        {
            if (iq.Error != null)
            {
                EventError eventError = new EventError("Request for bookmarks on server failed", iq.Error);
                Events.Instance.OnEvent(this, eventError);
            }
            else if (iq.Type == IqType.result)
            {
                Private privateData = iq.Query as Private;

                if (privateData != null && privateData.Storage != null)
                {
                    Conference[] conferences = privateData.Storage.GetConferences();

                    lock (MucMarks.Instance._syncObject)
                    {
                        MucMarks.Instance.Clear();

                        foreach (Conference conference in conferences)
                        {
                            MucMarks.Instance.AddBookmark(conference);
                        }
                    }
                }
            }
        }
コード例 #2
0
 private void OnStoreResult(object sender, IQ iq, object data)
 {
     if (iq.Error != null)
     {
         EventError eventError = new EventError("Saving for bookmarks on server failed", iq.Error);
         Events.Instance.OnEvent(this, eventError);
     }
 }
コード例 #3
0
        public static void SaveError(EventError error)
        {
            try
            {
                Dictionary<string, object> values = error.GetData();

                Insert(values, "Error", false, _connection);
            }

            catch
            {
                // NOT here
                // Events.Instance.OnEvent(e, new EventError(e.Message, null));
            }
        }
コード例 #4
0
ファイル: VCard.cs プロジェクト: erpframework/xeus-messenger2
        public bool SetImage(BitmapImage bitmapImage)
        {
            string base64 = Storage.Base64File(bitmapImage.UriSource.LocalPath);

            if (base64 != null)
            {
                if (base64.Length > Settings.Default.UI_MaxAvatarKb * 1024)
                {
                    EventError eventError = new EventError(string.Format("Avatar size must not exceed {0} kB", Settings.Default.UI_MaxAvatarKb), null);
                    Events.Instance.OnEvent(this, eventError);
                }
                else
                {
                    Photo photo = new Photo();
                    photo.Type = TextUtil.GetImageType(bitmapImage.UriSource.LocalPath);
                    photo.SetTag("BINVAL", base64);

                    _vcard.Photo = photo;

                    Storage.CacheVCard(_vcard, Jid.Bare);

                    return true;
                }
            }

            return false;
        }
コード例 #5
0
        private void OnPresence(Presence presence)
        {
            if (presence.MucUser != null)
            {
                return;
            }

            if (presence.Error != null)
            {
                EventError eventError = new EventError(string.Format("Presence error from {0}", presence.From),
                                                       presence.Error);
                Events.Instance.OnEvent(this, eventError);
            }
            else
            {
                Capabilities capabilities = presence.SelectSingleElement(typeof (Capabilities)) as Capabilities;

                switch (presence.Type)
                {
                    case PresenceType.subscribe:
                    case PresenceType.subscribed:
                    case PresenceType.unsubscribe:
                    case PresenceType.unsubscribed:
                        {
                            OnSubscribePresence(presence);
                            break;
                        }
                    default:
                        {
                            OnContactPresence(presence, capabilities);
                            break;
                        }
                }
            }
        }