Ejemplo n.º 1
0
Archivo: Bot.cs Proyecto: mbsky/bugx
 /// <summary>
 /// Bot_s the on authenticate.
 /// </summary>
 /// <param name="sender">The sender.</param>
 void Bot_OnAuthenticate(object sender)
 {
     if (!string.IsNullOrEmpty(SubscriptionCollection.Instance.Announcement))
     {
         _Bot.Presence(PresenceType.available, SubscriptionCollection.Instance.Announcement, null, 24);
     }
     else
     {
         _Bot.Presence(PresenceType.available, BotVersion, null, 24);
     }
     Message(Texts.InfoApplicationRestart);
 }
Ejemplo n.º 2
0
 internal static void SetChatHover()
 {
     if (ChatClient.IsAuthenticated)
     {
         ChatClient.Presence(CurrentPresence, GetPresence(), null, 0);
     }
 }
Ejemplo n.º 3
0
 private void OnListViewSelectedItemClick(object sender, MouseButtonEventArgs e)
 {
     try {
         var item = (ListViewItem)sender;
         if (item != null)
         {
             var content = (JabberStatus)item.Content;
             if (content != null)
             {
                 if (!((JabberClient != null) && JabberClient.IsAuthenticated))
                 {
                     TryToConnect();
                 }
                 if ((JabberClient != null) && JabberClient.IsAuthenticated)
                 {
                     JabberClient.Presence(content.PresenceType, content.Name, "HelperChat", 0);
                 }
                 popup.IsOpen = false;
             }
         }
     }
     catch (Exception exception) {
         _log.Error(exception);
     }
 }
Ejemplo n.º 4
0
        void OnAuthenticate(object sender)
        {
            // Sender is always the JabberClient.
            JabberClient j = (JabberClient)sender;

            Logger.Info(String.Format("Authentication (User:{0})", j.User));
            //done.Set();
            j.Presence(PresenceType.available, "Рассылка", "Online", 0);
        }
Ejemplo n.º 5
0
        internal static void SetChatHover(string presenceMode)
        {
            if (ChatClient.IsAuthenticated)
            {
                switch (presenceMode)
                {
                case "Online":
                    ChatClient.Presence(CurrentPresence, GetPresence(presenceMode), "chat", 0);
                    break;

                case "Away":
                    ChatClient.Presence(CurrentPresence, GetPresence(presenceMode), "away", 0);
                    break;

                case "Busy":
                    ChatClient.Presence(CurrentPresence, GetPresence(presenceMode), "dnd", 0);
                    break;

                case "ChatMobile":
                    ChatClient.Presence(CurrentPresence, GetPresence(presenceMode), "chatMobile", 0);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            JabberClient jc = new JabberClient();

            jc.OnAuthenticate += new bedrock.ObjectHandler(jc_OnAuthenticate);
            jc.OnAuthError    += new jabber.protocol.ProtocolHandler(jc_OnAuthError);

            jc.User       = "******";
            jc.Password   = "******";
            jc.Port       = 4502;
            jc.Server     = "142.222.45.108";
            jc.Connection = ConnectionType.Socket;

            jc.Connect();
            jc.Presence(jabber.protocol.client.PresenceType.available, "Test", "Test", 0);
        }
Ejemplo n.º 7
0
 private void JabberClientOnAuthenticate(object sender)
 {
     try {
         Application.Current.Dispatcher.Invoke(() => {
             if (_dispatcherTimer != null)
             {
                 _dispatcherTimer.Stop();
             }
             JabberClient.Presence(PresenceType.available, PresenceType.available.ToString(), "", 1);
             statusListView.SelectedIndex = 0;
             userTextBlock.GetBindingExpression(TextBlock.TextProperty).UpdateTarget();
         });
     }
     catch (Exception exception) {
         _log.Error(exception);
     }
 }
Ejemplo n.º 8
0
        public override void SetPresenceStatus(PresenceStatus status,
                                               string message)
        {
            Trace.Call(status, message);

            if (!IsConnected || !_JabberClient.IsAuthenticated)
            {
                return;
            }

            PresenceType?xmppType = null;
            string       xmppShow = null;

            switch (status)
            {
            case PresenceStatus.Online:
                xmppType = PresenceType.available;
                break;

            case PresenceStatus.Away:
                xmppType = PresenceType.available;
                xmppShow = "away";
                break;

            case PresenceStatus.Offline:
                xmppType = PresenceType.unavailable;
                break;
            }
            if (xmppType == null)
            {
                return;
            }

            _JabberClient.Presence(xmppType.Value, message, xmppShow,
                                   _JabberClient.Priority);
        }
Ejemplo n.º 9
0
 internal static void SetChatHover()
 {
     ChatClient.Presence(CurrentPresence, GetPresence(), null, 0);
 }