/// <summary>
        /// Initializes a new instance of the XmppIm class.
        /// </summary>
        /// <param name="im">A reference to the XmppIm instance on whose behalf this
        /// instance is created.</param>
        public ServiceDiscovery(XmppIm im)
            : base(im)
        {
            var name = "Xmpp";

            Identity = new Identity("client", "pc", name);
        }
        public SoftwareVersion(XmppIm im) : base(im)
        {
            Attribute attribute = (Attribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), true)[0];
            string    name      = (attribute != null) ? ((AssemblyProductAttribute)attribute).Product : "S22.Xmpp";
            string    version   = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            this.Version = new VersionInformation(name, version, Environment.OSVersion.ToString());
        }
 /// <summary>
 /// Initializes a new instance of the Socks5Bytestreams class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public Socks5Bytestreams(XmppIm im)
     : base(im)
 {
     StunServer   = new DnsEndPoint("stun.l.google.com", 19302);
     ProxyAllowed = true;
     Proxies      = new HashSet <Streamhost>();
     UseUPnP      = true;
 }
        public ServiceDiscovery(XmppIm im) : base(im)
        {
            this.cache = new Dictionary <Jid, IEnumerable <Extension> >();
            Attribute attribute = (Attribute)Assembly.GetExecutingAssembly().GetCustomAttributes(true)[0];
            string    name      = "S22.Xmpp";

            this.Identity = new S22.Xmpp.Extensions.Identity("client", "pc", name);
        }
        /// <summary>
        /// Initializes a new instance of the XmppIm class.
        /// </summary>
        /// <param name="im">A reference to the XmppIm instance on whose behalf this
        /// instance is created.</param>
        public ServiceDiscovery(XmppIm im)
            : base(im)
        {
            Attribute attr = typeof(ServiceDiscovery).Assembly.GetCustomAttribute(typeof(AssemblyProductAttribute));
            string    name = attr != null ? ((AssemblyProductAttribute)attr).Product :
                             "S22.Xmpp";

            Identity = new Identity("client", "pc", name);
        }
Beispiel #6
0
 public Socks5Bytestreams(XmppIm im) : base(im)
 {
     this.serverPortFrom = 0xcb20;
     this.serverPortTo   = 0xcb84;
     this.StunServer     = new DnsEndPoint("stun.l.google.com", 0x4b66);
     this.ProxyAllowed   = true;
     this.Proxies        = new HashSet <Streamhost>();
     this.UseUPnP        = true;
 }
Beispiel #7
0
 public void SendMessage(XmppIm Client, string To, string Message)
 {
     if (encrypt)
     {
         Client.SendMessage(To, encryption.EncryptString(Message, Password));
     }
     else
     {
         Client.SendMessage(To, Message);
     }
 }
Beispiel #8
0
        /// <summary>
        /// Initializes a new instance of the SoftwareVersion class.
        /// </summary>
        /// <param name="im">A reference to the XmppIm instance on whose behalf this
        /// instance is created.</param>
        public SoftwareVersion(XmppIm im)
            : base(im)
        {
            string name = "Xmpp";

            var assembly = typeof(SoftwareVersion).GetTypeInfo().Assembly;
            // In some PCL profiles the above line is: var assembly = typeof(MyType).Assembly;
            var    assemblyName = new AssemblyName(assembly.FullName);
            string version      = assemblyName.Version.Major + "." + assemblyName.Version.Minor;

            Version = new VersionInformation(name, version);
        }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the SoftwareVersion class.
        /// </summary>
        /// <param name="im">A reference to the XmppIm instance on whose behalf this
        /// instance is created.</param>
        public SoftwareVersion(XmppIm im)
            : base(im)
        {
            // Collect name and version attributes from the assembly's metadata.
            Attribute attr = Assembly.GetExecutingAssembly().
                             GetCustomAttribute(typeof(AssemblyProductAttribute));
            string name = attr != null ? ((AssemblyProductAttribute)attr).Product :
                          "S22.Xmpp";
            string version = Assembly.GetExecutingAssembly().GetName().
                             Version.ToString();

            Version = new VersionInformation(name, version,
                                             Environment.OSVersion.ToString());
        }
Beispiel #10
0
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         this.disposed = true;
         if (disposing)
         {
             if (this.im != null)
             {
                 this.im.Close();
             }
             this.im = null;
         }
     }
 }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the SoftwareVersion class.
        /// </summary>
        /// <param name="im">A reference to the XmppIm instance on whose behalf this
        /// instance is created.</param>
        public SoftwareVersion(XmppIm im)
            : base(im)
        {
            // Collect name and version attributes from the assembly's metadata.
            Attribute attr = Assembly.GetEntryAssembly().
                             GetCustomAttribute(typeof(AssemblyProductAttribute));
            string name = attr != null ? ((AssemblyProductAttribute)attr).Product :
                          "Sharp.Xmpp";
            string version = Assembly.GetEntryAssembly().GetName().
                             Version.ToString();

            string os = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "Linux" :
                        RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "OSX" :
                        "Windows";

            Version = new VersionInformation(name, version, os);
        }
        public void XMPPConnect(string username, string password)
        {
            string hostname = username.Split('@')[1];

            username = username.Split('@')[0];

            int port = 5222; bool tls = true;
            RemoteCertificateValidationCallback validate = null;

            im          = new XmppIm(hostname, username, password, port, tls, validate);
            im.Message += OnNewMessage;

            try
            {
                im.Connect();
            }
            catch (XmppException e)
            {
                Console.Write(e);
                return;
            }
            catch (ObjectDisposedException e)
            {
                Console.Write(e);
                return;
            }
            catch (System.IO.IOException e)
            {
                Console.Write(e);
                return;
            }
            catch (System.Security.Authentication.AuthenticationException e)
            {
                Login lgn = new ChatApplication.Login(this);
                lgn.setError();
                lgn.Show();
                Console.Write(e);
                return;
            }

            this.Show();
            lblUsername.Text = GetBareJid(im.Jid);

            BindRoster();
        }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the EntityCapabilities class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public EntityCapabilities(XmppIm im)
     : base(im)
 {
 }
Beispiel #14
0
 public StreamInitiation(XmppIm im) : base(im)
 {
     this.profiles = new Dictionary <string, Func <Jid, XmlElement, XmlElement> >();
 }
Beispiel #15
0
 public EntityTime(XmppIm im) : base(im)
 {
 }
 public ServiceAdministration(XmppIm im)
     : base(im)
 {
 }
Beispiel #17
0
 /// <summary>
 /// Initializes a new instance of the XmppClient class.
 /// </summary>
 /// <param name="hostname">The hostname of the XMPP server to connect to.</param>
 /// <param name="port">The port number of the XMPP service of the server.</param>
 /// <param name="tls">If true the session will be TLS/SSL-encrypted if the server
 /// supports TLS/SSL-encryption.</param>
 /// <param name="validate">A delegate used for verifying the remote Secure Sockets
 /// Layer (SSL) certificate which is used for authentication. Can be null if not
 /// needed.</param>
 /// <exception cref="ArgumentNullException">The hostname parameter is
 /// null.</exception>
 /// <exception cref="ArgumentException">The hostname parameter is the empty
 /// string.</exception>
 /// <exception cref="ArgumentOutOfRangeException">The value of the port parameter
 /// is not a valid port number.</exception>
 /// <remarks>Use this constructor if you wish to register an XMPP account using
 /// the in-band account registration process supported by some servers.</remarks>
 public XmppClient(string hostname, int port = 5222, bool tls = true,
     RemoteCertificateValidationCallback validate = null)
 {
     im = new XmppIm(hostname, port, tls, validate);
     LoadExtensions();
 }
 public MessageArchiving(XmppIm im)
     : base(im)
 {
 }
Beispiel #19
0
 /// <summary>
 /// Initializes a new instance of the FeatureNegotiation class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public FeatureNegotiation(XmppIm im)
     : base(im)
 {
 }
Beispiel #20
0
 /// <summary>
 /// Releases all resources used by the current instance of the XmppClient
 /// class, optionally disposing of managed resource.
 /// </summary>
 /// <param name="disposing">true to dispose of managed resources, otherwise
 /// false.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (!disposed)
     {
         // Indicate that the instance has been disposed.
         disposed = true;
         // Get rid of managed resources.
         if (disposing)
         {
             if (im != null)
                 im.Close();
             im = null;
         }
         // Get rid of unmanaged resources.
     }
 }
Beispiel #21
0
 /// <summary>
 /// Initializes a new instance of the UserMood class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public UserMood(XmppIm im)
     : base(im)
 {
 }
 /// <summary>
 /// Initializes a new instance of the FeatureNegotiation class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public FeatureNegotiation(XmppIm im)
     : base(im)
 {
 }
Beispiel #23
0
		/// <summary>
		/// Initializes a new instance of the Attention class.
		/// </summary>
		/// <param name="im">A reference to the XmppIm instance on whose behalf this
		/// instance is created.</param>
		public Attention(XmppIm im)
			: base(im) {
		}
Beispiel #24
0
		/// <summary>
		/// Initializes a new instance of the UserTune class.
		/// </summary>
		/// <param name="im">A reference to the XmppIm instance on whose behalf this
		/// instance is created.</param>
		public UserTune(XmppIm im)
			: base(im) {
		}
 /// <summary>
 /// Initializes a new instance of the ServerIpCheck class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public ServerIpCheck(XmppIm im)
     : base(im)
 {
 }
Beispiel #26
0
		/// <summary>
		/// Initializes a new instance of the DataForms class.
		/// </summary>
		/// <param name="im">A reference to the XmppIm instance on whose behalf this
		/// instance is created.</param>
		public DataForms(XmppIm im)
			: base(im) {
		}
Beispiel #27
0
 /// <summary>
 /// Initializes a new instance of the XmppClient class.
 /// </summary>
 /// <param name="hostname">The hostname of the XMPP server to connect to.</param>
 /// <param name="port">The port number of the XMPP service of the server.</param>
 /// <param name="tls">If true the session will be TLS/SSL-encrypted if the server
 /// supports TLS/SSL-encryption.</param>
 /// <param name="validate">A delegate used for verifying the remote Secure Sockets
 /// Layer (SSL) certificate which is used for authentication. Can be null if not
 /// needed.</param>
 /// <exception cref="ArgumentNullException">The hostname parameter is
 /// null.</exception>
 /// <exception cref="ArgumentException">The hostname parameter is the empty
 /// string.</exception>
 /// <exception cref="ArgumentOutOfRangeException">The value of the port parameter
 /// is not a valid port number.</exception>
 /// <remarks>Use this constructor if you wish to register an XMPP account using
 /// the in-band account registration process supported by some servers.</remarks>
 public XmppClient(string hostname, int port = 5222, Xmpp.Core.TLSMode tls = Core.TLSMode.StartTLS,
     RemoteCertificateValidationCallback validate = null)
 {
     im = new XmppIm(hostname, port, tls, validate);
     LoadExtensions();
 }
Beispiel #28
0
 /// <summary>
 /// Initializes a new instance of the UserMood class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public UserMood(XmppIm im)
     : base(im)
 {
 }
 /// <summary>
 /// Initializes a new instance of the ChatStateNotifications class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public ChatStateNotifications(XmppIm im)
     : base(im)
 {
 }
Beispiel #30
0
 /// <summary>
 /// Initializes a new instance of the CustomIq class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public CustomIqExtension(XmppIm im)
     : base(im)
 {
 }
Beispiel #31
0
 /// <summary>
 /// Initializes a new instance of the StreamManagement class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public StreamManagement(XmppIm im)
     : base(im)
 {
 }
Beispiel #32
0
 /// <summary>
 /// Initializes a new instance of the XmppClient class.
 /// </summary>
 /// <param name="hostname">The hostname of the XMPP server to connect to.</param>
 /// <param name="username">The username with which to authenticate. In XMPP jargon
 /// this is known as the 'node' part of the JID.</param>
 /// <param name="password">The password with which to authenticate.</param>
 /// <param name="port">The port number of the XMPP service of the server.</param>
 /// <param name="tls">If true the session will be TLS/SSL-encrypted if the server
 /// supports TLS/SSL-encryption.</param>
 /// <param name="validate">A delegate used for verifying the remote Secure Sockets
 /// Layer (SSL) certificate which is used for authentication. Can be null if not
 /// needed.</param>
 /// <exception cref="ArgumentNullException">The hostname parameter or the
 /// username parameter or the password parameter is null.</exception>
 /// <exception cref="ArgumentException">The hostname parameter or the username
 /// parameter is the empty string.</exception>
 /// <exception cref="ArgumentOutOfRangeException">The value of the port parameter
 /// is not a valid port number.</exception>
 /// <remarks>Use this constructor if you wish to connect to an XMPP server using
 /// an existing set of user credentials.</remarks>
 public XmppClient(string hostname, string username, string password,
     int port = 5222, bool tls = true, RemoteCertificateValidationCallback validate = null)
 {
     im = new XmppIm(hostname, username, password, port, tls, validate);
     // Initialize the various extension modules.
     LoadExtensions();
 }
Beispiel #33
0
 public MessageCarbons(XmppIm im) :
     base(im)
 {
     ;
 }
Beispiel #34
0
 /// <summary>
 /// Initializes a new instance of the XmppExtension class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf the
 /// extension is being created.</param>
 public XmppExtension(XmppIm im)
 {
     im.ThrowIfNull("im");
     this.IM = im;
 }
Beispiel #35
0
 /// <summary>
 /// Initializes a new instance of the UserTune class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public UserTune(XmppIm im)
     : base(im)
 {
 }
Beispiel #36
0
 /// <summary>
 /// Initializes a new instance of the InBandRegistration class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public InBandRegistration(XmppIm im)
     : base(im)
 {
 }
Beispiel #37
0
		/// <summary>
		/// Initializes a new instance of the UserActivity class.
		/// </summary>
		/// <param name="im">A reference to the XmppIm instance on whose behalf this
		/// instance is created.</param>
		public UserActivity(XmppIm im)
			: base(im) {
		}
 /// <summary>
 /// Initializes a new instance of the ServerIpCheck class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public ServerIpCheck(XmppIm im)
     : base(im)
 {
 }
Beispiel #39
0
 public MessageCarbons(XmppIm im) :
     base(im)
 {
     ;
 }
Beispiel #40
0
 /// <summary>
 /// Initializes a new instance of the XmppExtension class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf the
 /// extension is being created.</param>
 public XmppExtension(XmppIm im)
 {
     im.ThrowIfNull("im");
     this.im = im;
 }
Beispiel #41
0
		/// <summary>
		/// Initializes a new instance of the UserAvatar class.
		/// </summary>
		/// <param name="im">A reference to the XmppIm instance on whose behalf this
		/// instance is created.</param>
		public UserAvatar(XmppIm im)
			: base(im) {
		}
Beispiel #42
0
 /// <summary>
 /// Initializes a new instance of the CustomIq class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public MessageArchiveManagment(XmppIm im)
     : base(im)
 {
 }
 /// <summary>
 /// Initializes a new instance of the SIFileTransfer class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public SIFileTransfer(XmppIm im)
     : base(im)
 {
 }
Beispiel #44
0
 /// <summary>
 /// Initializes a new instance of the UserActivity class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public UserActivity(XmppIm im)
     : base(im)
 {
 }
 /// <summary>
 /// Initializes a new instance of the InBandRegistration class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public InBandRegistration(XmppIm im)
     : base(im)
 {
 }
Beispiel #46
0
 public MultiUserChat(XmppIm im) : base(im)
 {
 }
Beispiel #47
0
 /// <summary>
 /// Initializes a new instance of the SIFileTransfer class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public SIFileTransfer(XmppIm im)
     : base(im)
 {
 }
Beispiel #48
0
 /// <summary>
 /// Initializes a new instance of the Pep class.
 /// </summary>
 /// <param name="im">A reference to the XmppIm instance on whose behalf this
 /// instance is created.</param>
 public Pep(XmppIm im)
     : base(im)
 {
 }
Beispiel #49
0
 public AdHocCommands(XmppIm im)
     : base(im)
 {
 }