chiark / gitweb /
Add new `knock' protocol.
[tripe] / mon / tripemon.in
index 7f48bd29c2925d8cb84ea6f21065b6ce5641dd93..0d15474ca335d82b8e3001eb586ab09d79dfc606 100644 (file)
@@ -40,7 +40,7 @@ import re as RX
 from cStringIO import StringIO
 
 try:
-  if OS.getenv('TRIPEMON_FORCE_GI'): raise ImportError
+  if OS.getenv('TRIPEMON_FORCE_GI'): raise ImportError()
   import pygtk
   pygtk.require('2.0')
   import gtk as G
@@ -773,7 +773,7 @@ class ValidatingEntry (G.Entry):
     ValidationError.
     """
     if not me.validp:
-      raise ValidationError
+      raise ValidationError()
     return G.Entry.get_text(me)
 
 def numericvalidate(min = None, max = None):
@@ -1055,7 +1055,7 @@ class AddPeerDialog (MyDialog):
     table = GridPacker()
     me.vbox.pack_start(table, True, True, 0)
     me.e_name = table.labelled('Name',
-                               ValidatingEntry(r'^[^\s.:]+$', '', 16),
+                               ValidatingEntry(r'^[^\s:]+$', '', 16),
                                width = 3)
     me.e_addr = table.labelled('Address',
                                ValidatingEntry(r'^[a-zA-Z0-9.-]+$', '', 24),
@@ -1098,6 +1098,9 @@ class AddPeerDialog (MyDialog):
     me.c_privkey, me.e_privkey = \
       optional_entry('Private key tag', r'^[^.:\s]+$', 16)
 
+    me.c_knock, me.e_knock = \
+      optional_entry('Knock string', r'^[^:\s]+$', 16)
+
     me.show_all()
 
   def ok(me):
@@ -1115,7 +1118,9 @@ class AddPeerDialog (MyDialog):
                   key = (me.c_peerkey.get_active() and
                          me.e_peerkey.get_text() or None),
                   priv = (me.c_privkey.get_active() and
-                          me.e_privkey.get_text() or None))
+                          me.e_privkey.get_text() or None),
+                  knock = (me.c_knock.get_active() and
+                           me.e_knock.get_text() or None))
     except ValidationError:
       GDK.beep()
       return