annotate libpurple/dbus-analyze-functions.py @ 25100:ede59a571c0a

This is a combination of patches from darkrain42 and Marcus Sundberg to fix some string handling issues in the SIMPLE prpl. It also fixes some buddy name handling issues. Fixes #8128.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sun, 15 Feb 2009 21:03:40 +0000
parents 2520d5fe48a3
children 1de01f9594c8 750f087d1df3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 import re
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 import string
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 import sys
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 # types translated into "int"
18130
d955d9bd7ea7 Treat some more types as simple types. This allows exporting some useful
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
6 simpletypes = ["int", "gint", "guint", "gboolean", "gpointer", "size_t", "gssize", "time_t"]
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 # List "excluded" contains functions that shouldn't be exported via
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 # DBus. If you remove a function from this list, please make sure
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 # that it does not break "make" with the configure option
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 # "--enable-dbus" turned on.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 excluded = [\
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 # I don't remember why this function is excluded; something to do
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 # with the fact that it takes a (const) GList as a parameter.
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
16 "purple_presence_add_list",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 # These functions are excluded because they involve value of the
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
19 # type PurpleConvPlacementFunc, which is a pointer to a function and
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 # (currently?) can't be translated into a DBus type. Normally,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 # functions with untranslatable types are skipped, but this script
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
22 # assumes that all non-pointer type names beginning with "Purple"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 # are enums, which is not true in this case.
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
24 "purple_conv_placement_add_fnc",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
25 "purple_conv_placement_get_fnc",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
26 "purple_conv_placement_get_current_func",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
27 "purple_conv_placement_set_current_func",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28
19710
93d10000432e Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents: 19418
diff changeset
29 # Similar to the above:
93d10000432e Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents: 19418
diff changeset
30 "purple_account_set_register_callback",
93d10000432e Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents: 19418
diff changeset
31 "purple_account_unregister",
93d10000432e Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents: 19418
diff changeset
32 "purple_connection_new_unregister",
93d10000432e Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents: 19418
diff changeset
33
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
34 # This is excluded because this script treats PurpleLogReadFlags*
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 # as pointer to a struct, instead of a pointer to an enum. This
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 # causes a compilation error. Someone should fix this script.
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
37 "purple_log_read",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 ]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
40 # This is a list of functions that return a GList* or GSList * whose elements
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
41 # are strings, not pointers to objects.
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
42 stringlists = [
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
43 "purple_prefs_get_path_list",
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
44 "purple_prefs_get_string_list",
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
45 "purple_uri_list_extract_filenames",
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
46 "purple_uri_list_extract_uris",
19222
476e16ce29d0 Make sure dbus doesn't leak in purple_prefs_get_children_names.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18146
diff changeset
47 "purple_prefs_get_children_names",
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
48 ]
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
50 # This is a list of functions that return a GList* or GSList* that should
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
51 # not be freed. Ideally, this information should be obtained from the Doxygen
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
52 # documentation at some point.
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
53 constlists = [
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
54 "purple_account_get_status_types",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
55 "purple_accounts_get_all",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
56 "purple_account_option_get_list",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
57 "purple_connections_get_all",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
58 "purple_connections_get_connecting",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
59 "purple_get_conversations",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
60 "purple_get_ims",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
61 "purple_get_chats",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
62 "purple_conv_chat_get_users",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
63 "purple_conv_chat_get_ignored",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
64 "purple_mime_document_get_fields",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
65 "purple_mime_document_get_parts",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
66 "purple_mime_part_get_fields",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
67 "purple_notify_user_info_get_entries",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
68 "purple_request_fields_get_required",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
69 "purple_request_field_list_get_selected",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
70 "purple_request_field_list_get_items",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
71 "purple_savedstatuses_get_all",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
72 "purple_status_type_get_attrs",
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
73 "purple_presence_get_statuses",
19418
b33c2b085e78 DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19222
diff changeset
74 "purple_conversation_get_message_history",
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
75 ]
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
76
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 pointer = "#pointer#"
21038
ec9c30ce628d Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents: 19710
diff changeset
78
ec9c30ce628d Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents: 19710
diff changeset
79 class MyException(Exception):
ec9c30ce628d Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents: 19710
diff changeset
80 pass
ec9c30ce628d Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents: 19710
diff changeset
81
ec9c30ce628d Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents: 19710
diff changeset
82 myexception = MyException()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 def ctopascal(name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 newname = ""
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 for word in name.split("_"):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 newname += word.capitalize()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 return newname
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 class Parameter:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 def __init__(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 self.name = name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 self.type = type
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 def fromtokens(tokens, parameternumber = -1):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 if len(tokens) == 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 raise myexception
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 if (len(tokens) == 1) or (tokens[-1] == pointer):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 if parameternumber >= 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 return Parameter(tokens, "param%i" % parameternumber)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 raise myexception
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 return Parameter(tokens[:-1], tokens[-1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 fromtokens = staticmethod(fromtokens)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 class Binding:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 def __init__(self, functiontext, paramtexts):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 self.function = Parameter.fromtokens(functiontext.split())
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 if self.function.name in excluded:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 raise myexception
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 self.params = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 for i in range(len(paramtexts)):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 self.params.append(Parameter.fromtokens(paramtexts[i].split(), i))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 self.call = "%s(%s)" % (self.function.name,
25000
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
120 ", ".join(param.name for param in self.params))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 def process(self):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 for param in self.params:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 self.processinput(param.type, param.name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 self.processoutput(self.function.type, "RESULT")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 self.flush()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 def processinput(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 const = False
18138
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
133 unsigned = False
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 if type[0] == "const":
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 type = type[1:]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 const = True
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
18138
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
138 if type[0] == "unsigned":
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
139 type = type[1:]
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
140 unsigned = True
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
141
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 if len(type) == 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 # simple types (int, gboolean, etc.) and enums
17081
3b01cb4147d3 Callbacks are not supported for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16794
diff changeset
144 if (type[0] in simpletypes) or ((type[0].startswith("Purple") and not type[0].endswith("Callback"))):
18138
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
145 return self.inputsimple(type, name, unsigned)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 # pointers ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 if (len(type) == 2) and (type[1] == pointer):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 # strings
16794
c5bcac0d593d gchar returning functions should also be exposed for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15823
diff changeset
150 if type[0] in ["char", "gchar"]:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 if const:
18146
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
152 return self.inputstring(type, name, unsigned)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 raise myexception
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 elif type[0] == "GHashTable":
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 return self.inputhash(type, name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 # known object types are transformed to integer handles
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
160 elif type[0].startswith("Purple") or type[0] == "xmlnode":
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
161 return self.inputpurplestructure(type, name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162
25000
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
163 # special case for *_get_data functions, be careful here...
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
164 elif (type[0] == "size_t") and (name == "len"):
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
165 return self.inputgetdata(type, name)
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
166
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 # unknown pointers are always replaced with NULL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 return self.inputpointer(type, name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 raise myexception
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 def processoutput(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 # the "void" type is simple ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 if type == ["void"]:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 return self.outputvoid(type, name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 const = False
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 if type[0] == "const":
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 type = type[1:]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 const = True
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 # a string
16794
c5bcac0d593d gchar returning functions should also be exposed for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15823
diff changeset
185 if type == ["char", pointer] or type == ["gchar", pointer]:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 return self.outputstring(type, name, const)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 # simple types (ints, booleans, enums, ...)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 if (len(type) == 1) and \
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
190 ((type[0] in simpletypes) or (type[0].startswith("Purple"))):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 return self.outputsimple(type, name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 # pointers ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 if (len(type) == 2) and (type[1] == pointer):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 # handles
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
197 if type[0].startswith("Purple"):
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
198 return self.outputpurplestructure(type, name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 if type[0] in ["GList", "GSList"]:
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
201 return self.outputlist(type, name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202
25000
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
203 # Special case for *_get_data functions
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
204 if type[0] == "gconstpointer":
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
205 return self.outputgetdata(type, name)
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
206
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 raise myexception
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 class ClientBinding (Binding):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 def __init__(self, functiontext, paramtexts, knowntypes, headersonly):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 Binding.__init__(self, functiontext, paramtexts)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 self.knowntypes = knowntypes
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 self.headersonly = headersonly
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 self.paramshdr = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 self.decls = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 self.inputparams = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 self.outputparams = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 self.returncode = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 def flush(self):
17754
b5a8cea54876 Whitespace changes.
Richard Laager <rlaager@wiktel.com>
parents: 17650
diff changeset
222 paramslist = ", ".join(self.paramshdr)
b5a8cea54876 Whitespace changes.
Richard Laager <rlaager@wiktel.com>
parents: 17650
diff changeset
223 if (paramslist == "") :
b5a8cea54876 Whitespace changes.
Richard Laager <rlaager@wiktel.com>
parents: 17650
diff changeset
224 paramslist = "void"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 print "%s %s(%s)" % (self.functiontype, self.function.name,
17458
98ef77c2455f Part of a patch from o_sukhodolsky.
Richard Laager <rlaager@wiktel.com>
parents: 17081
diff changeset
226 paramslist),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 if self.headersonly:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 print ";"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 return
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 print "{"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 for decl in self.decls:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 print decl
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
237 print 'dbus_g_proxy_call(purple_proxy, "%s", NULL,' % ctopascal(self.function.name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 for type_name in self.inputparams:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 print "\t%s, %s, " % type_name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 print "G_TYPE_INVALID,"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 for type_name in self.outputparams:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 print "\t%s, &%s, " % type_name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 print "G_TYPE_INVALID);"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 for code in self.returncode:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 print code
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 print "}\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
253 def definepurplestructure(self, type):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 if (self.headersonly) and (type[0] not in self.knowntypes):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 print "struct _%s;" % type[0]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 print "typedef struct _%s %s;" % (type[0], type[0])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 self.knowntypes.append(type[0])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258
18138
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
259 def inputsimple(self, type, name, us):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 self.paramshdr.append("%s %s" % (type[0], name))
18138
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
261 if us:
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
262 self.inputparams.append(("G_TYPE_UINT", name))
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
263 else:
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
264 self.inputparams.append(("G_TYPE_INT", name))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265
18146
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
266 def inputstring(self, type, name, us):
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
267 if us:
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
268 self.paramshdr.append("const unsigned char *%s" % name)
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
269 else:
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
270 self.paramshdr.append("const char *%s" % name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 self.inputparams.append(("G_TYPE_STRING", name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
273 def inputpurplestructure(self, type, name):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 self.paramshdr.append("const %s *%s" % (type[0], name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 self.inputparams.append(("G_TYPE_INT", "GPOINTER_TO_INT(%s)" % name))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
276 self.definepurplestructure(type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 def inputpointer(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 name += "_NULL"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 self.paramshdr.append("const %s *%s" % (type[0], name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 self.inputparams.append(("G_TYPE_INT", "0"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 def inputhash(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 self.paramshdr.append("const GHashTable *%s" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 self.inputparams.append(('dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING)', name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 def outputvoid(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 self.functiontype = "void"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 def outputstring(self, type, name, const):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 self.functiontype = "char*"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 self.decls.append("char *%s = NULL;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 self.outputparams.append(("G_TYPE_STRING", name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 # self.returncode.append("NULLIFY(%s);" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 self.returncode.append("return %s;" % name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 def outputsimple(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 self.functiontype = type[0]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 self.decls.append("%s %s = 0;" % (type[0], name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 self.outputparams.append(("G_TYPE_INT", name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 self.returncode.append("return %s;" % name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 # we could add "const" to the return type but this would probably
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 # be a nuisance
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
305 def outputpurplestructure(self, type, name):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 name = name + "_ID"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 self.functiontype = "%s*" % type[0]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 self.decls.append("int %s = 0;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 self.outputparams.append(("G_TYPE_INT", "%s" % name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 self.returncode.append("return (%s*) GINT_TO_POINTER(%s);" % (type[0], name));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
311 self.definepurplestructure(type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
313 def outputlist(self, type, name):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 self.functiontype = "%s*" % type[0]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 self.decls.append("GArray *%s;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 self.outputparams.append(('dbus_g_type_get_collection("GArray", G_TYPE_INT)', name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 self.returncode.append("return garray_int_to_%s(%s);" %
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 (type[0].lower(), name));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319
25000
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
320 # Special case for *_get_data functions, don't need client bindings,
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
321 # but do need the name so it doesn't crash
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
322 def inputgetdata(self, type, name):
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
323 raise myexception
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
324 def outputgetdata(self, type, name):
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
325 raise myexception
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
326
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 class ServerBinding (Binding):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 def __init__(self, functiontext, paramtexts):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 Binding.__init__(self, functiontext, paramtexts)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 self.dparams = ""
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 self.cparams = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 self.cdecls = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 self.ccode = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 self.cparamsout = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 self.ccodeout = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 self.argfunc = "dbus_message_get_args"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 def flush(self):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 print "static DBusMessage*"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 print "%s_DBUS(DBusMessage *message_DBUS, DBusError *error_DBUS) {" % \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 self.function.name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 print "\tDBusMessage *reply_DBUS;"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 for decl in self.cdecls:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 print decl
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347
17754
b5a8cea54876 Whitespace changes.
Richard Laager <rlaager@wiktel.com>
parents: 17650
diff changeset
348 print "\t%s(message_DBUS, error_DBUS," % self.argfunc,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 for param in self.cparams:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 print "DBUS_TYPE_%s, &%s," % param,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 print "DBUS_TYPE_INVALID);"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 print "\tCHECK_ERROR(error_DBUS);"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 for code in self.ccode:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 print code
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357
17754
b5a8cea54876 Whitespace changes.
Richard Laager <rlaager@wiktel.com>
parents: 17650
diff changeset
358 print "\treply_DBUS = dbus_message_new_method_return (message_DBUS);"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359
17754
b5a8cea54876 Whitespace changes.
Richard Laager <rlaager@wiktel.com>
parents: 17650
diff changeset
360 print "\tdbus_message_append_args(reply_DBUS,",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 for param in self.cparamsout:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 if type(param) is str:
18117
cd81f8f36788 Fix some weird whitespace in the output.
Richard Laager <rlaager@wiktel.com>
parents: 18059
diff changeset
363 print "%s," % param,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 else:
17754
b5a8cea54876 Whitespace changes.
Richard Laager <rlaager@wiktel.com>
parents: 17650
diff changeset
365 print "DBUS_TYPE_%s, &%s," % param,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 print "DBUS_TYPE_INVALID);"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 for code in self.ccodeout:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 print code
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 print "\treturn reply_DBUS;\n}\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 def addstring(self, *items):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 for item in items:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 self.dparams += item + r"\0"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 def addintype(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 self.addstring("in", type, name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 def addouttype(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 self.addstring("out", type, name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 # input parameters
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386
18138
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
387 def inputsimple(self, type, name, us):
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
388 if us:
24324
7493462e6959 A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents: 23145
diff changeset
389 self.cdecls.append("\tdbus_uint32_t %s;" % name)
7493462e6959 A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents: 23145
diff changeset
390 self.cparams.append(("UINT32", name))
7493462e6959 A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents: 23145
diff changeset
391 self.addintype("u", name)
7493462e6959 A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents: 23145
diff changeset
392 else:
18138
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
393 self.cdecls.append("\tdbus_int32_t %s;" % name)
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
394 self.cparams.append(("INT32", name))
c6ee57944335 Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18130
diff changeset
395 self.addintype("i", name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396
18146
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
397 def inputstring(self, type, name, us):
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
398 if us:
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
399 self.cdecls.append("\tconst unsigned char *%s;" % name)
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
400 else:
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
401 self.cdecls.append("\tconst char *%s;" % name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 self.cparams.append(("STRING", name))
18146
5d1058768970 Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18138
diff changeset
403 self.ccode.append("\t%s = (%s && %s[0]) ? %s : NULL;" % (name,name,name,name))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 self.addintype("s", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 def inputhash(self, type, name):
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
407 self.argfunc = "purple_dbus_message_get_args"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 self.cdecls.append("\tDBusMessageIter %s_ITER;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 self.cdecls.append("\tGHashTable *%s;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 self.cparams.append(("ARRAY", "%s_ITER" % name))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
411 self.ccode.append("\t%s = purple_dbus_iter_hash_table(&%s_ITER, error_DBUS);" \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 % (name, name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 self.ccode.append("\tCHECK_ERROR(error_DBUS);")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 self.ccodeout.append("\tg_hash_table_destroy(%s);" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 self.addintype("a{ss}", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
417 def inputpurplestructure(self, type, name):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 self.cdecls.append("\tdbus_int32_t %s_ID;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 self.cdecls.append("\t%s *%s;" % (type[0], name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 self.cparams.append(("INT32", name + "_ID"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
421 self.ccode.append("\tPURPLE_DBUS_ID_TO_POINTER(%s, %s_ID, %s, error_DBUS);" % \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 (name, name, type[0]))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 self.addintype("i", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 def inputpointer(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 self.cdecls.append("\tdbus_int32_t %s_NULL;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 self.cdecls .append("\t%s *%s;" % (type[0], name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 self.cparams.append(("INT32", name + "_NULL"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 self.ccode .append("\t%s = NULL;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 self.addintype("i", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 # output parameters
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 def outputvoid(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 self.ccode.append("\t%s;" % self.call) # just call the function
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 def outputstring(self, type, name, const):
17649
f187d935486b The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents: 17458
diff changeset
438 if const:
f187d935486b The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents: 17458
diff changeset
439 self.cdecls.append("\tconst char *%s;" % name)
f187d935486b The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents: 17458
diff changeset
440 else:
f187d935486b The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents: 17458
diff changeset
441 self.cdecls.append("\tchar *%s;" % name)
17650
a90e2e720762 Now fix warnings from null_to_empty()'s constness.
Richard Laager <rlaager@wiktel.com>
parents: 17649
diff changeset
442 self.ccode.append("\tif ((%s = %s) == NULL)" % (name, self.call))
a90e2e720762 Now fix warnings from null_to_empty()'s constness.
Richard Laager <rlaager@wiktel.com>
parents: 17649
diff changeset
443 self.ccode.append("\t\t%s = \"\";" % (name))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 self.cparamsout.append(("STRING", name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 self.addouttype("s", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 if not const:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 self.ccodeout.append("\tg_free(%s);" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 def outputsimple(self, type, name):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 self.cdecls.append("\tdbus_int32_t %s;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 self.ccode.append("\t%s = %s;" % (name, self.call))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 self.cparamsout.append(("INT32", name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 self.addouttype("i", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
455 def outputpurplestructure(self, type, name):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 self.cdecls.append("\tdbus_int32_t %s;" % name)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
457 self.ccode .append("\tPURPLE_DBUS_POINTER_TO_ID(%s, %s, error_DBUS);" % (name, self.call))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 self.cparamsout.append(("INT32", name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 self.addouttype("i", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 # GList*, GSList*, assume that list is a list of objects
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
462 # unless the function is in stringlists
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
463 def outputlist(self, type, name):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 self.cdecls.append("\tdbus_int32_t %s_LEN;" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 self.ccodeout.append("\tg_free(%s);" % name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
467 self.cdecls.append("\t%s *list;" % type[0]);
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
468
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 if self.function.name in stringlists:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 self.cdecls.append("\tchar **%s;" % name)
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
471 self.ccode.append("\tlist = %s;" % self.call)
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
472 self.ccode.append("\t%s = (char **)purple_%s_to_array(list, FALSE, &%s_LEN);" % \
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
473 (name, type[0], name))
18117
cd81f8f36788 Fix some weird whitespace in the output.
Richard Laager <rlaager@wiktel.com>
parents: 18059
diff changeset
474 self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &%s, %s_LEN" \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 % (name, name))
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
476 if (not (self.function.name in constlists)):
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
477 type_name = type[0].lower()[1:]
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
478 self.ccodeout.append("\tg_%s_foreach(list, (GFunc)g_free, NULL);" % type_name)
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
479 self.ccodeout.append("\tg_%s_free(list);" % type_name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 self.addouttype("as", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 self.cdecls.append("\tdbus_int32_t *%s;" % name)
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
483 self.ccode.append("\tlist = %s;" % self.call)
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
484 self.ccode.append("\t%s = purple_dbusify_%s(list, FALSE, &%s_LEN);" % \
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
485 (name, type[0], name))
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18117
diff changeset
486 if (not (self.function.name in constlists)):
18059
3f3125b91728 Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents: 17754
diff changeset
487 self.ccode.append("\tg_%s_free(list);" % type[0].lower()[1:])
18117
cd81f8f36788 Fix some weird whitespace in the output.
Richard Laager <rlaager@wiktel.com>
parents: 18059
diff changeset
488 self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &%s, %s_LEN" \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 % (name, name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 self.addouttype("ai", name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491
25000
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
492 # Special case for *_get_data functions
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
493 def inputgetdata(self, type, name):
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
494 self.cdecls.append("\tsize_t %s = 0;" % name)
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
495 return True
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
496 def outputgetdata(self, type, name):
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
497 # This is a total hack, but self.call is set up before the parameters
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
498 # are processed, so we can't tell it to pass a parameter by reference.
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
499 self.call = "%s(%s)" % (self.function.name,
25048
2520d5fe48a3 *** Plucked rev 8e8959be (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25000
diff changeset
500 ", ".join([(param.name, "&len")[param.name == "len"] for param in self.params]))
25000
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
501
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
502 self.cdecls.append("\tgconstpointer %s;" % name)
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
503 self.ccode.append("\t%s = %s;" % (name, self.call))
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
504 self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &%s, %s" \
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
505 % (name, "len"))
a1c4ae9a2fcc Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24324
diff changeset
506 self.addouttype("ay", name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 class BindingSet:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 regexp = r"^(\w[^()]*)\(([^()]*)\)\s*;\s*$";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 def __init__(self, inputfile, fprefix):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 self.inputiter = iter(inputfile)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 self.functionregexp = \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 re.compile("^%s(\w[^()]*)\(([^()]*)\)\s*;\s*$" % fprefix)
23145
2012a85f8507 Update the dbus-analyze script to deal with multiline function
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22079
diff changeset
515 self.typeregexp = re.compile("^\w+\s*\*?\s*$")
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 def process(self):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 print "/* Generated by %s. Do not edit! */" % sys.argv[0]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 for line in self.inputiter:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 words = line.split()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 if len(words) == 0: # empty line
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 continue
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 if line[0] == "#": # preprocessor directive
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 continue
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 if words[0] in ["typedef", "struct", "enum", "static"]:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 continue
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 # accumulate lines until the parentheses are balance or an
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 # empty line has been encountered
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 myline = line.strip()
23145
2012a85f8507 Update the dbus-analyze script to deal with multiline function
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22079
diff changeset
534 while (myline.count("(") > myline.count(")")) or self.typeregexp.match(myline):
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 newline = self.inputiter.next().strip()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 if len(newline) == 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 break
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 myline += " " + newline
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 # is this a function declaration?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 thematch = self.functionregexp.match(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 myline.replace("*", " " + pointer + " "))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 if thematch is None:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 continue
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 functiontext = thematch.group(1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 paramstext = thematch.group(2).strip()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 if (paramstext == "void") or (paramstext == ""):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 paramtexts = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 paramtexts = paramstext.split(",")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 try:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 self.processfunction(functiontext, paramtexts)
21038
ec9c30ce628d Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents: 19710
diff changeset
557 except MyException:
22079
7ec5b5724a05 Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents: 21038
diff changeset
558 # sys.stderr.write(myline + "\n")
7ec5b5724a05 Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents: 21038
diff changeset
559 pass
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 except:
22079
7ec5b5724a05 Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents: 21038
diff changeset
561 # sys.stderr.write(myline + "\n")
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 raise
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 self.flush()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 class ServerBindingSet (BindingSet):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 def __init__(self, inputfile, fprefix):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 BindingSet.__init__(self, inputfile, fprefix)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 self.functions = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 def processfunction(self, functiontext, paramtexts):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 binding = ServerBinding(functiontext, paramtexts)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 binding.process()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 self.functions.append((binding.function.name, binding.dparams))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 def flush(self):
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
578 print "static PurpleDBusBinding bindings_DBUS[] = { "
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 for function, params in self.functions:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 print '{"%s", "%s", %s_DBUS},' % \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 (ctopascal(function), params, function)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 print "{NULL, NULL, NULL}"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 print "};"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
586 print "#define PURPLE_DBUS_REGISTER_BINDINGS(handle) purple_dbus_register_bindings(handle, bindings_DBUS)"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 class ClientBindingSet (BindingSet):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 def __init__(self, inputfile, fprefix, headersonly):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 BindingSet.__init__(self, inputfile, fprefix)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 self.functions = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 self.knowntypes = []
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 self.headersonly = headersonly
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 def processfunction(self, functiontext, paramtexts):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 binding = ClientBinding(functiontext, paramtexts, self.knowntypes, self.headersonly)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 binding.process()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 def flush(self):
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 pass
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 # Main program
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 options = {}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 for arg in sys.argv[1:]:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 if arg[0:2] == "--":
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 mylist = arg[2:].split("=",1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 command = mylist[0]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 if len(mylist) > 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 options[command] = mylist[1]
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 options[command] = None
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 if "export-only" in options:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 fprefix = "DBUS_EXPORT\s+"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 fprefix = ""
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619
22079
7ec5b5724a05 Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents: 21038
diff changeset
620 #sys.stderr.write("%s: Functions not exported:\n" % sys.argv[0])
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 if "client" in options:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 bindings = ClientBindingSet(sys.stdin, fprefix,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 options.has_key("headers"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 else:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 bindings = ServerBindingSet(sys.stdin, fprefix)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 bindings.process()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631