#!/usr/bin/python
import sys
import telepathy
from telepathy.interfaces import CONN_MGR_INTERFACE

if len(sys.argv) >= 2:
    manager_name = sys.argv[1]
else:
    manager_name = "haze"
service_name = "org.freedesktop.Telepathy.ConnectionManager.%s" % manager_name
object_path = "/org/freedesktop/Telepathy/ConnectionManager/%s" % manager_name

object = telepathy.client.ConnectionManager(service_name, object_path)
manager = object[CONN_MGR_INTERFACE]

print "[ConnectionManager]"
print "BusName=%s" % service_name
print "ObjectPath=%s" % object_path
print

protocols = manager.ListProtocols()
protocols.sort()
for protocol in protocols:
    print "[Protocol %s]" % protocol
    for param in manager.GetParameters(protocol):
        print "param-%s=%s" % (param[0], param[2]),
        # FIXME: deal with the "register" flag
        if param[1] == 1L:
            print "required",
        print
    print

@@ -90,16 +90,141 @@
 NTERFACE
+%0Afrom telepathy.constants import CONN_MGR_PARAM_FLAG_REQUIRED, %5C%0A                                CONN_MGR_PARAM_FLAG_REGISTER
 %0A%0Aif len
@@ -855,124 +855,216 @@
     
-print %22param-%25s=%25s%22 %25 (param%5B0%5D, param%5B2%5D),%0A        # FIXME: deal with the %22register%22 flag%0A        if param%5B1%5D == 1L
+(name, flags, type, default) = param%0A%0A        print %22param-%25s=%25s%22 %25 (name, type),%0A        if flags & CONN_MGR_PARAM_FLAG_REQUIRED:%0A            print %22required%22,%0A        if flags & CONN_MGR_PARAM_FLAG_REGISTER
 :%0A  
@@ -1074,38 +1074,38 @@
        print %22re
-quired
+gister
 %22,%0A        print

Handle register flag; use CONN_MGR_PARAM_FLAG_REQUIRED not 1L