internal FMessage(WhatsappAccount remote_user, bool from_me) { this.status = Status.Undefined; this.gap_behind = true; this.User = remote_user; this.key = new Key(remote_user.GetFullJid(), from_me, TicketManager.GenerateId()); }
public FMessage(WhatsappAccount remote_user, string data, object image) : this(remote_user, true) { this.data = data; this.thumb_image = image; this.timestamp = new DateTime?(DateTime.Now); }
/// <summary> /// Default class constructor, called by Form_Login /// </summary> /// <param name="_Account">An instance of WhatsAppAccount</param> public Form_Main(WhatsappAccount _Account) { InitializeComponent(); Account = _Account; Prot = new WhatsAppProtocol(Account); Contacts = new ContactCollection(); }
/// <summary> /// Handles logging in, supposed to run in a seperated thread /// </summary> private void login() { if (ComboBox_Login.SelectedItem == null) { return; } WhatsappAccount Account = (WhatsappAccount)ComboBox_Login.SelectedItem; // Verify Account WhatsAppHelper Helper = new WhatsAppHelper(); bool Result = Helper.verifyAccount(Account.CountryCode, Account.Phonenumber, Account.Password); if (Result == true) { // Account is valid, show main form Form_Main frmMain = new Form_Main(Account); this.Close(); frmMain.ShowDialog(); } else { DialogResult Re = MessageBox.Show("The selected acocunt does not appear to be working, do you want to remove it?", "Error: Account not working", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (Re == DialogResult.Yes) { // Delete account Database.Query("DELETE FROM accounts WHERE phonenumber='" + Account.Phonenumber + "'"); // Reload combobox updateAccounts(); // Hide status label Label_Status.Visible = false; Label_Status.Text = "Please wait while we verify your account."; // Enable controls SetControlsEnabled(true); } else { // Reload combobox updateAccounts(); // Hide status label Label_Status.Visible = false; Label_Status.Text = "Please wait while we verify your account."; // Enable controls SetControlsEnabled(true); } } }
public WhatsAppProtocol(WhatsappAccount _Acc) { this.messageQueue = new List<ProtocolTreeNode>(); WhatsAppProtocol.DEBUG = false; string[] dict = DecodeHelper.getDictionary(); this.writer = new BinTreeNodeWriter(dict); this.reader = new BinTreeNodeReader(dict); this.loginStatus = CONNECTION_STATUS.DISCONNECTED; this.whatsNetwork = new WhatsNetwork(WhatsConstants.WhatsAppHost, WhatsConstants.WhatsPort, this.timeout); this.WhatsParser = new WhatsParser(this.whatsNetwork, this.writer); this.WhatsSendHandler = this.WhatsParser.WhatsSendHandler; _incompleteBytes = new List<IncompleteMessageException>(); Acc = _Acc; }
public WhatsAppProtocol(WhatsappAccount _Acc) { this.messageQueue = new List <ProtocolTreeNode>(); WhatsAppProtocol.DEBUG = false; string[] dict = DecodeHelper.getDictionary(); this.writer = new BinTreeNodeWriter(dict); this.reader = new BinTreeNodeReader(dict); this.loginStatus = CONNECTION_STATUS.DISCONNECTED; this.whatsNetwork = new WhatsNetwork(WhatsConstants.WhatsAppHost, WhatsConstants.WhatsPort, this.timeout); this.WhatsParser = new WhatsParser(this.whatsNetwork, this.writer); this.WhatsSendHandler = this.WhatsParser.WhatsSendHandler; _incompleteBytes = new List <IncompleteMessageException>(); Acc = _Acc; }
/// <summary> /// Reloads all accounts from the database /// </summary> private void updateAccounts() { // Read all info from the database WhatsappAccounts.Clear(); ComboBox_Login.DataSource = null; ComboBox_Login.Items.Clear(); DataRowCollection Rows = Database.GetTableRows("accounts", ""); foreach (DataRow Row in Rows) { WhatsappAccount Acc = new WhatsappAccount(Row["countrycode"].ToString(), Row["phonenumber"].ToString(), Row["password"].ToString(), Row["phonenumber"].ToString()); WhatsappAccounts.Add(Acc); } // Set data source and display member of combobox ComboBox_Login.DataSource = WhatsappAccounts; ComboBox_Login.DisplayMember = "FullPhonenumber"; }