public ContactListForm(SessionManager mySession) : this() { _SessionManager = mySession; _SessionManager.IncomingMessage += new SessionManager.IncomingMessageDelegate(OnIncomingMessage); _SessionManager.IncomingPresence += new SessionManager.IncomingPresenceDelegate(OnIncomingPresence); _SessionManager.IncomingRosterChange += new SessionManager.IncomingRosterChangeDelegate(OnIncomingRosterChange); Rectangle screen = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; this.Location = new Point(Convert.ToInt32((screen.Width - this.Width) / 2), Convert.ToInt32((screen.Height - this.Height) / 2)); this.Text = string.Format("{0} - {1}", this.Text, _SessionManager.LocalUser.ToString()); }
public ChatRoomTabPage(JabberID occupantJID, MultiUserChatForm form, SessionManager sm) : base(occupantJID.BareJID.ToString()) { _occupant = occupantJID; _form = form; _sm = sm; _sm.Session.AddHandler(typeof(MessageErrorPacket), new Session.PacketReceivedDelegate(IncomingMessage)); _sm.Session.AddHandler(typeof(GroupChatMessage), new Session.PacketReceivedDelegate(IncomingMessage)); _sm.Session.AddHandler(typeof(ChangeSubjectMessage), new Session.PacketReceivedDelegate(IncomingMessage)); _sm.Session.AddHandler(typeof(AvailableRequest), new Session.PacketReceivedDelegate(IncomingPresence)); _sm.Session.AddHandler(typeof(ErrorResponse), new Session.PacketReceivedDelegate(IncomingPresence)); _sm.Session.AddHandler(typeof(OccupantAvailableResponse), new Session.PacketReceivedDelegate(IncomingPresence)); _sm.Session.AddHandler(typeof(OccupantUnavailableResponse), new Session.PacketReceivedDelegate(IncomingPresence)); }
public MultiUserChatForm( SessionManager sm ) { // // Required for Windows Form Designer support // InitializeComponent(); _sm = sm; _sm.ChatRooms = this; base.Closed += new EventHandler(MultiUserChatForm_Closed); base.GotFocus += new EventHandler(MultiUserChatForm_GotFocus); base.Load += new EventHandler(MultiUserChatForm_Load); base.KeyDown += new KeyEventHandler(MultiUserChatForm_KeyDown); tabRooms.SelectedIndexChanged += new EventHandler(tabRooms_SelectedIndexChanged); lstUsers.DoubleClick += new EventHandler(lstUsers_DoubleClick); }
//Initializes the SessionManager. //This creates a connection to the server and calls open stream. private void InitializeSessionManager() { ConnectionOptions options = new ConnectionOptions(ServerNameTextBox.Text, 5222); options.StreamCulture = ((LanguageItem) Language.SelectedItem).Culture; Session s = new Session(options); s.OpenStreamSynchronous(); _SessionManager = new SessionManager(s, this); this.BringToFront(); }
//Authenticates the user with the server on the form. //This is called in a background thread. private void DoAuthentication() { try { if (! object.Equals(_SessionManager, null)) { try { _SessionManager.CloseStream(); _SessionManager.Dispose(); _SessionManager = null; } catch { } } Session s = Session.Login(UserNameTextBox.Text, PasswordTextBox.Text, ResourceTextBox.Text, ServerNameTextBox.Text, ((LanguageItem)Language.SelectedItem).Culture); _SessionManager = new SessionManager(s, this); _SessionManager.LocalUser = new JabberID(UserNameTextBox.Text, ServerNameTextBox.Text, ResourceTextBox.Text); LoadCL(); this.Hide(); } catch (PacketException ex) { MessageBox.Show(string.Concat("Unable to Login :"******"Login Error" ,System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } catch (StreamException ex) { MessageBox.Show(string.Concat("Unable to Login :"******"Login Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(string.Format("The following exception occurred while authenticating:\n\n{0}", ex), "Login Failure"); if (_SessionManager != null) _SessionManager.Dispose(); } }
public MessageWindows(SessionManager sessionMgr) : base() { _sessionManager = sessionMgr; }
public RoomOccupant(JabberID jid, SessionManager sm) { _occupantJID = jid; _sm = sm; }
public MessageForm(SessionManager mySession, JabberID RemoteUserJID) : this(mySession) { RemoteUser = RemoteUserJID; SetupTabs(); }
public MessageForm(SessionManager mySession) : this() { _SessionManager = mySession; _incomingMessageDelegate = new SessionManager.IncomingMessageDelegate(OnIncomingMessage); _SessionManager.IncomingMessage += (_incomingMessageDelegate); SetupTabs(); }
//Handles MyBase.Closed private void MessageForm_Closed(Object sender, System.EventArgs e) { _SessionManager.MessageWindows.Remove(RemoteUser); _SessionManager.IncomingMessage -= (_incomingMessageDelegate); _SessionManager = null; this.Dispose(); }
public MessageForm(SessionManager mySession, JabberID LocalUserJID, JabberID RemoteUserJID) : this(mySession, RemoteUserJID) { LocalUser = LocalUserJID; SetupTabs(); }