diff --git a/onionr/communicator.py b/onionr/communicator.py index 4afdbb0d..6f531e47 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 ''' -Onionr - P2P Microblogging Platform & Social network. + Onionr - P2P Microblogging Platform & Social network. -This file contains both the OnionrCommunicate class for communcating with peers -and code to operate as a daemon, getting commands from the command queue database (see core.Core.daemonQueue) + This file contains both the OnionrCommunicate class for communcating with peers + and code to operate as a daemon, getting commands from the command queue database (see core.Core.daemonQueue) ''' ''' This program is free software: you can redistribute it and/or modify diff --git a/onionr/onionrblockapi.py b/onionr/onionrblockapi.py new file mode 100644 index 00000000..46c1c6ad --- /dev/null +++ b/onionr/onionrblockapi.py @@ -0,0 +1,107 @@ +''' + Onionr - P2P Microblogging Platform & Social network. + + This class contains the OnionrBlocks class which is a class for working with Onionr blocks +''' +''' + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import core as onionrcore + +class Block: + def __init__(self, hash = None, core = None): + self.hash = hash + self.core = core + + if self.getCore() is None: + self.core = onionrcore.Core() + if not self.getHash() is None: + self.update() + + # logic + + def update(self, data = None, file = None): + ''' + Loads data from a block in to the current object. + + Inputs: + - data (str): + - if None: will load from file by hash + - else: will load from `data` string + - file (str): + - if None: will load from file specified in this parameter + - else: will load from wherever block is stored by hash + + Outputs: + - (bool): indicates whether or not the operation was successful + ''' + + return False + + def delete(self): + return False + + def save(self): + return False + + # getters + + def getHash(self): + return self.hash + + def getCore(self): + return self.core + + def getType(self): + return self.btype + + def getMetadata(self): + return self.bmetadata + + def getContent(self): + return self.bcontent + + def getDate(self): + return self.date + + def isValid(self): + return self.valid + + def isSigned(self): + return self.signed + + def getSigner(self): + return self.signer + + # setters + + def setType(self, btype): + self.btype = btype + return self + + def setContent(self, bcontent): + self.bcontent = bcontent + return self + + # static + + ORDER_DATE = 0 + ORDER_ALPHABETIC = 1 + + def getBlocks(type = None, signer = None, order = ORDER_DATE, reverse = False): + return None + + def exists(hash): + return None diff --git a/onionr/onionrblocks.py b/onionr/onionrblocks.py deleted file mode 100644 index ffa8207c..00000000 --- a/onionr/onionrblocks.py +++ /dev/null @@ -1,26 +0,0 @@ -''' -Onionr - P2P Microblogging Platform & Social network. - -This class contains the OnionrBlocks class which is a class for working with Onionr blocks -''' -''' - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' -import json -class OnionrBlocks: - def __init__(self, coreInstance): - return - def metadataGenerate(self): - return - diff --git a/onionr/static-data/default-plugins/pluginmanager/main.py b/onionr/static-data/default-plugins/pluginmanager/main.py index 3fa6373c..3743d0dc 100644 --- a/onionr/static-data/default-plugins/pluginmanager/main.py +++ b/onionr/static-data/default-plugins/pluginmanager/main.py @@ -1,5 +1,21 @@ ''' - This is the future Onionr plugin manager. TODO: Add better description. + Onionr - P2P Microblogging Platform & Social network. + + This plugin acts as a plugin manager, and allows the user to install other plugins distributed over Onionr. +''' +''' + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . ''' # useful libraries