Ejemplo n.º 1
0
 internal void OnFileDroped(ChatBox sender, String[] files)
 {
     if (FileDroped != null)
     {
         FileDroped(sender, files);
     }
 }
Ejemplo n.º 2
0
 internal void OnLinkClicked(ChatBox sender, String id, String url)
 {
     if (LinkClicked != null)
     {
         LinkClicked(sender, id, url);
     }
 }
Ejemplo n.º 3
0
 internal void OnLinkClicked(ChatBox sender, String id, String url)
 {
     if (LinkClicked != null)
     {
         LinkClicked(sender, id, url);
     }
 }
Ejemplo n.º 4
0
 internal void OnFileDroped(ChatBox sender, String[] files)
 {
     if (FileDroped != null)
     {
         FileDroped(sender, files);
     }
 }
Ejemplo n.º 5
0
        public void NewChat(JabberUser jabberUser, bool setFocus)
        {
            int presenceStatus = 0;
            if (myClientForm.myBuddyPresence.Contains(jabberUser.JID)) presenceStatus = (int)myClientForm.myBuddyPresence[jabberUser.JID];

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChatWindow));

            if (myChatSessions[jabberUser.JID] == null)
            {
                ChatSession tmplChatSession = new ChatSession();
                ChatBox tmplChatBox = new ChatBox();
                tmplChatBox.JID = jabberUser.JID;
                tmplChatBox.ResetHTML();

                tmplChatSession.LastStatus = presenceStatus;
                tmplChatBox.wbConversation.GotFocus += new EventHandler(wbConversation_GotFocus);

                this.tmplChatTab = new Telerik.WinControls.UI.TabItem();

                //
                // tmplChatTab
                this.tmplChatTab.AccessibleDescription = "";
                this.tmplChatTab.CanFocus = true;
                this.tmplChatTab.Class = "TabItem";
                this.tmplChatTab.Tag = jabberUser.JID;
                this.tmplChatTab.ImageIndex = presenceStatus;
                this.tmplChatTab.TextImageRelation = TextImageRelation.ImageBeforeText;
                //
                // tmplChatTab.ContentPanel
                //
                this.tmplChatTab.ContentPanel.BackColor = System.Drawing.Color.Transparent;
                this.tmplChatTab.ContentPanel.Font = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Regular);
                this.tmplChatTab.ContentPanel.Location = new System.Drawing.Point(1, 22);
                this.tmplChatTab.ContentPanel.Name = "ContentPanel";
                this.tmplChatTab.ContentPanel.Size = new System.Drawing.Size(490, 241);
                this.tmplChatTab.ContentPanel.Dock = DockStyle.Fill;
                this.tmplChatTab.ContentPanel.TabIndex = 0;
                this.tmplChatTab.Text = jabberUser.Nick;
                this.tmplChatTab.ToolTipText = null;

                this.myChatSessionsTabControl.Items.AddRange(new Telerik.WinControls.RadItem[] { this.tmplChatTab });
                this.tmplChatTab.ContentPanel.BackgroundImage = null;
                this.tmplChatTab.ContentPanel.BackColor = Color.White;
                this.tmplChatTab.ContentPanel.Controls.Add(tmplChatBox);
                tmplChatBox.Dock = DockStyle.Fill;
                this.tmplChatTab.ContentPanel.Invalidate();

                //wire up all events

                tmplChatBox.toolStripCallUser.Click += new EventHandler(tmplVoiceCallToolStripButton_Click); ;
                tmplChatBox.toolStripColor.Click += new EventHandler(tmplChangeColorToolStripButton_Click); ;
                tmplChatBox.toolStripEmotSmile.Click += new EventHandler(tmplEmoticonSmileToolStripButton_Click); ;
                tmplChatBox.toolStripEvilgrin.Click += new EventHandler(tmplEmoticonEvilGrinToolStripButton_Click); ;
                tmplChatBox.toolStripFont.Click += new EventHandler(tmplChangeFontToolStripButton_Click);
                tmplChatBox.toolStripGrin.Click += new EventHandler(tmplEmoticonGrinToolStripButton_Click); ;
                tmplChatBox.toolStripHappy.Click += new EventHandler(tmplEmoticonHappyToolStripButton_Click); ;
                tmplChatBox.toolStripOpenArchive.Click += new EventHandler(toolStripOpenArchive_Click); ;
                tmplChatBox.toolStripSendMessage.Click += new EventHandler(tmplSendMessageToolStripButton_Click); ;
                tmplChatBox.toolStripStartVideo.Click += new EventHandler(tmplVideoCallToolStripButton_Click); ;
                tmplChatBox.toolStripSurprised.Click += new EventHandler(tmplEmoticonSurprisedToolStripButton_Click); ;
                tmplChatBox.toolStripTongue.Click += new EventHandler(tmplEmoticonToungeToolStripButton_Click); ;
                tmplChatBox.toolStripUnhappy.Click += new EventHandler(tmplEmoticonUnhappyToolStripButton_Click); ;
                tmplChatBox.toolStripWaii.Click += new EventHandler(tmplEmoticonWaiiToolStripButton_Click); ;
                tmplChatBox.toolStripWink.Click += new EventHandler(tmplEmoticonWinkToolStripButton_Click); ;
                tmplChatBox.toolStripSendNudge.Click += new EventHandler(toolStripSendNudge_Click);
                tmplChatBox.toolStripSendFile.Click += new EventHandler(toolStripSendFile_Click);
                tmplChatBox.tbMessage.KeyUp += new KeyEventHandler(tmplChatTabMessage_KeyUp);

                //disable foreign networks features
                if (jabberUser.Network != ConfigXMPPNetwork.Default)
                {
                    tmplChatBox.toolStripCallUser.Enabled = false;
                    tmplChatBox.toolStripStartVideo.Enabled = false;
                    tmplChatBox.toolStripSendNudge.Enabled = false;
                    tmplChatBox.toolStripSendFile.Enabled = false;
                    tmplChatBox.toolStripCallUser.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                    tmplChatBox.toolStripStartVideo.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                    tmplChatBox.toolStripSendNudge.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                    tmplChatBox.toolStripSendFile.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                }

#if NOVIDEO
                tmplChatBox.toolStripStartVideo.Visible = false;
                tmplChatBox.toolStripStartVideo.Enabled = false;
#endif
#if NOFILESHARING
                tmplChatBox.toolStripSendFile.Visible = false;
                tmplChatBox.toolStripSendFile.Enabled = false;
#endif

                tmplChatBox.LinkClicked += new ChatBox.LinkClickedHandler(tmplChatBox_LinkClicked);
                tmplChatBox.FileDroped += new ChatBox.FilesDropedHandler(tmplChatBox_FileDroped);

                this.myChatSessionsTabControl.SelectedTab = this.tmplChatTab;

                this.tmplChatTab.ContentPanel.ResumeLayout(true);

                RadButtonElement tmplCloseButton = new RadButtonElement("x");
                tmplCloseButton.ToolTipText = Properties.Localization.txtChatInfoCloseTab;
                tmplCloseButton.Tag = jabberUser.JID;
                tmplCloseButton.Click += new EventHandler(tmplCloseButton_Click);

                tmplCloseButton.Alignment = ContentAlignment.TopRight;
                tmplChatTab.Children[2].Margin = new Padding(0, 0, 15, 0);
                tmplChatTab.Children.Add(tmplCloseButton);

                tmplChatSession.ChatTab = tmplChatTab;
                tmplChatSession.ChatBox = tmplChatBox;
                tmplChatSession.JabberUser = jabberUser;

                myChatSessions.Add(jabberUser.JID, tmplChatSession);
                Search("%");
                tmplChatSession.ChatBox.ChatTabMessage.Focus();
            }
            else
            {
                ChatSession tmplChatSession = (ChatSession)myChatSessions[jabberUser.JID];
                myChatSessionsTabControl.SelectedTab = tmplChatSession.ChatTab;
            }

            if (myClientForm.mUserAccount.LoggedIn)
            {
                ShowIt();
            }

        }
Ejemplo n.º 6
0
        void tmplChatBox_LinkClicked(ChatBox sender, string id, string url)
        {
            if (!url.Contains(":")) return;

            string action = url.Split(new string[] { ":" }, 2, StringSplitOptions.None)[0];
            string argument = url.Split(new string[] { ":" }, 2, StringSplitOptions.None)[1];
            ChatSession tmplChatSession = null;
            switch (action)
            {
                case "ft-accept":
                    sender.SetLink(id, "", true);
                    myClientForm.FileTransferProcessAccept(sender.JID, argument);
                    break;
                case "ft-decline":
                    sender.SetLink(id, "", true);
                    myClientForm.FileTransferProcessCancel(sender.JID, argument);
                    break;
                case "ar-open":
                    tmplChatSession = (ChatSession)myChatSessions[myChatSessionsTabControl.SelectedTab.Tag];
                    if (tmplChatSession != null) myClientForm.OpenArchiveWindow(tmplChatSession.JabberUser);
                    break;
                case "vc-accept":
                    sender.SetLink(id, "", true);
                    tmplChatSession = (ChatSession)myChatSessions[myChatSessionsTabControl.SelectedTab.Tag];
                    if (tmplChatSession != null) myClientForm.VideoSessionProcessInviationResult(sender.JID, argument,true);
                    break;
                case "vc-decline":
                    sender.SetLink(id, "", true);
                    tmplChatSession = (ChatSession)myChatSessions[myChatSessionsTabControl.SelectedTab.Tag];
                    if (tmplChatSession != null) myClientForm.VideoSessionProcessInviationResult(sender.JID, argument,false);
                    break;
            }
        }
Ejemplo n.º 7
0
        void tmplChatBox_FileDroped(ChatBox sender, string[] files)
        {
            if (files == null) return;

            foreach (String file in files)
            {
                InitializeFileTransfer(sender.JID, file);
            }
        }