/// <summary> /// All message for money actually go through this function. Which also update the balance /// </summary> /// <param name="toId"></param> /// <param name="message"></param> /// <param name="goDeep"></param> /// <param name="transactionId"></param> /// <returns></returns> public bool SendGridMessage(UUID toId, string message, bool goDeep, UUID transactionId) { if (!m_options.DisplayPayMessages) { message = ""; } if (Scene == null) { return((goDeep) && m_connector.SendGridMessage(toId, message, false, transactionId)); } IDialogModule dialogModule = Scene.RequestModuleInterface <IDialogModule>(); if (dialogModule != null) { IClientAPI icapiTo = GetUserClient(toId); if ((message.IndexOf("http") > -1) && (icapiTo != null)) { icapiTo.SendMoneyBalance(transactionId, true, new byte[0], (int)m_connector.UserCurrencyInfo(icapiTo.AgentId).Amount); dialogModule.SendUrlToUser(toId, "", UUID.Zero, UUID.Zero, false, message, message.Substring(message.IndexOf("http"))); icapiTo.SendAlertMessage(message.Substring(message.IndexOf("http"))); } else if (icapiTo != null) { icapiTo.SendMoneyBalance(transactionId, true, Utils.StringToBytes(message), (int)m_connector.UserCurrencyInfo(icapiTo.AgentId).Amount); } else { dialogModule.SendAlertToUser(toId, message); } return(true); } return((goDeep) && m_connector.SendGridMessage(toId, message, false, transactionId)); }
public void LoadUrl(IObject sender, string message, string url) { IDialogModule dm = m_rootScene.RequestModuleInterface <IDialogModule>(); if (dm != null) { dm.SendUrlToUser(GetSP().UUID, sender.Name, sender.GlobalID, GetSP().UUID, false, message, url); } }
public DateTime llLoadURL(string avatar_id, string message, string url) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(DateTime.Now); } IDialogModule dm = World.RequestModuleInterface <IDialogModule>(); if (null != dm) { dm.SendUrlToUser( new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url); } return(PScriptSleep(m_sleepMsOnLoadURL)); }
private Hashtable userInteract(Hashtable requestData) { Hashtable rparms = new Hashtable(); try { UUID receiverUUID = UUID.Parse((string)requestData["receiverUUID"]); Int32 type = Int32.Parse((string)requestData["type"]); String payloadID = (string)requestData["payloadID"]; Dictionary <string, string> d = new Dictionary <string, string>(); d.Add("method", "getNotificationMessage"); d.Add("payloadID", payloadID); Dictionary <string, string> messageItems = CommunicationHelpers.DoRequest(gatewayURL, d); if (messageItems == null) { throw new Exception("Could not fetch payload with ID " + payloadID); } m_log.Debug("[OMECONOMY] userInteract*:"); foreach (KeyValuePair <string, string> pair in messageItems) { m_log.Debug("[OMECONOMY] " + pair.Key + " " + pair.Value); } IClientAPI client = SceneHandler.Instance.LocateClientObject(receiverUUID); if (client == null) { throw new Exception("Could not locate the specified avatar"); } Scene userScene = SceneHandler.Instance.GetSceneByUUID(client.Scene.RegionInfo.originRegionID); if (userScene == null) { throw new Exception("Could not locate the specified scene"); } String message = messageItems["message"]; UUID senderUUID = UUID.Zero; String senderName = String.Empty; IDialogModule dm = null; IClientAPI sender = null; IUserManagement userManager = SceneHandler.Instance.GetRandomScene().RequestModuleInterface <IUserManagement>(); if (userManager == null) { throw new Exception("Could not locate UserMangement Interface"); } switch (type) { case (int)NotificationType.LOAD_URL: String url = messageItems["url"]; dm = userScene.RequestModuleInterface <IDialogModule>(); dm.SendUrlToUser(receiverUUID, "OMEconomy", UUID.Zero, UUID.Zero, false, message, url); break; case (int)NotificationType.CHAT_MESSAGE: senderUUID = UUID.Parse(messageItems["senderUUID"]); senderName = userManager.GetUserName(senderUUID); client.SendChatMessage( message, (byte)ChatTypeEnum.Say, Vector3.Zero, senderName, senderUUID, senderUUID, (byte)ChatSourceType.Agent, (byte)ChatAudibleLevel.Fully); sender = SceneHandler.Instance.LocateClientObject(senderUUID); if (sender != null) { sender.SendChatMessage( message, (byte)ChatTypeEnum.Say, Vector3.Zero, senderName, senderUUID, senderUUID, (byte)ChatSourceType.Agent, (byte)ChatAudibleLevel.Fully); } break; case (int)NotificationType.ALERT: dm = userScene.RequestModuleInterface <IDialogModule>(); dm.SendAlertToUser(receiverUUID, message); break; case (int)NotificationType.DIALOG: client.SendBlueBoxMessage(UUID.Zero, "", message); break; case (int)NotificationType.GIVE_NOTECARD: break; case (int)NotificationType.INSTANT_MESSAGE: senderUUID = UUID.Parse(messageItems["senderUUID"]); UUID sessionUUID = UUID.Parse(messageItems["sessionUUID"]); if (messageItems.ContainsKey("senderName")) { senderName = messageItems["senderName"]; } else { senderName = userManager.GetUserName(UUID.Parse((string)messageItems["senderUUID"])); } GridInstantMessage msg = new GridInstantMessage(); msg.fromAgentID = senderUUID.Guid; msg.toAgentID = receiverUUID.Guid; msg.imSessionID = sessionUUID.Guid; msg.fromAgentName = senderName; msg.message = (message != null && message.Length > 1024) ? msg.message = message.Substring(0, 1024) : message; msg.dialog = (byte)InstantMessageDialog.MessageFromAgent; msg.fromGroup = false; msg.offline = (byte)0; msg.ParentEstateID = 0; msg.Position = Vector3.Zero; msg.RegionID = userScene.RegionInfo.RegionID.Guid; client.SendInstantMessage(msg); sender = SceneHandler.Instance.LocateClientObject(senderUUID); if (sender != null) { sender.SendInstantMessage(msg); } break; default: break; } rparms["success"] = true; } catch (Exception e) { m_log.ErrorFormat("[OMECONOMY]: userInteract() Exception: {1} - {2}", Name, e.Message, e.StackTrace); rparms["success"] = false; } return(rparms); }