OSDN Git Service

comments and line breaks
[radegast/radegast.git] / plugins / Radegast.Plugin.EVOVend / EVOvendPlugin.cs
index a5c2b77..975bb1a 100644 (file)
@@ -47,7 +47,8 @@ namespace Radegast.Plugin.EVOVend
         private InventoryManager Manager;
         private OpenMetaverse.Inventory Inventory;
 
-        private string vendURL = @"http://evosl.org/TREK/SL/index.php";
+        private string vendURL = @"http://evosl.org/TREK/SL/SLvendor.php";
+       private string loginURL = @"http://evosl.org/TREK/SL/vendor.php";
         List<InventoryBase> searchRes = new List<InventoryBase>();
 
         /*private GridClient Client { get { return instance.Client; } }*/
@@ -97,7 +98,6 @@ namespace Radegast.Plugin.EVOVend
             if (offeredObject != e.Item.UUID) return;
             if (offeredAgent == UUID.Zero)
             {
-                instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Failed to insert. Agent UUID not found", ChatBufferTextStyle.Error);
                 return;
             }
             
@@ -111,14 +111,22 @@ namespace Radegast.Plugin.EVOVend
             else
                 param.Add("price", "0");
             param.Add("texture", "");
-
+            param.Add("botUUID", client.Self.AgentID.ToString());
             string str = this.RequestVendor("ADDPRODUCT", param);
-            int result = Int32.Parse(str);
+            int result;
+
+            Int32.TryParse(str, out result);
 
-            if(result > 0)
+            if(result > 0){
                 instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Product " + e.Item.Name + " from Agent " + offeredAgent.ToString() + " accepted and inserted", ChatBufferTextStyle.StatusBlue);
+                client.Self.InstantMessage(offeredAgent, "Your Object has been transfered successfully. Please visit " + this.loginURL + " for further steps");
+            }
             else
-                instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Failed to insert " + e.Item.Name + " from Agent " + offeredAgent.ToString(), ChatBufferTextStyle.Error);
+            {
+                // if there is ANY error, delete the object
+                instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": ADDPRODUCT FAILED\n" + str + "\n\n[ITEM: " + e.Item.Name + " AGENT: " + offeredAgent.ToString() + "]", ChatBufferTextStyle.Error);
+                client.Inventory.RemoveItem(e.Item.UUID);
+            }
 
             offeredAgent = UUID.Zero;
         }
@@ -425,8 +433,10 @@ namespace Radegast.Plugin.EVOVend
             isSending = true;
             
             Inventory.RootFolder.OwnerID = client.Self.AgentID;
-
-            var strContent = this.RequestVendor("GETOUTSTANDING");
+            
+            Dictionary<string, string> param = new Dictionary<string, string>();
+            param.Add("botUUID", client.Self.AgentID.ToString());
+            var strContent = this.RequestVendor("GETOUTSTANDING", param);
             List<DeliveryQueue> queue = this.parseResponse(strContent);
             instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": " + queue.Count + " Items in Queue List");