pvl.irk: Irker.target(..., join=...)
authorTero Marttila <terom@paivola.fi>
Sun, 13 Jan 2013 04:52:33 +0200
changeset 134 99a8987fc424
parent 133 6365568b4a5a
child 135 ca66a4612e18
pvl.irk: Irker.target(..., join=...)
pvl/irk.py
--- a/pvl/irk.py	Sun Jan 13 04:37:46 2013 +0200
+++ b/pvl/irk.py	Sun Jan 13 04:52:33 2013 +0200
@@ -188,11 +188,11 @@
             Send on current irker connection.
 
             TODO: handle errors and reconnect?
-        """
+            """
 
         self.irk(**opts)
 
-    def __getitem__ (self, target) :
+    def target (self, target, join=True) :
         """
             Bind to given target URL, returning an IrkerTarget for sending messages.
         """
@@ -202,9 +202,13 @@
                     notice  = self.options and self.options.irker_notice,
                     part    = self.options and self.options.irker_part,
             )
-            self.targets[target].join()
+
+            if join :
+                self.targets[target].join()
             
         return self.targets[target]
+    
+    __getitem__ = target
 
     def __delitem__ (self, target) :
         """