コード例 #1
0
 def getShare(self, user, channel, msg):
     share = Share.by_name(msg.lower())
     if share is not None:
         line = "%s: %s" % (share.name, share.private_key)
         if share.read_only:
             line += " (read only)"
         self.display(user, channel, line)
     else:
         self.display(user, channel, "Share not found with name '%s'" % msg.lower())
         searchResults = len(Share.by_search(msg.lower()))
         if 0 < searchResults <= 10:
             self.display(user, channel, "%d similar share(s) found via search" % searchResults)
コード例 #2
0
 def search(self, user, channel, msg):
     ''' Search for shares in the database '''
     logging.info("Searching for '%s'" % msg)
     if len(msg) <= 2:
         self.display(user, channel, "Search term too short") 
     else:
         shares = Share.by_search(msg)
         if shares is None or 0 == len(shares):
             self.display(user, channel, "No results found")
         elif len(shares) <= 10:
             self.display(user, channel, " [Creator] Share Name : Share Private Key")
             self.display(user, channel, "------------------------------------------")
             for share in shares:
                 self.display(user, channel, str(share))
         else:
             self.display(user, channel, "Too many results, narrow your search")