3 # (name, CM, protocol, icon)
5 ('AIM', 'haze', 'aim', 'aim'),
6 ('GaduGadu', 'haze', 'gadugadu', 'gadugadu'),
7 ('Groupwise', 'haze', 'groupwise', 'groupwise'),
8 ('ICQ', 'haze', 'icq', 'icq'),
9 ('IRC', 'idle', 'irc', 'irc'),
10 ('Jabber', 'gabble', 'jabber', 'jabber'),
11 ('Mxit', 'haze', 'mxit', 'mxit'),
12 ('Myspace', 'haze', 'myspace', 'myspace'),
13 ('SIP', 'sofiasip', 'sip', 'sip'),
14 ('Salut', 'salut', 'local-xmpp', 'people-nearby'),
15 ('Sametime', 'haze', 'sametime', 'sametime'),
16 ('Yahoo Japan', 'haze', 'yahoojp', 'yahoo'),
17 ('Yahoo!', 'haze', 'yahoo', 'yahoo'),
18 ('Zephyr', 'haze', 'zephyr', 'zephyr'),
22 def __init__(self, name, cm, protocol, icon):
25 self.protocol = protocol
28 ##### The plugin itself #####
30 def generate_build_block(p):
31 la = 'lib%s_la' % p.protocol.replace('-', '_')
33 output = '''%s_SOURCES = \\
34 empathy-accounts-plugin.c \\
35 empathy-accounts-plugin.h \\
36 empathy-accounts-plugin-widget.c \\
37 empathy-accounts-plugin-widget.h
38 %s_LDFLAGS = -module -avoid-version
41 $(top_builddir)/libempathy/libempathy.la \\
42 $(top_builddir)/libempathy-gtk/libempathy-gtk.la
47 def generate_makefile_am(plugins):
48 '''Generate Makefile.am'''
53 name = ' lib%s.la' % p.protocol
56 build_blocks.append(generate_build_block(p))
58 f = open('Makefile.am', 'w')
61 '''# Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
62 # Do NOT edit manually
63 SUBDIRS = providers services app-plugin
65 plugindir = $(ACCOUNTS_PROVIDER_PLUGIN_DIR)
70 -DLOCALEDIR=\\""$(datadir)/locale"\\" \\
74 $(DISABLE_DEPRECATED) \\
77 plugin_LTLIBRARIES = \\
81 %s''' % ('\\\n'.join(libs), '\n\n'.join(build_blocks)))
85 def generate_provider_file(p):
86 f = open('providers/%s.provider' % p.protocol, 'w')
89 '''<?xml version="1.0" encoding="UTF-8" ?>
90 <!-- Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
91 Do NOT edit manually -->
96 ''' % (p.protocol, p.name, p.icon))
98 def generate_providers(plugins):
99 '''generate providers/*.provider files and providers/Makefile.am'''
103 providers.append(' %s.provider' % p.protocol)
105 generate_provider_file(p)
107 # providers/Makefile.am
108 f = open('providers/Makefile.am', 'w')
110 '''# Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
111 # Do NOT edit manually
112 providersdir = $(ACCOUNTS_PROVIDER_FILES_DIR)
118 EXTRA_DIST = $(providers_DATA)
119 ''' % ('\\\n'.join(providers)))
123 def generate_service_file(p):
124 f = open('services/%s-im.service' % p.protocol, 'w')
127 '''<?xml version="1.0" encoding="UTF-8" ?>
128 <!-- Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
129 Do NOT edit manually -->
134 <provider>%s</provider>
136 <!-- default settings (account settings have precedence over these) -->
138 <group name="telepathy">
139 <setting name="manager">%s</setting>
140 <setting name="protocol">%s</setting>
145 ''' % (p.protocol, p.name, p.icon, p.protocol, p.cm, p.protocol))
147 def generate_services(plugins):
148 '''generate services/*-im.service files and services/Makefile.am'''
152 services.append(' %s-im.service' % p.protocol)
154 generate_service_file(p)
156 # providers/Makefile.am
157 f = open('services/Makefile.am', 'w')
159 '''# Generated using empathy/ubuntu-online-accounts/cc-plugins/generate-plugins.py
160 # Do NOT edit manually
161 servicesdir = $(ACCOUNTS_SERVICE_FILES_DIR)
167 EXTRA_DIST = $(services_DATA)
168 ''' % ('\\\n'.join(services)))
173 for name, cm, protocol, icon in ALL:
174 plugins.append(Plugin(name, cm, protocol, icon))
176 generate_makefile_am(plugins)
177 generate_providers(plugins)
178 generate_services(plugins)
180 if __name__ == '__main__':