예제 #1
0
 //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
 #region --Misc Methods (Public)--
 public override bool Equals(object obj)
 {
     if (obj is XMPPUser)
     {
         XMPPUser u = obj as XMPPUser;
         return(string.Equals(u.domain, domain) && string.Equals(u.resource, resource) && string.Equals(u.userId, userId) && string.Equals(u.userPassword, userPassword));
     }
     return(false);
 }
예제 #2
0
 private void setXMPPUserProperty(XMPPUser value)
 {
     if (!(user is null))
     {
         value.PropertyChanged -= XMPPUser_PropertyChanged;
     }
     SetProperty(ref _user, value, nameof(user));
     if (!(user is null))
     {
         value.PropertyChanged += XMPPUser_PropertyChanged;
     }
 }
예제 #3
0
 //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
 #region --Misc Methods (Public)--
 public async Task CreateAccount()
 {
     await Task.Run(() =>
     {
         XMPPUser user       = new XMPPUser(MODEL.BareJidText, Utils.getRandomResourcePart());
         XMPPAccount account = new XMPPAccount(user)
         {
             color = UiUtils.GenRandomHexColor()
         };
         account.generateOmemoKeys();
         SetAccount(account);
     });
 }
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--
        public async Task CreateAccountAsync()
        {
            await Task.Run(async() =>
            {
                XMPPUser user       = new XMPPUser(MODEL.BareJidText, Utils.getRandomResourcePart());
                XMPPAccount account = new XMPPAccount(user)
                {
                    color = UiUtils.GenRandomHexColor(),
                };

                // Look up the DNS SRV record:
                await account.dnsSrvLookupAsync();

                account.generateOmemoKeys();
                SetAccount(account);
            });
        }
예제 #5
0
 public XMPPAccount(XMPPUser user, string serverAddress, int port, ConnectionConfiguration connectionConfiguration)
 {
     this.user                     = user;
     this.serverAddress            = serverAddress;
     this.port                     = port;
     this.connectionConfiguration  = connectionConfiguration;
     this.presencePriorety         = 0;
     this.disabled                 = false;
     this.color                    = null;
     this.presence                 = Presence.Online;
     this.status                   = null;
     this.CONNECTION_INFO          = new ConnectionInformation();
     this.omemoIdentityKeyPair     = null;
     this.omemoSignedPreKeyPair    = null;
     this.omemoPreKeys             = null;
     this.omemoDeviceId            = 0;
     this.omemoBundleInfoAnnounced = false;
 }
예제 #6
0
        //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
        #region --Set-, Get- Methods--
        public XMPPAccount getAccount()
        {
            XMPPUser user = getUser();

            if (user != null)
            {
                Account.user          = user;
                Account.serverAddress = serverAddress_tbx.Text.ToLower();
                int.TryParse(serverPort_tbx.Text, out Account.port);
                Account.presencePriorety = (int)presencePriorety_slider.Value;
                Account.color            = color_tbx.Text;
                Account.presence         = Presence.Online;
                Account.status           = "";

                return(Account);
            }
            return(null);
        }
예제 #7
0
 public XMPPAccount(XMPPUser user, string serverAddress, int port, ConnectionConfiguration connectionConfiguration)
 {
     invokeInUiThread             = false;
     this.user                    = user;
     this.serverAddress           = serverAddress;
     this.port                    = port;
     this.connectionConfiguration = connectionConfiguration;
     presencePriorety             = 0;
     disabled        = false;
     color           = null;
     presence        = Presence.Online;
     status          = null;
     CONNECTION_INFO = new ConnectionInformation();
     CONNECTION_INFO.PropertyChanged += CONNECTION_INFO_PropertyChanged;
     omemoIdentityKeyPair             = null;
     omemoSignedPreKeyPair            = null;
     OMEMO_PRE_KEYS = new CustomObservableCollection <PreKeyRecord>(false);
     OMEMO_PRE_KEYS.CollectionChanged += OMEMO_PRE_KEYS_CollectionChanged;
     omemoDeviceId            = 0;
     omemoBundleInfoAnnounced = false;
 }
예제 #8
0
 //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
 #region --Constructors--
 /// <summary>
 /// Basic Constructor
 /// </summary>
 /// <history>
 /// 17/08/2017 Created [Fabian Sauter]
 /// </history>
 public XMPPAccount(XMPPUser user) : this(user, user?.domainPart ?? "", 5222, new ConnectionConfiguration())
 {
 }
예제 #9
0
 //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
 #region --Constructors--
 /// <summary>
 /// Basic Constructor
 /// </summary>
 /// <history>
 /// 17/08/2017 Created [Fabian Sauter]
 /// </history>
 public XMPPAccount(XMPPUser user, string serverAddress, int port) : this(user, serverAddress, port, new ConnectionConfiguration())
 {
 }