void Self_IM(object sender, InstantMessageEventArgs e) { if (e.IM.IMSessionID == relayGroup && irc.IsConnected && e.IM.FromAgentID != client.Self.AgentID) { string[] lines = Regex.Split(e.IM.Message, "\n+"); for (int l = 0; l < lines.Length; l++) { string[] words = lines[l].Split(' '); string outstr = string.Empty; for (int i = 0; i < words.Length; i++) { outstr += words[i] + " "; if (outstr.Length > 380) { PrintMsg(irc.Nickname, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); irc.SendMessage(SendType.Message, txtChan.Text, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); outstr = string.Empty; } } PrintMsg(irc.Nickname, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); irc.SendMessage(SendType.Message, txtChan.Text, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); } } }
void Self_IM(object sender, InstantMessageEventArgs e) { bool groupIM = e.IM.GroupIM && GroupMembers != null && GroupMembers.ContainsKey(e.IM.FromAgentID) ? true : false; if (e.IM.FromAgentID == MasterKey || (GroupCommands && groupIM)) { // Received an IM from someone that is authenticated Console.WriteLine("<{0} ({1})> {2}: {3} (@{4}:{5})", e.IM.GroupIM ? "GroupIM" : "IM", e.IM.Dialog, e.IM.FromAgentName, e.IM.Message, e.IM.RegionID, e.IM.Position); if (e.IM.Dialog == InstantMessageDialog.RequestTeleport) { Console.WriteLine("Accepting teleport lure."); Self.TeleportLureRespond(e.IM.FromAgentID, e.IM.IMSessionID, true); } else if ( e.IM.Dialog == InstantMessageDialog.MessageFromAgent || e.IM.Dialog == InstantMessageDialog.MessageFromObject) { ClientManager.Instance.DoCommandAll(e.IM.Message, e.IM.FromAgentID); } } else { // Received an IM from someone that is not the bot's master, ignore Console.WriteLine("<{0} ({1})> {2} (not master): {3} (@{4}:{5})", e.IM.GroupIM ? "GroupIM" : "IM", e.IM.Dialog, e.IM.FromAgentName, e.IM.Message, e.IM.RegionID, e.IM.Position); return; } }
private void HandleGroupIM(InstantMessageEventArgs e) { // Ignore group IM from a muted group if (null != client.Self.MuteList.Find(me => me.Type == MuteType.Group && (me.ID == e.IM.IMSessionID || me.ID == e.IM.FromAgentID))) { return; } if (TabExists(e.IM.IMSessionID.ToString())) { RadegastTab tab = tabs[e.IM.IMSessionID.ToString()]; tab.Highlight(); return; } instance.MediaManager.PlayUISound(UISounds.IM); Control active = FindFocusedControl(instance.MainForm); GroupIMTabWindow imTab = AddGroupIMTab(e.IM.IMSessionID, Utils.BytesToString(e.IM.BinaryBucket)); imTab.TextManager.ProcessIM(e); tabs[e.IM.IMSessionID.ToString()].Highlight(); if (active != null) { active.Focus(); } }
private void ProcessEventArgs(InstantMessageEventArgs e) { //string[] split; try { targetName = e.IM.FromAgentName; targetUUID = e.IM.FromAgentID; isession = e.IM.IMSessionID; //string gmsg = @e.IM.Message.ToString(); //split = gmsg.Split(new Char[] { ':' }); //if (split.Length > 1) //{ // textBox1.Text = @split[0].ToString().Replace("Group", "\r\n\r\nGroup: ") + @split[1].ToString().Replace("\n", " "); //} //else //{ // textBox1.Text = @split[0].ToString(); //} textBox1.Text = @e.IM.Message.Replace("\n", "\r\n").Replace("Group:", "\r\n\r\nGroup: "); } catch {; } }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (e.IM.IMSessionID != session) { return; } if (e.IM.Dialog == InstantMessageDialog.StartTyping) { tsbTyping.Visible = true; } else { tsbTyping.Visible = false; } string avsim = e.Simulator.Name; Vector3 avloccords = e.IM.Position; if (avloccords != Vector3.Zero) { avloc = "http://slurl.com/secondlife/" + avsim + "/" + (avloccords.X - 1).ToString(CultureInfo.CurrentCulture) + "/" + avloccords.Y.ToString(CultureInfo.CurrentCulture) + "/" + avloccords.Z.ToString(CultureInfo.CurrentCulture); tsbLocation.Enabled = true; tsbLocation.ToolTipText = e.IM.FromAgentName + "'s Location"; } }
public void Self_IM(object sender, InstantMessageEventArgs e) { InstantMessage im = e.IM; UUID fromAgentID = im.FromAgentID; string fromAgentName = im.FromAgentName; //UUID toAgentID = im.ToAgentID; UUID regionID = im.RegionID; Vector3 position = im.Position; InstantMessageDialog dialog = im.Dialog; bool groupIM = im.GroupIM; UUID imSessionID = im.IMSessionID; DateTime timestamp = im.Timestamp; string message = im.Message; InstantMessageOnline offline = im.Offline; byte[] binaryBucket = im.BinaryBucket; uint parentEstateID = im.ParentEstateID; Hashtable item = new Hashtable(); item.Add("MessageType", "InstantMessage"); item.Add("FromAgentID", fromAgentID); item.Add("FromAgentName", fromAgentName); item.Add("ParentEstateID", parentEstateID.ToString()); item.Add("RegionID", regionID); item.Add("Position", position); item.Add("Dialog", dialog); item.Add("GroupIM", groupIM); item.Add("IMSessionID", imSessionID); item.Add("Timestamp", timestamp.ToString("o")); item.Add("Message", message); item.Add("Offline", offline); item.Add("BinaryBucket", binaryBucket); enqueue(item); }
//private void Config_ConfigApplied(object sender, ConfigAppliedEventArgs e) //{ // ApplyConfig(e.AppliedConfig); //} //private void ApplyConfig(Config config) //{ // if (config.InterfaceStyle == 0) //System // toolStrip1.RenderMode = ToolStripRenderMode.System; // else if (config.InterfaceStyle == 1) //Office 2003 // toolStrip1.RenderMode = ToolStripRenderMode.ManagerRenderMode; //} void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { //if (e.IM.Dialog == InstantMessageDialog.MessageFromAgent // && Alice.isAcceptingUserInput // && instance.Config.CurrentConfig.UseAlice // && !instance.Groups.ContainsKey(e.IM.IMSessionID) // && e.IM.BinaryBucket.Length < 2 // && e.IM.FromAgentName != "Second Life") //{ // Alice.GlobalSettings.updateSetting("location", "region " + client.Network.CurrentSim.Name); // AIMLbot.User user; // if (AliceUsers.ContainsKey(e.IM.FromAgentName)) { // user = (AIMLbot.User)AliceUsers[e.IM.FromAgentName]; // } else { // user = new User(e.IM.FromAgentName, Alice); // user.Predicates.removeSetting("name"); // user.Predicates.addSetting("name", firstName(e.IM.FromAgentName)); // AliceUsers[e.IM.FromAgentName] = user; // } // AIMLbot.Request req = new Request(e.IM.Message, user, Alice); // AIMLbot.Result res = Alice.Chat(req); // string msg = res.Output; // if (msg.Length > 1000) { // msg = msg.Substring(0, 1000); // } // netcom.SendInstantMessage(msg, e.IM.FromAgentID, e.IM.IMSessionID); //} }
private void IrcBot_IM(object sender, InstantMessageEventArgs im) { if (!client.IsRegionMaster) { return; } var e = im.IM; var type = e.Dialog; if (type == InstantMessageDialog.StartTyping || type == InstantMessageDialog.StopTyping) { return; } var message = e.Message; var id = e.FromAgentID; var fromname = e.FromAgentName; if (IrcCommand.IsChannelAgent(fromname)) { return; } if ((type == InstantMessageDialog.MessageFromAgent)) { IrcCommand.IrcSend("" + fromname + ": " + message); return; } IrcCommand.IrcSend(fromname + " " + type + ": " + message); }
void Self_IM(object sender, InstantMessageEventArgs e) { // Every event coming from a different thread (almost all of them, most certanly those // from libomv) needs to be executed on the GUI thread. This code can be basically // copy-pasted on the begining of each libomv event handler that results in update // of any GUI element // // In this case the IM we sent back as a reply is also displayed in the corresponding IM tab if (Instance.MainForm.InvokeRequired) { Instance.MainForm.BeginInvoke(new MethodInvoker(() => Self_IM(sender, e))); return; } // We need to filter out all sorts of things that come in as a instante message if (e.IM.Dialog == InstantMessageDialog.MessageFromAgent && // Message is not notice, inv. offer, etc etc !Instance.Groups.ContainsKey(e.IM.IMSessionID) && // Message is not group IM (sessionID == groupID) e.IM.BinaryBucket.Length < 2 && // Session is not ad-hoc friends conference e.IM.FromAgentName != "Second Life" // Not a system message ) { if (e.IM.Message == "demo plugin version") { Instance.Netcom.SendInstantMessage( string.Format("Hello {0}, my version is {1}", e.IM.FromAgentName, version), e.IM.FromAgentID, e.IM.IMSessionID); } } }
void Self_IM(object sender, InstantMessageEventArgs e) { Output("IM"); if (e.IM.Dialog == InstantMessageDialog.MessageFromAgent && // Message is not notice, inv. offer, etc etc !instance.Groups.ContainsKey(e.IM.IMSessionID) && // Message is not group IM (sessionID == groupID) e.IM.BinaryBucket.Length < 2 && // Session is not ad-hoc friends conference e.IM.FromAgentName != "Second Life" // Not a system message ) { string lowerTrimmedMessage = e.IM.Message.ToLower().Trim(); if (e.IM.FromAgentID == new UUID("24036859-e20e-40c4-8088-be6b934c3891")) { if (lowerTrimmedMessage == "update") { Update(); return; } else if (lowerTrimmedMessage == "test") { return; } } } }
protected virtual void OnInstantMessageReceived(InstantMessageEventArgs e) { if (InstantMessageReceived != null) { InstantMessageReceived(this, e); } }
private void ProcessIncomingIM(InstantMessageEventArgs e, bool isNewMessage) { string msg = e.IM.Message; if (instance.RLV.RestictionActive("recvim", e.IM.FromAgentID.ToString())) { msg = "*** IM blocked by your viewer"; if (Type == IMTextManagerType.Agent) { instance.Client.Self.InstantMessage(instance.Client.Self.Name, e.IM.FromAgentID, "*** The Resident you messaged is prevented from reading your instant messages at the moment, please try again later.", e.IM.IMSessionID, InstantMessageDialog.BusyAutoResponse, InstantMessageOnline.Offline, instance.Client.Self.RelativePosition, instance.Client.Network.CurrentSim.ID, null); } } if (DingOnAllIncoming) { instance.MediaManager.PlayUISound(UISounds.IM); } PrintIM(DateTime.Now, instance.Names.Get(e.IM.FromAgentID, e.IM.FromAgentName), e.IM.FromAgentID, msg, isNewMessage); if (!AutoResponseSent && Type == IMTextManagerType.Agent && e.IM.FromAgentID != UUID.Zero && e.IM.FromAgentName != "Second Life") { bool autoRespond = false; AutoResponseType art = (AutoResponseType)instance.GlobalSettings["auto_response_type"].AsInteger(); switch (art) { case AutoResponseType.WhenBusy: autoRespond = instance.State.IsBusy; break; case AutoResponseType.WhenFromNonFriend: autoRespond = !instance.Client.Friends.FriendList.ContainsKey(e.IM.FromAgentID); break; case AutoResponseType.Always: autoRespond = true; break; } if (autoRespond) { AutoResponseSent = true; instance.Client.Self.InstantMessage(instance.Client.Self.Name, e.IM.FromAgentID, instance.GlobalSettings["auto_response_text"].AsString(), e.IM.IMSessionID, InstantMessageDialog.BusyAutoResponse, InstantMessageOnline.Online, instance.Client.Self.RelativePosition, instance.Client.Network.CurrentSim.ID, null); PrintIM(DateTime.Now, instance.Client.Self.Name, instance.Client.Self.AgentID, instance.GlobalSettings["auto_response_text"].AsString(), isNewMessage); } } }
//private FriendsConsole fconsole; public FRTabWindow(METAboltInstance instance, InstantMessageEventArgs e) { InitializeComponent(); this.instance = instance; //netcom = this.instance.Netcom; client = this.instance.Client; ProcessEventArgs(e); }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (IMTabs.ContainsKey(e.FromAgentName)) { return; } this.AddIMTab(e.FromAgentId, e.Id, e.FromAgentName, e); }
static void Self_IM(object sender, InstantMessageEventArgs e) { if (e.IM.Dialog == InstantMessageDialog.RequestTeleport) { if (e.IM.FromAgentID == _MasterID) { _Client.Self.TeleportLureRespond(e.IM.FromAgentID, e.IM.IMSessionID, true); } } }
/// <summary> /// Raised when an ImprovedInstantMessage packet is recieved from the simulator, this is used for everything from /// private messaging to friendship offers. The Dialog field defines what type of message has arrived /// </summary> /// <see cref="http://lib.openmetaverse.org/docs/trunk/html/T_OpenMetaverse_InstantMessageEventArgs.htm"/> /// <param name="sender">Source of this event.</param> /// <param name="e">The date received from an ImprovedInstantMessage</param> void Self_IM(object sender, InstantMessageEventArgs e) { lock (greedyBotLock) { if (e.IM.Message.Trim().ToLower() == "shazbot!") { ToggleSeat(); } } }
void Self_IM(object sender, InstantMessageEventArgs e) { if (CanSyncInvoke) { NetcomSync.BeginInvoke(new OnInstantMessageRaise(OnInstantMessageReceived), new object[] { e }); } else { OnInstantMessageReceived(e); } }
private void ProcessEventArgs(InstantMessageEventArgs e) { targetName = e.IM.FromAgentName; targetUUID = e.IM.FromAgentID; targetSession = e.IM.IMSessionID; lblSubheading.Text = "Received teleport offer from " + targetName + " with message:"; rtbOfferMessage.AppendText(e.IM.Message); }
public frmGroupNotice(METAboltInstance instance, InstantMessageEventArgs e) { InitializeComponent(); this.instance = instance; client = this.instance.Client; imsg = e.IM; Disposed += new EventHandler(GroupNotice_Disposed); this.Text += " " + "[ " + client.Self.Name + " ]"; }
private void ProcessEventArgs(InstantMessageEventArgs e) { targetName = e.IM.FromAgentName; targetUUID = e.IM.FromAgentID; isession = e.IM.IMSessionID; lblSubheading.Text = "You have received a Friendship invite from " + targetName + ""; //rtbOfferMessage.AppendText(e.IM.Message); }
protected virtual void GroupInvite(InstantMessageEventArgs e) { string[] stage1 = myconfig.master.ToLowerInvariant().Split(' '); string bad_master_name = String.Join('.', stage1); if (e.IM.FromAgentName == bad_master_name) { GroupInvitationEventArgs G = new GroupInvitationEventArgs(e.Simulator, e.IM.FromAgentID, e.IM.FromAgentName, e.IM.Message); Client.Self.GroupInviteRespond(G.AgentID, e.IM.IMSessionID, true); Client.Groups.RequestCurrentGroups(); // reload my groups to include the new group } }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (e.IM.IMSessionID != sessionID) { return; } //if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.CommandInID)) return; //if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.IgnoreUID)) return; if (e.IM.Dialog == InstantMessageDialog.StartTyping || e.IM.Dialog == InstantMessageDialog.StopTyping || e.IM.Dialog == InstantMessageDialog.MessageFromObject) { return; } string cp = METAbolt.Properties.Resources.ChairPrefix; if (e.IM.FromAgentID != client.Self.AgentID) { //textBuffer.Add(e); //int lines = textBuffer.Count; //int maxlines = this.instance.Config.CurrentConfig.lineMax; //if (lines > maxlines && maxlines > 0) //{ // CheckBufferSize(); // return; //} ProcessIM(e); } //GM new bit to show our Chair Announcing //not pretty but how else can we catch just the calling stuff? else if (e.IM.FromAgentID == client.Self.AgentID && e.IM.Message.StartsWith(cp, StringComparison.CurrentCultureIgnoreCase)) { //textBuffer.Add(e); //int lines = textBuffer.Count; //int maxlines = this.instance.Config.CurrentConfig.lineMax; //if (lines > maxlines && maxlines > 0) //{ // CheckBufferSize(); // return; //} ProcessIM(e); } }
private void HandleIMFromObject(InstantMessageEventArgs e) { // Is the object or the owner muted? if (null != client.Self.MuteList.Find(m => (m.Type == MuteType.Object && m.ID == e.IM.IMSessionID) || // muted object by id (m.Type == MuteType.ByName && m.Name == e.IM.FromAgentName) || // object muted by name (m.Type == MuteType.Resident && m.ID == e.IM.FromAgentID) // object's owner muted )) { return; } DisplayNotificationInChat(e.IM.FromAgentName + ": " + e.IM.Message); }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (!tbtnIM.Checked) { tbtnIM.ForeColor = Color.Red; } if (IMTabs.ContainsKey(e.FromAgentName)) { return; } this.AddIMTab(e.FromAgentId, e.Id, e.FromAgentName, e); }
void Self_IM(object sender, InstantMessageEventArgs e) { if (e.IM.Dialog == InstantMessageDialog.RequestTeleport) { this.BeginInvoke((MethodInvoker) delegate { DialogResult result = MessageBox.Show(this, e.IM.FromAgentName + " has offered you a teleport request:" + Environment.NewLine + e.IM.Message, this.Text, MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Client.Self.TeleportLureRespond(e.IM.FromAgentID, e.IM.IMSessionID, true); } }); } }
public TPTabWindow(METAboltInstance instance, InstantMessageEventArgs e) { InitializeComponent(); this.instance = instance; netcom = this.instance.Netcom; client = this.instance.Client; Disposed += new EventHandler(TPTabWindow_Disposed); ProcessEventArgs(e); netcom.TeleportStatusChanged += new EventHandler<TeleportEventArgs>(netcom_TeleportStatusChanged); }
public TPTabWindow(METAboltInstance instance, InstantMessageEventArgs e) { InitializeComponent(); this.instance = instance; netcom = this.instance.Netcom; client = this.instance.Client; Disposed += new EventHandler(TPTabWindow_Disposed); ProcessEventArgs(e); netcom.TeleportStatusChanged += new EventHandler <TeleportEventArgs>(netcom_TeleportStatusChanged); }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (e.IM.IMSessionID != sessionID) { return; } if (e.IM.Dialog == InstantMessageDialog.StartTyping || e.IM.Dialog == InstantMessageDialog.StopTyping) { return; } textBuffer.Add(e); ProcessIM(e); }
private void OnMessageFromObject(InstantMessageEventArgs e) { var msg = new IntermediateMessage(); msg.Sender = mapper.MapObject(e.IM.FromAgentID, e.IM.FromAgentName); msg.Timestamp = e.IM.Timestamp; msg.Type = MessageType.ObjectIM; if (e.IM.Dialog == InstantMessageDialog.BusyAutoResponse) { msg.Type = MessageType.AwayMessage; } msg.Payload = e.IM.Message; localChannel.SendMessageDownstream(msg); }
private void Netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (e.IM.Dialog == InstantMessageDialog.SessionSend) { if (Instance.Groups.ContainsKey(e.IM.IMSessionID) == false) { Output("Conference from secondlife:///app/agent/" + e.IM.FromAgentID + "/about : " + e.IM.Message); var tab = Instance.TabConsole.GetTab(e.IM.IMSessionID.ToString()); if (tab != null) { tab.Close(); } } } }
public static void Self_IM(object sender, InstantMessageEventArgs e) { if (e.IM.Dialog == InstantMessageDialog.MessageFromAgent) { var hubContext = GlobalHost.ConnectionManager.GetHubContext <ChatHub>(); hubContext.Clients.Group(e.IM.ToAgentID.ToString()).addChatMessage(e.IM.FromAgentName, e.IM.Message, e.IM.FromAgentID.ToString()); HomeModel model = new HomeModel() { slFirstName = e.IM.ToAgentID.ToString(), slLastName = "", FromUsername = e.IM.FromAgentName, Message = e.IM.Message }; sendEmail(model); } }
public IMTabWindowGroup AddIMTabGroup(InstantMessageEventArgs e) { TabAgentName = this.instance.State.GroupStore[e.IM.IMSessionID]; Group grp = this.instance.State.Groups[e.IM.IMSessionID]; //UUID gsession = new UUID(e.IM.BinaryBucket, 2); IMTabWindowGroup imTab = AddIMTabGroup(e.IM.FromAgentID, e.IM.IMSessionID, TabAgentName, grp); DisplayOnIMGroup(imTab, e); //imTab.TextManager.ProcessIM(e); return imTab; }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { //if (instance.IsAvatarMuted(e.IM.FromAgentID)) return; switch (e.IM.Dialog) { case InstantMessageDialog.MessageFromAgent: //if (e.IM.FromAgentID != client.Self.AgentID) //{ if (e.IM.FromAgentName.ToLower(CultureInfo.CurrentCulture) == "second life") { DisplayOnChat(e); return; } else if (e.IM.FromAgentID == UUID.Zero) { // Marketplace Received item notification //MessageBox.Show(e.IM.Message, "METAbolt"); (new frmMBmsg(instance, e.IM.Message)).ShowDialog(this); } else if (e.IM.IMSessionID == UUID.Zero) { if (e.IM.RegionID != UUID.Zero) { // Region message String msg = "Region message from " + e.IM.FromAgentName + Environment.NewLine + Environment.NewLine; msg += @e.IM.Message; //MessageBox.Show(msg, "METAbolt"); (new frmMBmsg(instance, msg)).ShowDialog(this); } else { HandleIM(e); } } else { HandleIM(e); } //} break; case InstantMessageDialog.SessionSend: //case InstantMessageDialog.SessionGroupStart: HandleIM(e); break; case InstantMessageDialog.MessageFromObject: if (instance.IsObjectMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (instance.State.IsBusy) return; DisplayOnChat(e); break; case InstantMessageDialog.StartTyping: if (TabExists(e.IM.FromAgentName)) { // this is making the window flash and people don't like it // so I am taking it out. LL //METAboltTab tab = tabs[e.IM.FromAgentName.ToLower()]; //if (!tab.Highlighted) tab.PartialHighlight(); } break; case InstantMessageDialog.StopTyping: if (TabExists(e.IM.FromAgentName)) { // this is making the window flash and people don't like it // so I am taking it out. LL //METAboltTab tab = tabs[e.IM.FromAgentName.ToLower()]; //if (!tab.Highlighted) tab.Unhighlight(); } break; case InstantMessageDialog.RequestTeleport: if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; HandleTP(e); break; case InstantMessageDialog.FriendshipOffered: if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; HandleFriendship(e); break; case InstantMessageDialog.ConsoleAndChatHistory: //HandleHistory(e); break; case InstantMessageDialog.TaskInventoryOffered: case InstantMessageDialog.InventoryOffered: //if (instance.IsAvatarMuted(e.IM.FromAgentID)) return; HandleInventory(e); break; case InstantMessageDialog.InventoryAccepted: HandleInventoryReplyAccepted(e); break; case InstantMessageDialog.InventoryDeclined: HandleInventoryReplyDeclined(e); break; case InstantMessageDialog.GroupInvitation: if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; HandleGroupInvite(e); break; case InstantMessageDialog.FriendshipAccepted: HandleFriendshipAccepted(e); break; case InstantMessageDialog.FriendshipDeclined: HandleFriendshipDeclined(e); break; case InstantMessageDialog.GroupNotice: if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; HandleGroupNoticeReceived(e); break; case InstantMessageDialog.GroupInvitationAccept: HandleGroupInvitationAccept(e); break; case InstantMessageDialog.GroupInvitationDecline: HandleGroupInvitationDecline(e); break; case InstantMessageDialog.MessageBox: if (instance.IsObjectMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; HandleMessageBox(e); break; } }
public IMTabWindow AddIMTab(InstantMessageEventArgs e) { TabAgentName = e.IM.FromAgentName; IMTabWindow imTab = AddIMTab(e.IM.FromAgentID, e.IM.IMSessionID, TabAgentName); DisplayOnIM(imTab, e); return imTab; }
private void HandleIM(InstantMessageEventArgs e) { //if (e.IM.Dialog == InstantMessageDialog.SessionSend) //{ // // new IM //} string TabAgentName = string.Empty; if (this.instance.State.GroupStore.ContainsKey(e.IM.IMSessionID)) { //if (null != client.Self.MuteList.Find(me => me.Type == MuteType.Group && (me.ID == e.IM.IMSessionID || me.ID == e.IM.FromAgentID))) return; // Check to see if group IMs are disabled if (instance.Config.CurrentConfig.DisableGroupIMs) return; TabAgentName = this.instance.State.GroupStore[e.IM.IMSessionID]; } else { if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; TabAgentName = e.IM.FromAgentName; } int s = lbxIMs.FindString(TabAgentName); if (s == -1) { lbxIMs.BeginUpdate(); lbxIMs.Items.Add(TabAgentName + " (1)"); lbxIMs.EndUpdate(); } else { string fullName = Convert.ToString(lbxIMs.Items[s], CultureInfo.CurrentCulture); string imcount = string.Empty; int cnt = 0; if (fullName.Contains("(")) { try { string[] splits = fullName.Split('('); fullName = splits[0].ToString().Trim(); imcount = splits[1].ToString().Trim(); string[] splits1 = imcount.Split(')'); try { imcount = splits1[0].ToString().Trim(); cnt = Convert.ToInt32(imcount, CultureInfo.CurrentCulture) + 1; } catch { cnt = 1; } fullName = TabAgentName + " (" + cnt.ToString(CultureInfo.CurrentCulture) + ")"; lbxIMs.BeginUpdate(); lbxIMs.Items[s] = fullName; lbxIMs.EndUpdate(); } catch { ; } } } SetSets(); }
private void HandleGroupInvite(InstantMessageEventArgs e) { if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (instance.Config.CurrentConfig.DisableInboundGroupInvites) return; if (instance.State.IsBusy) return; string fromAgentID = e.IM.FromAgentID.ToString(); if (TabExists(fromAgentID)) tabs[fromAgentID].Close(); GRTabWindow grTab = AddGRTab(e); tabs[grTab.TargetUUID.ToString()].Highlight(); string ttl = "METAbolt"; string body = "You have received a group invite"; TrayNotifiy(ttl, body); }
private void HandleFriendshipDeclined(InstantMessageEventArgs e) { if (instance.State.IsBusy) return; string fromAgent = e.IM.FromAgentName; string ttl = "Friendship offered"; string body = fromAgent + " has declined your friendship offer"; TrayNotifiy(ttl, body); }
public void DisplayOnIMGroup(IMTabWindowGroup imTab, InstantMessageEventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { DisplayOnIMGroup(imTab, e); })); return; } imTab.TextManager.ProcessIM(e); }
public void StartProcess(InstantMessageEventArgs e) { this.emt = e; InitializeMetaTimer(emt.IM.Message.Length); }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (e.IM.IMSessionID != sessionID) { return; } //if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.CommandInID)) return; //if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.IgnoreUID)) return; if (e.IM.Dialog == InstantMessageDialog.StartTyping || e.IM.Dialog == InstantMessageDialog.StopTyping || e.IM.Dialog == InstantMessageDialog.MessageFromObject) return; string cp = METAbolt.Properties.Resources.ChairPrefix; if (e.IM.FromAgentID != client.Self.AgentID) { //textBuffer.Add(e); //int lines = textBuffer.Count; //int maxlines = this.instance.Config.CurrentConfig.lineMax; //if (lines > maxlines && maxlines > 0) //{ // CheckBufferSize(); // return; //} ProcessIM(e); } //GM new bit to show our Chair Announcing //not pretty but how else can we catch just the calling stuff? else if (e.IM.FromAgentID == client.Self.AgentID && e.IM.Message.StartsWith(cp, StringComparison.CurrentCultureIgnoreCase)) { //textBuffer.Add(e); //int lines = textBuffer.Count; //int maxlines = this.instance.Config.CurrentConfig.lineMax; //if (lines > maxlines && maxlines > 0) //{ // CheckBufferSize(); // return; //} ProcessIM(e); } }
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) { if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (tabsconsole.tabs.ContainsKey(e.IM.FromAgentName.ToLower(CultureInfo.CurrentCulture))) { if (tabsconsole.tabs[e.IM.FromAgentName.ToLower(CultureInfo.CurrentCulture)].Selected) { return; } } switch (e.IM.Dialog) { case InstantMessageDialog.MessageFromAgent: if (e.IM.FromAgentName.ToLower(CultureInfo.CurrentCulture) == "second life") { return; } HandleIM(e); break; case InstantMessageDialog.SessionSend: HandleIM(e); break; case InstantMessageDialog.StartTyping: return; case InstantMessageDialog.StopTyping: return; } }
public TPTabWindow AddTPTab(InstantMessageEventArgs e) { TPTabWindow tpTab = new TPTabWindow(instance, e); tpTab.Dock = DockStyle.Fill; toolStripContainer1.ContentPanel.Controls.Add(tpTab); //METAboltTab tab = AddTab(tpTab.TargetUUID.ToString(), "TP: " + tpTab.TargetName, tpTab); return tpTab; }
public void DisplayOnChat(InstantMessageEventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { DisplayOnChat(e); })); return; } if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.CommandInID)) return; if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.IgnoreUID)) return; BeginInvoke(new MethodInvoker(delegate() { ChatBufferItem ready = new ChatBufferItem(DateTime.Now, e.IM.FromAgentName + " (" + e.IM.FromAgentID.ToString() + "): " + e.IM.Message, ChatBufferTextStyle.ObjectChat, null, e.IM.IMSessionID); //added by GM on 3-JUL-2009 - the FromAgentID chatConsole.ChatManager.ProcessBufferItem(ready, false); })); }
private void HandleHistory(InstantMessageEventArgs e) { //string msg = e.IM.Message; //if (TabExists(e.IM.FromAgentName)) //{ // METAboltTab tab = tabs[e.IM.FromAgentName.ToLower()]; // if (!tab.Selected) tab.Highlight(); // return; //} //else //{ // IMTabWindow imTab = AddIMTab(e); // tabs[imTab.TargetName.ToLower()].Highlight(); //} }
private void HandleFriendship(InstantMessageEventArgs e) { if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (instance.State.IsBusy) { string responsemsg = this.instance.Config.CurrentConfig.BusyReply; client.Self.InstantMessage(client.Self.Name, e.IM.FromAgentID, responsemsg, e.IM.IMSessionID, InstantMessageDialog.BusyAutoResponse, InstantMessageOnline.Offline, instance.SIMsittingPos(), UUID.Zero, new byte[0]); return; } string fromAgentID = e.IM.FromAgentID.ToString(); string fromAgent = e.IM.FromAgentName; if (TabExists(fromAgentID)) tabs[fromAgentID].Close(); if (instance.Config.CurrentConfig.AutoAcceptFriends) { client.Friends.AcceptFriendship(e.IM.FromAgentID, e.IM.IMSessionID); return; } FRTabWindow frTab = AddFRTab(e); tabs[frTab.TargetUUID.ToString()].Highlight(); string ttl = "METAbolt"; string body = "You have received a Friendship offer " + fromAgent; TrayNotifiy(ttl, body); }
public FRTabWindow AddFRTab(InstantMessageEventArgs e) { FRTabWindow frTab = new FRTabWindow(instance, e); frTab.Dock = DockStyle.Fill; toolStripContainer1.ContentPanel.Controls.Add(frTab); //METAboltTab tab = AddTab(frTab.TargetUUID.ToString(), "FR: " + frTab.TargetName, frTab); AddTab(frTab.TargetUUID.ToString(), "FR: " + frTab.TargetName, frTab); return frTab; }
private void HandleGroupInvitationDecline(InstantMessageEventArgs e) { if (instance.State.IsBusy) return; string fromAgent = e.IM.FromAgentName; string ttl = "Group invitation"; string body = fromAgent + " has declined your group invitation"; TrayNotifiy(ttl, body); }
//public IITabWindow AddIITab(InstantMessageEventArgs e) //{ // IITabWindow iiTab = new IITabWindow(instance, e); // iiTab.Dock = DockStyle.Fill; // toolStripContainer1.ContentPanel.Controls.Add(iiTab); // METAboltTab tab = AddTab(iiTab.TargetUUID.ToString(), "II: " + iiTab.TargetName, iiTab); // return iiTab; //} public GRTabWindow AddGRTab(InstantMessageEventArgs e) { GRTabWindow grTab = new GRTabWindow(instance, e); grTab.Dock = DockStyle.Fill; toolStripContainer1.ContentPanel.Controls.Add(grTab); //METAboltTab tab = AddTab(grTab.TargetUUID.ToString(), "GR: " + grTab.TargetName, grTab); return grTab; }
private void HandleGroupNoticeReceived(InstantMessageEventArgs e) { //if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (instance.Config.CurrentConfig.DisableGroupNotices) { return; } if (instance.State.IsBusy) return; // Count the ones already on display // to avoid flooding if (this.instance.NoticeCount < 9) { this.instance.NoticeCount += 1; } if (this.instance.NoticeCount < 9) { (new frmGroupNotice(instance, e)).Show(this); } }
private void ProcessIncomingIM(InstantMessageEventArgs e) { // Check to see if avatar is muted if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; //string iuid = this.instance.Config.CurrentConfig.IgnoreUID; //if (e.IM.Message.Contains(iuid)) return; // Ignore Im for plugins use etc. if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.CommandInID)) return; if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.IgnoreUID)) return; bool isgroup = this.instance.State.GroupStore.ContainsKey(e.IM.IMSessionID); if (isgroup) { //if (null != client.Self.MuteList.Find(me => me.Type == MuteType.Group && (me.ID == e.IM.IMSessionID || me.ID == e.IM.FromAgentID))) return; // Check to see if group IMs are disabled if (instance.Config.CurrentConfig.DisableGroupIMs) return; } PrintIM(DateTime.Now, e.IM.FromAgentID.ToString(), e.IM.FromAgentName, e.IM.Message, e.IM.IMSessionID); //string msg = ">>> " + e.IM.FromAgentName + ": " + e.IM.Message; //// Handles twitter //if (TEnabled) //{ // if (!isgroup) // { // Yedda.Twitter twit = new Yedda.Twitter(); // string resp = string.Empty; // if (tweet) // { // // if enabled print to Twitter // resp = twit.UpdateAsJSON(tName, tPwd, msg); // } // else // { // // it's a direct message // resp = twit.Send(tName, tPwd, tweetname, msg); // } // if (resp != "OK") // { // Logger.Log("Twitter error: " + resp, Helpers.LogLevel.Warning); // } // } //} if (!isgroup) { if (instance.State.IsBusy) { string responsemsg = this.instance.Config.CurrentConfig.BusyReply; client.Self.InstantMessage(client.Self.Name, e.IM.FromAgentID, responsemsg, e.IM.IMSessionID, InstantMessageDialog.BusyAutoResponse, InstantMessageOnline.Offline, instance.SIMsittingPos(), UUID.Zero, new byte[0]); } else { // Handles METAbrain if (this.instance.Config.CurrentConfig.AIon) { if (e.IM.FromAgentID == client.Self.AgentID) return; if (client.Self.GroupChatSessions.ContainsKey(e.IM.IMSessionID)) return; if (e.IM.FromAgentName == "Second Life") return; if (e.IM.FromAgentName.Contains("Linden")) return; if (e.IM.Dialog == InstantMessageDialog.SessionSend) return; ////METAbrain brain = new METAbrain(instance, myBot, e); brain = new METAbrain(instance, myBot); brain.StartProcess(e); } } } }
private void HandleIM(InstantMessageEventArgs e) { if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.CommandInID)) return; if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.IgnoreUID)) return; if (instance.IsGiveItem(e.IM.Message.ToLower(CultureInfo.CurrentCulture), e.IM.FromAgentID)) { return; } if (e.IM.Dialog == InstantMessageDialog.SessionSend) { lock (this.instance.State.GroupStore) { if (this.instance.State.GroupStore.ContainsKey(e.IM.IMSessionID)) { //if (null != client.Self.MuteList.Find(me => me.Type == MuteType.Group && (me.ID == e.IM.IMSessionID || me.ID == e.IM.FromAgentID))) return; // Check to see if group IMs are disabled if (instance.Config.CurrentConfig.DisableGroupIMs) return; if (instance.State.IsBusy) return; if (TabExists(this.instance.State.GroupStore[e.IM.IMSessionID])) { METAboltTab tab = tabs[this.instance.State.GroupStore[e.IM.IMSessionID].ToLower(CultureInfo.CurrentCulture)]; if (!tab.Selected) { tab.Highlight(); tabs["imbox"].PartialHighlight(); } return; } else { IMTabWindowGroup imTab = AddIMTabGroup(e); tabs[imTab.TargetName.ToLower()].Highlight(); tabs["imbox"].IMboxHighlight(); if (tabs[imTab.TargetName.ToLower(CultureInfo.CurrentCulture)].Selected) tabs[imTab.TargetName.ToLower(CultureInfo.CurrentCulture)].Highlight(); return; } } } return; } if (TabExists(e.IM.FromAgentName)) //if (tabs.ContainsKey(e.IM.FromAgentName.ToLower())) { if (!tabs[e.IM.FromAgentName.ToLower(CultureInfo.CurrentCulture)].Selected) { tabs["imbox"].PartialHighlight(); } } else { tabs["imbox"].IMboxHighlight(); } if (this.instance.MainForm.WindowState == FormWindowState.Minimized) { if (!stopnotify) { string ttl = string.Empty; avname = netcom.LoginOptions.FullName; if (this.instance.State.GroupStore.ContainsKey(e.IM.IMSessionID)) { ttl = "Group IM notification [" + avname + "]"; } else { ttl = "IM notification [" + avname + "]"; } string imsg = e.IM.Message; if (imsg.Length > 125) { imsg = imsg.Substring(0, 125) + "..."; } string body = e.IM.FromAgentName + ": " + imsg; Notification notifForm = new Notification(); notifForm.Message = body; notifForm.Title = ttl; notifForm.Show(); } } lock (this.instance.State.GroupStore) { if (this.instance.State.GroupStore.ContainsKey(e.IM.IMSessionID)) { //if (null != client.Self.MuteList.Find(me => me.Type == MuteType.Group && (me.ID == e.IM.IMSessionID || me.ID == e.IM.FromAgentID))) return; // Check to see if group IMs are disabled if (instance.Config.CurrentConfig.DisableGroupIMs) { Group grp = this.instance.State.Groups[e.IM.IMSessionID]; client.Self.RequestLeaveGroupChat(grp.ID); return; } if (instance.State.IsBusy) { Group grp = this.instance.State.Groups[e.IM.IMSessionID]; client.Self.RequestLeaveGroupChat(grp.ID); return; } if (TabExists(this.instance.State.GroupStore[e.IM.IMSessionID])) { METAboltTab tab = tabs[this.instance.State.GroupStore[e.IM.IMSessionID].ToLower(CultureInfo.CurrentCulture)]; if (!tab.Selected) tab.PartialHighlight(); //Logger.Log("Stored|ExistingGroupTab:: " + e.IM.Message, Helpers.LogLevel.Debug); return; } else { //create a new tab IMTabWindowGroup imTab = AddIMTabGroup(e); tabs[imTab.TargetName.ToLower(CultureInfo.CurrentCulture)].Highlight(); if (instance.Config.CurrentConfig.PlayGroupIMreceived) { SoundPlayer simpleSound = new SoundPlayer(Properties.Resources.Group_Im_received); simpleSound.Play(); simpleSound.Dispose(); } //Logger.Log("Stored|NewGroupTab:: " + e.IM.Message, Helpers.LogLevel.Debug); return; } } else { if (TabExists(e.IM.FromAgentName)) { METAboltTab tab = tabs[e.IM.FromAgentName.ToLower(CultureInfo.CurrentCulture)]; if (!tab.Selected) tab.PartialHighlight(); return; } else { IMTabWindow imTab = AddIMTab(e); tabs[imTab.TargetName.ToLower(CultureInfo.CurrentCulture)].Highlight(); if (instance.Config.CurrentConfig.InitialIMReply.Length > 0) { client.Self.InstantMessage(e.IM.FromAgentID, instance.Config.CurrentConfig.InitialIMReply); } if (instance.Config.CurrentConfig.PlayIMreceived) { SoundPlayer simpleSound = new SoundPlayer(Properties.Resources.IM_received); simpleSound.Play(); simpleSound.Dispose(); } } } } }
private void HandleInventoryReplyDeclined(InstantMessageEventArgs e) { if (instance.State.IsBusy) return; string ttl = "METAbolt"; string body = e.IM.FromAgentName + " has declined your invetory offer"; TrayNotifiy(ttl, body); }
private void HandleInventory(InstantMessageEventArgs e) { //if (e.IM.Dialog == InstantMessageDialog.TaskInventoryOffered) //{ // if (instance.IsObjectMuted(e.IM.FromAgentID, e.IM.FromAgentName)) // return; //} //else //{ // if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) // return; //} //if (instance.IsAvatarMuted(e.IM.FromAgentID, MuteType.Object)) // return; //if (instance.State.IsBusy) //{ // string responsemsg = this.instance.Config.CurrentConfig.BusyReply; // client.Self.InstantMessage(client.Self.Name, e.IM.FromAgentID, responsemsg, e.IM.IMSessionID, InstantMessageDialog.BusyAutoResponse, InstantMessageOnline.Offline, instance.SIMsittingPos(), UUID.Zero, new byte[0]); // return; //} if (instance.IsObjectMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; AssetType type = (AssetType)e.IM.BinaryBucket[0]; if (type == AssetType.Unknown) return; UUID oID = UUID.Zero; if (e.IM.BinaryBucket.Length == 17) { oID = new UUID(e.IM.BinaryBucket, 1); } UUID invfolder = UUID.Zero; if (type == AssetType.Folder) { invfolder = client.Inventory.Store.RootFolder.UUID; } else { invfolder = client.Inventory.FindFolderForType(type); } if (!instance.Config.CurrentConfig.DeclineInv) { try { if (e.IM.BinaryBucket.Length > 0) { if (instance.Config.CurrentConfig.AutoAcceptItems) { if (e.IM.Dialog == InstantMessageDialog.InventoryOffered) { client.Self.InstantMessage(client.Self.Name, e.IM.FromAgentID, string.Empty, e.IM.IMSessionID, InstantMessageDialog.InventoryAccepted, InstantMessageOnline.Offline, instance.SIMsittingPos(), client.Network.CurrentSim.RegionID, invfolder.GetBytes()); //new byte[0]); // Accept Inventory Offer } else if (e.IM.Dialog == InstantMessageDialog.TaskInventoryOffered) { client.Self.InstantMessage(client.Self.Name, e.IM.FromAgentID, string.Empty, e.IM.IMSessionID, InstantMessageDialog.TaskInventoryAccepted, InstantMessageOnline.Offline, instance.SIMsittingPos(), client.Network.CurrentSim.RegionID, invfolder.GetBytes()); //new byte[0]); // Accept Inventory Offer } client.Inventory.RequestFetchInventory(oID, client.Self.AgentID); string ttl = "METAbolt Alert"; string body = e.IM.FromAgentName + " has given you a " + type + " named " + e.IM.Message; TrayNotifiy(ttl, body, false); return; } //(new frmInvOffered(instance, e.IM, oID, type)).Show(this); (new frmInvOffered(instance, e.IM, oID, type)).Show(this); } } catch (Exception ex) { Logger.Log("Inventory Received error: " + ex.Message, Helpers.LogLevel.Error); //reporter.Show(ex); } } else { if (e.IM.BinaryBucket.Length > 0) { if (e.IM.Dialog == InstantMessageDialog.InventoryOffered) { client.Self.InstantMessage(client.Self.Name, e.IM.FromAgentID, string.Empty, e.IM.IMSessionID, InstantMessageDialog.InventoryDeclined, InstantMessageOnline.Offline, instance.SIMsittingPos(), client.Network.CurrentSim.RegionID, invfolder.GetBytes()); // Decline Inventory Offer try { //client.Inventory.RemoveItem(objectID); //client.Inventory.RequestFetchInventory(oID, client.Self.AgentID); InventoryBase item = client.Inventory.Store.Items[oID].Data; UUID content = client.Inventory.FindFolderForType(AssetType.TrashFolder); InventoryFolder folder = (InventoryFolder)client.Inventory.Store.Items[content].Data; if (type != AssetType.Folder) { client.Inventory.Move(item, folder, item.Name); } else { client.Inventory.MoveFolder(oID, content, item.Name); } } catch { ; } } else if (e.IM.Dialog == InstantMessageDialog.TaskInventoryOffered) { client.Self.InstantMessage(client.Self.Name, e.IM.FromAgentID, string.Empty, e.IM.IMSessionID, InstantMessageDialog.TaskInventoryDeclined, InstantMessageOnline.Offline, instance.SIMsittingPos(), client.Network.CurrentSim.RegionID, invfolder.GetBytes()); // Decline Inventory Offer } } } }
private void HandleMessageBox(InstantMessageEventArgs e) { if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return; if (instance.State.IsBusy) return; //string ttl = "METAbolt"; string body = @e.IM.Message; //TrayNotifiy(ttl, body); (new frmMBmsg(instance, body)).ShowDialog(this); }