From 0e587e93d7a1e7fd4c993a4a184c0a96c2151b0b Mon Sep 17 00:00:00 2001 From: jngrt Date: Fri, 23 May 2014 19:47:04 +0200 Subject: [PATCH] main.py fixed, working with sending messages for users, in subfoldes --- main.py | 9 ++++----- meshenger_roadmap | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 8bac2cf..a331fdb 100755 --- a/main.py +++ b/main.py @@ -237,7 +237,6 @@ Download the indices from other nodes. command = 'wget http://['+ip+'%adhoc0]:'+self.serve_port+'/index -O '+os.path.join(path,'index') print 'get_index: ', command status = subprocess.call( command, shell=True ) - print 'get_index wget status: ', status return status == 0 def get_messages(self, ip, path ): @@ -250,7 +249,6 @@ Get new messages from other node based on it's index file with open(os.path.join(path,'index')) as index: index = index.read().split('\n') for message in index: - # messagepath = os.path.join(os.path.abspath(self.msg_dir), message) parts = message.split('/') dirpath = os.path.join( parts[0], parts[1]) if not os.path.isdir( dirpath ): @@ -260,10 +258,11 @@ Get new messages from other node based on it's index file if not os.path.exists(messagepath): print 'downloading', message, 'to', messagepath command = 'wget http://['+ip+'%adhoc0]:' + self.serve_port + '/' + message+' -O ' + messagepath - print command status = subprocess.call( command, shell=True) - print 'get_messages wget status: ', status - return status == 0 + if status != 0: + return False + # succesfuly downloaded all messages, return true + return True except: print 'Failed to download messages' return False diff --git a/meshenger_roadmap b/meshenger_roadmap index ea7ffbf..4af8236 100644 --- a/meshenger_roadmap +++ b/meshenger_roadmap @@ -13,7 +13,7 @@ - /msg/ -> give list of all messages for this uid - /msg// -> get message for this timestamp - /clients -> return list of all known clients (uid's + usernames) -- /getUID -> return uid for client ( based on what? mac? ) +- /getUID -> return uid for client ( unique id based on what? mac address? ) # Cryptoshit