diff --git a/onionr/communicator.py b/onionr/communicator.py index cfd8588a..413cdfd3 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -147,6 +147,8 @@ class OnionrCommunicate: digest = digest.decode() if digest == hash.strip(): self._core.setData(data) + if data.startswith('-txt-'): + self._core.setBlockType(hash, 'txt') logger.info('Successfully obtained data for ' + hash) if len(data) < 120: logger.debug('Block text:\n' + data) @@ -165,7 +167,7 @@ class OnionrCommunicate: if data != None: url = url + '&data=' + data try: - r = requests.get(url, headers=headers, proxies=proxies, timeout=(5, 30)) + r = requests.get(url, headers=headers, proxies=proxies, timeout=(15, 30)) except requests.exceptions.RequestException as e: logger.warn(action + " failed with peer " + peer + ": " + str(e)) return False diff --git a/onionr/core.py b/onionr/core.py index aa353ced..5cfa2015 100644 --- a/onionr/core.py +++ b/onionr/core.py @@ -366,8 +366,8 @@ class Core: def setBlockType(self, hash, blockType): conn = sqlite3.connect(self.blockDB) c = conn.cursor() - if blockType not in ("txt"): - return - c.execute("UPDATE hashes set dataType='" + blockType + "' where hash = '" + hash + "';") + #if blockType not in ("txt"): + # return + c.execute("UPDATE hashes SET dataType='" + blockType + "' WHERE hash = '" + hash + "';") conn.commit() conn.close() \ No newline at end of file diff --git a/onionr/gui.py b/onionr/gui.py index 4bf5b0c1..5fa05331 100755 --- a/onionr/gui.py +++ b/onionr/gui.py @@ -49,7 +49,7 @@ class OnionrGUI: self.root.mainloop() def sendMessage(self): - messageToAdd = self.sendEntry.get() + messageToAdd = '-txt-' + self.sendEntry.get() addedHash = self.myCore.setData(messageToAdd) self.myCore.addToBlockDB(addedHash, selfInsert=True) self.myCore.setBlockType(addedHash, 'txt')