From 1090c954ec64ae2c07523b8688bf732cf7344899 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 7 Feb 2013 13:30:17 +0200 Subject: [PATCH] test: Add -p/--push option to map-client This option can be used to push messages, it takes as a parameter a file location which should contain the message in bmsg format. --- test/map-client | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/map-client b/test/map-client index 34897cdc8..f3c657f73 100755 --- a/test/map-client +++ b/test/map-client @@ -51,6 +51,8 @@ def parse_options(): help="List messages in supplied CWD subdir") parser.add_option("-g", "--get", action="store", dest="get_msg", help="Get message contents") + parser.add_option("-p", "--push", action="store", dest="push_msg", + help="Push message") parser.add_option("--get-properties", action="store", dest="get_msg_properties", help="Get message properties") parser.add_option("--mark-read", action="store", dest="mark_msg_read", @@ -85,8 +87,7 @@ class MapClient: signal_name="PropertiesChanged", path_keyword="path") - def create_transfer_reply(self, reply): - (path, properties) = reply + def create_transfer_reply(self, path, properties): self.transfer_path = path self.props[path] = properties if self.verbose: @@ -147,6 +148,11 @@ class MapClient: msg.Get("", True, reply_handler=self.create_transfer_reply, error_handler=self.error) + def push_message(self, filename): + self.map.PushMessage(filename, "telecom/msg/outbox", dict(), + reply_handler=self.create_transfer_reply, + error_handler=self.error) + def get_message_properties(self, handle): self.map.ListMessages("", dict()) path = self.path + "/message" + handle @@ -201,6 +207,9 @@ if __name__ == '__main__': if options.get_msg is not None: map_client.get_message(options.get_msg) + if options.push_msg is not None: + map_client.push_message(options.push_msg) + if options.get_msg_properties is not None: map_client.get_message_properties(options.get_msg_properties) -- 2.47.3