Beispiel #1
0
        public override void Execute(Tag data = null)
        {
            if (data == null)
            {
                tags.jabber.client.iq iq = new tags.jabber.client.iq {
                    id = Tag.NextId()
                };
                Tag session = new tags.xmpp_session.session() as Tag;

                iq.from = Manager.Settings.Id;
                iq.to   = Manager.Settings.Id.Server;
                iq.type = tags.jabber.client.iq.typeEnum.set;
                iq.Add(session);

                Manager.Connection.Send(iq);
            }
            else
            {
                if (Manager.Transport == Transport.BoSH)
                {
                    (Manager.Connection as BoSH).StartPolling();
                }

                Manager.State = new RunningState(Manager);

                tags.jabber.client.presence presence = new tags.jabber.client.presence();
                Manager.Connection.Send(presence);
            }
        }
Beispiel #2
0
		public override void Execute (Tag data = null)
		{
			if (data == null)
			{
                tags.jabber.client.iq iq = new tags.jabber.client.iq { id = Tag.NextId() };
                Tag session = new tags.xmpp_session.session() as Tag;

				iq.from = Manager.Settings.Id;
                iq.to = Manager.Settings.Id.Server;
                iq.type = tags.jabber.client.iq.typeEnum.set;
                iq.Add(session);

				Manager.Connection.Send(iq);
			}
			else
			{
                if(Manager.Transport == Transport.BoSH)
                {
                    (Manager.Connection as BoSH).StartPolling();
                }

                Manager.State = new RunningState(Manager);

                tags.jabber.client.presence presence = new tags.jabber.client.presence();
                Manager.Connection.Send(presence);
			}
		}
Beispiel #3
0
        public override void Execute(Tag data = null)
        {
            if (data == null)
            {
                tags.xmpp_bind.bind   bindMsg = new tags.xmpp_bind.bind();
                tags.jabber.client.iq iqMsg   = new tags.jabber.client.iq {
                    id = Tag.NextId()
                };

                if (Manager.Settings.Id.Resource != null)
                {
                    Tag res = new tags.xmpp_bind.resource() as Tag;
                    res.Value = Manager.Settings.Id.Resource;
                    bindMsg.Add(res);
                }

                iqMsg.type = tags.jabber.client.iq.typeEnum.set;
                iqMsg.Add(bindMsg);

                Manager.Connection.Send(iqMsg);
            }
            else
            {
                tags.jabber.client.iq iq   = data as tags.jabber.client.iq;
                tags.xmpp_bind.bind   bind = null;
                if (iq != null)
                {
                    if (iq.type == tags.jabber.client.iq.typeEnum.error)
                    {
                        var e = iq.errorElements.First();
                        if (e != null)
                        {
                            Manager.Events.Error(this, ErrorType.BindingToResourceFailed, ErrorPolicyType.Deactivate, e.Value);
                        }
                    }
                    bind = iq.Element <tags.xmpp_bind.bind>(tags.xmpp_bind.Namespace.bind);
                }

                if (bind != null)
                {
                    tags.xmpp_bind.jid jid = bind.jid;
                    if (jid != null)
                    {
                        Manager.Settings.Id = jid.JID;
                    }
                }

#if DEBUG
                Manager.Events.LogMessage(this, LogType.Info, "Bind success, JID is now: {0}", Manager.Settings.Id);
#endif
                Manager.Events.Receive(this, data);
                Manager.Events.ResourceBound(this, Manager.Settings.Id.ToString());

                Manager.State = new SessionState(Manager);
                Manager.State.Execute();
            }
        }
Beispiel #4
0
		public override void Execute(Tag data = null)
		{
			if (data == null)
			{
                tags.xmpp_bind.bind bindMsg = new tags.xmpp_bind.bind();
                tags.jabber.client.iq iqMsg = new tags.jabber.client.iq { id = Tag.NextId() };
                
                if (Manager.Settings.Id.Resource != null)
				{
                    Tag res = new tags.xmpp_bind.resource() as Tag;
                    res.Value = Manager.Settings.Id.Resource;
					bindMsg.Add(res);
				}

                iqMsg.type = tags.jabber.client.iq.typeEnum.set;
				iqMsg.Add(bindMsg);

                Manager.Connection.Send(iqMsg);
			}
			else
			{
                tags.jabber.client.iq iq = data as tags.jabber.client.iq;
                tags.xmpp_bind.bind bind = null;
				if (iq != null)
				{
                    if (iq.type == tags.jabber.client.iq.typeEnum.error)
					{
                        var e = iq.errorElements.First();
						if (e != null)
                            Manager.Events.Error(this, ErrorType.BindingToResourceFailed, ErrorPolicyType.Deactivate, e.Value);
					}
                    bind = iq.Element<tags.xmpp_bind.bind>(tags.xmpp_bind.Namespace.bind);
				}

                if (bind != null)
                {
                    tags.xmpp_bind.jid jid = bind.jid;
                    if (jid != null)
                        Manager.Settings.Id = jid.JID;
                }

#if DEBUG
                Manager.Events.LogMessage(this, LogType.Info, "Bind success, JID is now: {0}", Manager.Settings.Id);
#endif
                Manager.Events.Receive(this, data); 
                Manager.Events.ResourceBound(this, Manager.Settings.Id.ToString());

                Manager.State = new SessionState(Manager);
				Manager.State.Execute();
			}
		}
Beispiel #5
0
		public override void Execute (Tag data = null)
		{
			if (data == null)
			{
                tags.jabber.client.iq iq = new tags.jabber.client.iq();
                Tag session = new tags.xmpp_session.session() as Tag;

				iq.from = Manager.Settings.Id;
                iq.to = Manager.Settings.Id.Server;
                iq.type = tags.jabber.client.iq.typeEnum.set;
                iq.Add(session);

				Manager.Connection.Send(iq);
			}
			else
			{
                tags.jabber.client.presence presence = new tags.jabber.client.presence();
                Manager.Connection.Send(presence);

				Manager.State = new RunningState(Manager);
			}
		}
Beispiel #6
0
        public override void Execute(Tag data = null)
        {
            if (data == null)
            {
                tags.jabber.client.iq iq = new tags.jabber.client.iq();
                Tag session = new tags.xmpp_session.session() as Tag;

                iq.from = Manager.Settings.Id;
                iq.to   = Manager.Settings.Id.Server;
                iq.type = tags.jabber.client.iq.typeEnum.set;
                iq.Add(session);

                Manager.Connection.Send(iq);
            }
            else
            {
                tags.jabber.client.presence presence = new tags.jabber.client.presence();
                Manager.Connection.Send(presence);

                Manager.State = new RunningState(Manager);
            }
        }