Ada Young avatar Ada Young committed 7fb710f

Now using DISTINCT for endpoints, added alias and function stub for orphans

Comments (0)

Files changed (1)

     WarpDB:export [<area name>] - Export all outgoing warps from a given area
     WarpDB:import - Import a list of warps exported by the above alias
 
-    WarpDB:orphans - Display a list of warps who's destination area is not in the database
+    WarpDB:orphans - Display a list of outgoing warps from your location who's destination area is not in the database
 
 The plugin will ask you for a file location on first load, just point it wherever you want your database file to be created. If you get "OperationalError: database is locked" error while trying to add an entry, please delete the .journal file in %APPDATA%\MUSHClient to resolve the issue.
 ]]>
 WarpsTo(EndPoints(areaname), toarea)
   </send>
   </trigger>
+  <trigger
+   group="WarpDB"
+   enabled="n"
+   keep_evaluating="y"
+   match="^Your environment conforms to that of (.+)\.$"
+   name="SurveyEndOrphans"
+   regexp="y"
+   send_to="12"
+   sequence="900"
+  >
+  <send>
+world.EnableTrigger("SurveyLine", False)
+world.EnableTrigger("SurveyEndOrphans", False)
+DisplayOrphans(areaname)
+  </send>
+  </trigger>
 </triggers>
 
 <!--  Aliases  -->
   </send>
   </alias>
   <alias
+   match="^WarpDB:orphans$"
+   enabled="y"
+   group="WarpDB"
+   regexp="y"
+   send_to="12"
+   ignore_case="y"
+   sequence="100"
+  >
+  <send>
+world.EnableTrigger("SurveyLine", True)
+world.EnableTrigger("SurveyEndOrphans", True)
+world.Send("SURVEY")
+  </send>
+  </alias>
+  <alias
    match="^WarpDB:export (.+)$"
    enabled="y"
    group="WarpDB"
     else:
         Note("WarpDB: No warps have been recorded for this area, try WarpDB:sources here.")
         return
-    cursor.execute("SELECT b1.source, b1.destination, b2.source_areaid FROM warplist as b1 JOIN warplist as b2 ON b1.source=b2.destination WHERE b1.source_areaid=?", (areaid, ))
+    cursor.execute("SELECT DISTINCT b1.source, b1.destination, b2.source_areaid FROM warplist as b1 JOIN warplist as b2 ON b1.source=b2.destination WHERE b1.source_areaid=?", (areaid, ))
     return cursor.fetchall()
 
 def DisplayEndPoints(results):
     else:
         Note("WarpDB: No recorded warps lead from here to [%s], try WarpDB:sources here and in the destination area to link the two." % areaname)
 
+def DisplayOrphans(areaname):
+    cursor.execute("SELECT id FROM arealist WHERE areaname=?", (areaname, ))
+    results = cursor.fetchall()
+    if not len(results) > 0:
+        Note("WarpDB: No warps have been recorded in this area, try WarpDB:sources to begin.")
+        return
+    else:
+        areaid = results[0][0]
+
+    Note("WarpDB: TODO: Implement DisplayOrphans()")
+
 def DumpData(areaname):
     areaname = ValidateArea(areaname)
     if areaname is None: # bail out
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.