Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Add feature to get categories, filters, rules in the IRC backend itself #54

Merged
merged 11 commits into from Mar 28, 2015
Merged

Add feature to get categories, filters, rules in the IRC backend itself #54

merged 11 commits into from Mar 28, 2015

Conversation

sayanchowdhury
Copy link
Contributor

No description provided.

@ralphbean
Copy link
Contributor

This is really neat :) Thanks for working on it!

In review, I found a couple bugs though.

  • The first one is that you need to close any sessions that you open with the db, otherwise those will pile up over time:
diff --git a/fmn/consumer/backends/irc.py b/fmn/consumer/backends/irc.py
index bbf76f7..5c1f4b5 100644
--- a/fmn/consumer/backends/irc.py
+++ b/fmn/consumer/backends/irc.py
@@ -253,6 +253,7 @@ class IRCBackend(BaseBackend):
         if pref is None:
             self.send(nick,
                       'The nick is not configured with Fedora Notifications')
+            sess.close()
             return

         subcmd_string = message.rsplit(None, 1)[1].lower()
@@ -277,6 +278,7 @@ class IRCBackend(BaseBackend):
                 filtr = pref.get_filter_name(sess, subcmd_string)
             except ValueError:
                 self.send(nick, 'Not a valid filter')
+                sess.close()
                 return

             rules = filtr.rules
@@ -302,6 +304,7 @@ class IRCBackend(BaseBackend):
                             value=value
                         ))
                 self.send(nick, '-*'*10)
+        sess.close()

     def cmd_help(self, nick, message):
         self.log.info("CMD help:  %r sent us %r" % (nick, message))
@@ -421,7 +424,7 @@ class IRCBackend(BaseBackend):


 class IRCBackendProtocol(twisted.words.protocols.irc.IRCClient):
-    lineRate = 0.6
+    lineRate = 0.9
     sourceURL = "http://github.com/fedora-infra/fmn"

     @property
  • Second, when you ask it to list filters it says this:
13:39:08 threebean │ list filters
13:39:10  threebot │ You have 6 rule filter(s)
...

Can you have it say "you have 6 filter(s)" instead of "you have 6 rule filter(s)". People seem to get reasonably confused about the difference between filters and rules.. and if we can help keep them separate and distinct in all the UI language, that might help.

  • Lastly, I don't think I can get it to list the rules on a filter that has a name with spaces in it. I have a filter named "github stuff" but neither of these worked:
13:39:55 threebean │ list filters github stuff
13:39:57  threebot │ Not a valid filter
13:40:01 threebean │ list filters "github stuff"
13:40:03  threebot │ Not a valid filter

@sayanchowdhury
Copy link
Contributor Author

@ralphbean i fixed the bugs you reported. Now both list filters github stuff and list filters "github stuff" will work. In case of mixed single and double quotations it would return Not a valid filter. Please review the modified code.

@ralphbean
Copy link
Contributor

Looks good to me @sayanchowdhury. Let's merge it!

ralphbean added a commit that referenced this pull request Mar 28, 2015
Add feature to get categories, filters, rules in the IRC backend itself
@ralphbean ralphbean merged commit f75c571 into fedora-infra:develop Mar 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants