internal void PMScribbleReceived(Room room, User user, String name, byte[] data) { this.tabControl1.BeginInvoke((Action)(() => { for (int i = 0; i < this.tabControl1.TabPages.Count; i++) { if (this.tabControl1.TabPages[i] is PMTab) { if (this.tabControl1.TabPages[i].Text == name) { PMTab tab = (PMTab)this.tabControl1.TabPages[i]; tab.Scribble(data); tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == name); if (!tab.First) { tab.First = true; if (room != null && user != null) { ScriptEvents.OnPmFirstReceived(room, user); } } return; } } } PMTab new_tab = new PMTab(name, this.EndPoint); if (this.IsBlack) { new_tab.SetToBlack(); } new_tab.HashlinkClicked += this.LinkHashlinkClicked; new_tab.EditScribbleClicked += this.DoEditScribbleClicked; new_tab.ImageIndex = 2; this.tabControl1.TabPages.Add(new_tab); new_tab.Scribble(data); new_tab.First = true; if (room != null && user != null) { ScriptEvents.OnPmFirstReceived(room, user); } })); }
public void MyPMJSText(String target, String text, AresFont font) { if (this.tabControl1.InvokeRequired) { this.tabControl1.BeginInvoke(new MyPMJSTextHandler(this.MyPMJSText), target, text, font); } else { for (int i = 0; i < this.tabControl1.TabPages.Count; i++) { if (this.tabControl1.TabPages[i] is PMTab) { if (this.tabControl1.TabPages[i].Text == target) { PMTab tab = (PMTab)this.tabControl1.TabPages[i]; tab.PM(this.MyName, text, font); tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == target); return; } } } PMTab new_tab = new PMTab(target, this.EndPoint); if (this.IsBlack) { new_tab.SetToBlack(); } new_tab.HashlinkClicked += this.LinkHashlinkClicked; new_tab.EditScribbleClicked += this.DoEditScribbleClicked; new_tab.ImageIndex = 2; this.tabControl1.TabPages.Add(new_tab); new_tab.PM(this.MyName, text, font); } }
internal void PMTextReceived(Room room, User user, String name, String text, AresFont font, PMTextReceivedType type) { this.tabControl1.BeginInvoke((Action)(() => { for (int i = 0; i < this.tabControl1.TabPages.Count; i++) { if (this.tabControl1.TabPages[i] is PMTab) { if (this.tabControl1.TabPages[i].Text == name) { PMTab tab = (PMTab)this.tabControl1.TabPages[i]; if (type == PMTextReceivedType.Announce) { tab.Announce(text); if (text.Contains("voice_clip")) { tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == name); } } else { tab.PM(name, text, font); tab.SetRead(this.Mode == ScreenMode.PM && this.PMName == name); if (!tab.AutoReplySent) { if (Settings.GetReg <bool>("can_pm_reply", true)) { this.SendAutoReply(name, EventArgs.Empty); String[] lines = Settings.GetReg <String>("pm_reply", "Hello +n, please leave a message.").Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); AresFont f = null; if (Settings.MyFont != null) { f = Settings.MyFont.Copy(); } foreach (String str in lines) { String rtext = str.Replace("+n", name); if (!String.IsNullOrEmpty(rtext)) { while (Encoding.UTF8.GetByteCount(rtext) > 200) { rtext = rtext.Substring(0, rtext.Length - 1); } tab.PM(this.MyName, rtext, f); } } } tab.AutoReplySent = true; } } if (!tab.First) { tab.First = true; if (room != null && user != null) { ScriptEvents.OnPmFirstReceived(room, user); } } return; } } } PMTab new_tab = new PMTab(name, this.EndPoint); if (this.IsBlack) { new_tab.SetToBlack(); } new_tab.HashlinkClicked += this.LinkHashlinkClicked; new_tab.EditScribbleClicked += this.DoEditScribbleClicked; new_tab.ImageIndex = 2; this.tabControl1.TabPages.Add(new_tab); if (type == PMTextReceivedType.Announce) { new_tab.Announce(text); } else { new_tab.PM(name, text, font); if (Settings.GetReg <bool>("can_pm_reply", true)) { this.SendAutoReply(name, EventArgs.Empty); String[] lines = Settings.GetReg <String>("pm_reply", "Hello +n, please leave a message.").Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); AresFont f = null; if (Settings.MyFont != null) { f = Settings.MyFont.Copy(); } foreach (String str in lines) { String rtext = str.Replace("+n", name); if (!String.IsNullOrEmpty(text)) { while (Encoding.UTF8.GetByteCount(rtext) > 200) { rtext = rtext.Substring(0, rtext.Length - 1); } new_tab.PM(this.MyName, rtext, f); } } } new_tab.AutoReplySent = true; new_tab.First = true; if (room != null && user != null) { ScriptEvents.OnPmFirstReceived(room, user); } } })); }