private void frmSpelling_FormClosing(object sender, FormClosingEventArgs e) { string message = richTextBox1.Text; string message1 = string.Empty; string message2 = string.Empty; if (message.Length == 0) { return; } if (ischat) { instance.TabConsole.chatConsole.SendChat(richTextBox1.Text, ctype); } else { if (!isgroup) { //netcom.SendInstantMessage(richTextBox1.Text, target, session); if (message.Length > 1023) { message1 = message.Substring(0, 1022); netcom.SendInstantMessage(message1, target, session); if (message.Length > 2046) { message2 = message.Substring(1023, 2045); netcom.SendInstantMessage(message2, target, session); } } else { netcom.SendInstantMessage(message, target, session);; } } else { if (message.Length > 1023) { message1 = message.Substring(0, 1022); netcom.SendInstantMessageGroup(message1, target, session); if (message.Length > 2046) { message2 = message.Substring(1023, 2045); netcom.SendInstantMessageGroup(message2, target, session); } } else { netcom.SendInstantMessageGroup(message, target, session);; } } } }
private void StartAI() { metaTimer.Stop(); metaTimer.Enabled = false; metaTimer.Dispose(); string sanswer = answer.ProcessInput(emt.IM.Message.ToLower(CultureInfo.CurrentCulture), ""); if (string.IsNullOrEmpty(sanswer)) { string imsg = emt.IM.Message; imsg = answer.ProcessSmileys(imsg); ProcessAI(imsg, emt.IM.FromAgentName, emt.IM.FromAgentID, emt.IM.IMSessionID); } else { if (sanswer.Length > 0) { netcom.SendInstantMessage(sanswer, emt.IM.FromAgentID, emt.IM.IMSessionID); } } }
private void btnSend_Click(object sender, EventArgs e) { netcom.SendInstantMessage(cbxInput.Text, target, session); this.ClearIMInput(); }
public void SendIM(string message) { if (message.Length == 0) { return; } message = message.TrimEnd(); //message = message.Replace("http://*****:*****@"[^a-zA-Z0-9]", ""); //string[] swords = cword.Split(' '); string[] swords = message.Split(' '); bool hasmistake = false; bool correct = true; foreach (string word in swords) { string cword = Regex.Replace(word, @"[^a-zA-Z0-9]", ""); try { correct = hunspell.Spell(cword); } catch (Exception ex) { if (ex.Message == "Dictionary is not loaded") { instance.Config.ApplyCurrentConfig(); //correct = hunspell.Spell(cword); } else { Logger.Log("Spellcheck error IM: " + ex.Message, Helpers.LogLevel.Error); } } if (!correct) { hasmistake = true; break; } } if (hasmistake) { (new frmSpelling(instance, message, swords, false, target, session)).Show(); ClearIMInput(); hasmistake = false; return; } } string message1 = string.Empty; string message2 = string.Empty; if (message.Length > 1023) { message1 = message.Substring(0, 1022); netcom.SendInstantMessage(message1, target, session); if (message.Length > 2046) { message2 = message.Substring(1023, 2045); netcom.SendInstantMessage(message2, target, session); } } else { netcom.SendInstantMessage(message, target, session);; } ClearIMInput(); }