From c73bdb83cd9522ecfd568be0766d610d50fc2e84 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 27 Nov 2019 23:32:38 +0100 Subject: [PATCH] Drop libresapi and modules that depends on it A copy of the repository freezed before this deletion to ease old code viewing is available at https://github.com/RetroShare/zz_archive_RetroShare_libresapi Removed some more cruft Temporarly disabled JSON API generation of RsWebUi methods due to compilation breakage when rs_webui is disabled, RsWebUi keeps working but cannot be restarted from JSON API --- .gitmodules | 3 + README.asciidoc | 49 + README.md | 151 - TODO.circles.txt | 47 - TODO.txt | 135 - android-prepare-toolchain.sh | 333 --- .../Android/README.asciidoc | 0 build_scripts/Debian/debian/copyright | 5 +- .../OSX/MacOS_X_InstallGuide.md | 0 .../OSX/travis_makeOSXPackage.sh | 0 .../WindowsMSys2_InstallGuide.md | 0 libresapi/src/.gitignore | 1 - libresapi/src/README.md | 14 - libresapi/src/api/ApiPluginHandler.cpp | 62 - libresapi/src/api/ApiPluginHandler.h | 41 - libresapi/src/api/ApiServer.cpp | 464 --- libresapi/src/api/ApiServer.h | 132 - libresapi/src/api/ApiServerLocal.cpp | 180 -- libresapi/src/api/ApiServerLocal.h | 100 - libresapi/src/api/ApiServerMHD.cpp | 693 ----- libresapi/src/api/ApiServerMHD.h | 74 - libresapi/src/api/ApiTypes.h | 335 --- libresapi/src/api/ChannelsHandler.cpp | 540 ---- libresapi/src/api/ChannelsHandler.h | 48 - libresapi/src/api/ChatHandler.cpp | 1491 ---------- libresapi/src/api/ChatHandler.h | 203 -- libresapi/src/api/FileSearchHandler.cpp | 324 --- libresapi/src/api/FileSearchHandler.h | 65 - libresapi/src/api/FileSharingHandler.cpp | 573 ---- libresapi/src/api/FileSharingHandler.h | 87 - libresapi/src/api/ForumHandler.cpp | 169 -- libresapi/src/api/ForumHandler.h | 41 - libresapi/src/api/GetPluginInterfaces.cpp | 72 - libresapi/src/api/GetPluginInterfaces.h | 31 - libresapi/src/api/GxsMetaOperators.h | 6 - libresapi/src/api/GxsResponseTask.cpp | 148 - libresapi/src/api/GxsResponseTask.h | 72 - libresapi/src/api/IdentityHandler.cpp | 722 ----- libresapi/src/api/IdentityHandler.h | 76 - libresapi/src/api/JsonStream.cpp | 545 ---- libresapi/src/api/JsonStream.h | 127 - libresapi/src/api/LivereloadHandler.cpp | 46 - libresapi/src/api/LivereloadHandler.h | 44 - libresapi/src/api/Operators.cpp | 154 - libresapi/src/api/Operators.h | 114 - libresapi/src/api/Pagination.h | 110 - libresapi/src/api/PeersHandler.cpp | 1293 --------- libresapi/src/api/PeersHandler.h | 116 - libresapi/src/api/README.md | 67 - libresapi/src/api/ResourceRouter.cpp | 99 - libresapi/src/api/ResourceRouter.h | 110 - libresapi/src/api/RsControlModule.cpp | 600 ---- libresapi/src/api/RsControlModule.h | 120 - libresapi/src/api/ServiceControlHandler.cpp | 206 -- libresapi/src/api/ServiceControlHandler.h | 42 - libresapi/src/api/SettingsHandler.cpp | 203 -- libresapi/src/api/SettingsHandler.h | 80 - libresapi/src/api/StateTokenServer.cpp | 172 -- libresapi/src/api/StateTokenServer.h | 90 - libresapi/src/api/StatsHandler.cpp | 71 - libresapi/src/api/StatsHandler.h | 46 - libresapi/src/api/TmpBlobStore.cpp | 141 - libresapi/src/api/TmpBlobStore.h | 74 - libresapi/src/api/TransfersHandler.cpp | 374 --- libresapi/src/api/TransfersHandler.h | 76 - libresapi/src/api/json.cpp | 1098 ------- libresapi/src/api/json.h | 617 ---- libresapi/src/libresapi.pro | 212 -- libresapi/src/use_libresapi.pri | 54 - libresapi/src/util/ContentTypes.cpp | 109 - libresapi/src/util/ContentTypes.h | 44 - libresapi/src/webui-src/.gitignore | 2 - libresapi/src/webui-src/README.md | 78 - libresapi/src/webui-src/app/_chat.sass | 81 - libresapi/src/webui-src/app/_reset.scss | 43 - libresapi/src/webui-src/app/accountselect.js | 68 - libresapi/src/webui-src/app/adddownloads.js | 299 -- libresapi/src/webui-src/app/addidentity.js | 54 - libresapi/src/webui-src/app/addpeer.js | 151 - libresapi/src/webui-src/app/assets/index.html | 23 - libresapi/src/webui-src/app/chat.js | 434 --- libresapi/src/webui-src/app/createlogin.js | 254 -- libresapi/src/webui-src/app/downloads.js | 96 - libresapi/src/webui-src/app/forums.js | 65 - libresapi/src/webui-src/app/green-black.scss | 214 -- libresapi/src/webui-src/app/home.js | 6 - libresapi/src/webui-src/app/identities.js | 22 - libresapi/src/webui-src/app/main.js | 122 - libresapi/src/webui-src/app/main.sass | 12 - libresapi/src/webui-src/app/menu.js | 65 - libresapi/src/webui-src/app/menudef.js | 119 - libresapi/src/webui-src/app/mithril.js | 2141 -------------- libresapi/src/webui-src/app/mithril.min.js | 8 - .../src/webui-src/app/mithril.min.js.map | 1 - libresapi/src/webui-src/app/orange.scss | 294 -- libresapi/src/webui-src/app/peers.js | 89 - libresapi/src/webui-src/app/retroshare.js | 410 --- libresapi/src/webui-src/app/search.js | 54 - libresapi/src/webui-src/app/searchresult.js | 71 - libresapi/src/webui-src/app/servicecontrol.js | 264 -- libresapi/src/webui-src/app/settings.js | 19 - libresapi/src/webui-src/app/waiting.js | 8 - libresapi/src/webui-src/brunch-config.js | 12 - libresapi/src/webui-src/make-src/build.bat | 41 - libresapi/src/webui-src/make-src/build.sh | 62 - libresapi/src/webui-src/make-src/chat.css | 72 - libresapi/src/webui-src/make-src/init.bat | 15 - libresapi/src/webui-src/make-src/init.sh | 22 - libresapi/src/webui-src/make-src/main.css | 2 - libresapi/src/webui-src/make-src/readme.md | 7 - libresapi/src/webui-src/make-src/template.js | 112 - libresapi/src/webui-src/package.json | 11 - libretroshare/src/libretroshare.pro | 8 +- libretroshare/src/retroshare/rswebui.h | 5 +- libretroshare/src/rsserver/p3webui.cc | 2 +- libretroshare/src/use_libretroshare.pri | 4 +- rapidjson-1.1.0/license.txt | 57 - rapidjson-1.1.0/rapid_json/allocators.h | 271 -- rapidjson-1.1.0/rapid_json/document.h | 2575 ----------------- rapidjson-1.1.0/rapid_json/encodedstream.h | 299 -- rapidjson-1.1.0/rapid_json/encodings.h | 716 ----- rapidjson-1.1.0/rapid_json/error/en.h | 74 - rapidjson-1.1.0/rapid_json/error/error.h | 155 - rapidjson-1.1.0/rapid_json/filereadstream.h | 99 - rapidjson-1.1.0/rapid_json/filewritestream.h | 104 - rapidjson-1.1.0/rapid_json/fwd.h | 151 - .../rapid_json/internal/biginteger.h | 290 -- rapidjson-1.1.0/rapid_json/internal/diyfp.h | 258 -- rapidjson-1.1.0/rapid_json/internal/dtoa.h | 245 -- rapidjson-1.1.0/rapid_json/internal/ieee754.h | 78 - rapidjson-1.1.0/rapid_json/internal/itoa.h | 304 -- rapidjson-1.1.0/rapid_json/internal/meta.h | 181 -- rapidjson-1.1.0/rapid_json/internal/pow10.h | 55 - rapidjson-1.1.0/rapid_json/internal/regex.h | 701 ----- rapidjson-1.1.0/rapid_json/internal/stack.h | 230 -- rapidjson-1.1.0/rapid_json/internal/strfunc.h | 55 - rapidjson-1.1.0/rapid_json/internal/strtod.h | 269 -- rapidjson-1.1.0/rapid_json/internal/swap.h | 46 - rapidjson-1.1.0/rapid_json/istreamwrapper.h | 115 - rapidjson-1.1.0/rapid_json/memorybuffer.h | 70 - rapidjson-1.1.0/rapid_json/memorystream.h | 71 - rapidjson-1.1.0/rapid_json/ostreamwrapper.h | 81 - rapidjson-1.1.0/rapid_json/pointer.h | 1358 --------- rapidjson-1.1.0/rapid_json/prettywriter.h | 255 -- rapidjson-1.1.0/rapid_json/rapidjson.h | 615 ---- rapidjson-1.1.0/rapid_json/reader.h | 1879 ------------ rapidjson-1.1.0/rapid_json/schema.h | 2006 ------------- rapidjson-1.1.0/rapid_json/stream.h | 179 -- rapidjson-1.1.0/rapid_json/stringbuffer.h | 117 - rapidjson-1.1.0/rapid_json/writer.h | 610 ---- .../src/AutologinManager.qml | 185 -- .../src/TokensManager.qml | 1 - .../src/libresapilocalclient.cpp | 1 - .../src/libresapilocalclient.h | 1 - .../src/main.cpp | 74 - .../src/main.qml | 63 - .../src/notificationsbridge.h | 49 - retroshare-android-notify-service/src/qml.qrc | 8 - retroshare-android-notify-service/src/qmldir | 1 - .../src/retroshare-android-notify-service.pro | 21 - .../src/retroshare-android-service.pro | 20 - retroshare-android-service/src/service.cpp | 102 - retroshare-gui/src/gui/settings/WebuiPage.cpp | 8 +- .../src/gui/settings/rsharesettings.cpp | 4 +- retroshare-nogui/src/TerminalApiClient.cpp | 472 --- retroshare-nogui/src/TerminalApiClient.h | 66 - retroshare-nogui/src/introserver.cc | 660 ----- retroshare-nogui/src/introserver.h | 103 - retroshare-nogui/src/notifytxt.cc | 339 --- retroshare-nogui/src/notifytxt.h | 74 - retroshare-nogui/src/protobuf.pri | 36 - .../src/resources/retroshare_win.rc | 3 - .../src/resources/retroshare_win.rc.h | 24 - retroshare-nogui/src/resources/rs.ico | Bin 110842 -> 0 bytes retroshare-nogui/src/retroshare-nogui.pro | 183 -- retroshare-nogui/src/retroshare.cc | 192 -- retroshare-qml-app/src/AddTrustedNode.qml | 297 -- retroshare-qml-app/src/ApiImageExample.qml | 43 - retroshare-qml-app/src/AppSettings.qml | 27 - retroshare-qml-app/src/BusyOverlay.qml | 44 - retroshare-qml-app/src/ChatBubbleDelegate.qml | 128 - retroshare-qml-app/src/ChatCache.qml | 186 -- retroshare-qml-app/src/ChatView.qml | 388 --- retroshare-qml-app/src/ClipboardWrapper.qml | 47 - retroshare-qml-app/src/ContactDetails.qml | 210 -- retroshare-qml-app/src/ContactSort.js | 101 - retroshare-qml-app/src/Contacts.qml | 235 -- .../src/GxsIdentityDelegate.qml | 294 -- retroshare-qml-app/src/JSONListModel.qml | 51 - retroshare-qml-app/src/Locations.qml | 269 -- retroshare-qml-app/src/NativeCalls.cpp | 1 - retroshare-qml-app/src/NativeCalls.h | 1 - retroshare-qml-app/src/Options.qml | 53 - retroshare-qml-app/src/RsLoginPassView.qml | 153 - retroshare-qml-app/src/TimedPopup.qml | 41 - retroshare-qml-app/src/TokensManager.qml | 145 - retroshare-qml-app/src/TrustedNodeDetails.qml | 233 -- retroshare-qml-app/src/TrustedNodesView.qml | 123 - retroshare-qml-app/src/URI.js | 69 - retroshare-qml-app/src/android/.gitignore | 5 - .../src/android/AndroidManifest.xml | 214 -- retroshare-qml-app/src/android/android.iml | 94 - retroshare-qml-app/src/android/build.gradle | 57 - ...share.android.qml_app_2016.08.22_16.56.txt | 36 - .../src/android/gradle.properties | 9 - .../android/gradle/wrapper/gradle-wrapper.jar | Bin 49896 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 - retroshare-qml-app/src/android/gradlew | 164 -- retroshare-qml-app/src/android/gradlew.bat | 90 - .../res/drawable/retroshare_128x128.png | 1 - .../android/res/drawable/retroshare_48x48.png | 1 - .../src/android/res/values/libs.xml | 25 - .../src/android/src/NativeCalls.cpp | 43 - .../android/qml_app/AppUpdatedReceiver.java | 43 - .../qml_app/BootCompletedReceiver.java | 39 - .../RetroShareAndroidNotifyService.java | 62 - .../qml_app/RetroShareAndroidService.java | 23 - .../qml_app/RetroShareQmlActivity.java | 183 -- .../android/qml_app/UsedByNativeCode.java | 3 - .../android/qml_app/jni/NativeCalls.java | 24 - ...troshare_android_qml_app_jni_NativeCalls.h | 21 - retroshare-qml-app/src/androidimagepicker.h | 95 - .../src/androidplatforminteracions.cpp | 41 - .../src/androidplatforminteracions.h | 34 - .../src/components/AvatarOrColorHash.qml | 159 - .../src/components/ButtonIcon.qml | 28 - .../src/components/ButtonText.qml | 130 - .../src/components/ColorHash.qml | 72 - .../src/components/CustomFileChooser.qml | 60 - retroshare-qml-app/src/components/Faces.qml | 137 - retroshare-qml-app/src/components/SideBar.qml | 259 -- .../src/components/TextAndIcon.qml | 38 - .../src/components/emoji/EmojiButton.qml | 68 - .../components/emoji/EmojiCategoryButton.qml | 98 - .../src/components/emoji/EmojiPicker.qml | 165 -- .../src/components/emoji/emoji.js | 1068 ------- .../src/defaultplatforminteracions.cpp | 25 - .../src/defaultplatforminteracions.h | 34 - retroshare-qml-app/src/deployment.pri | 13 - .../src/fonts/OpenSansEmoji.ttf | Bin 561512 -> 0 bytes retroshare-qml-app/src/icons/add.svg | 54 - .../src/icons/application-menu.svg | 13 - retroshare-qml-app/src/icons/attach-image.svg | 78 - retroshare-qml-app/src/icons/attach.svg | 61 - retroshare-qml-app/src/icons/back.png | Bin 1055 -> 0 bytes retroshare-qml-app/src/icons/chat-bubble.svg | 108 - .../src/icons/edit-image-face-detect.svg | 13 - .../src/icons/emblem-locked.svg | 18 - retroshare-qml-app/src/icons/exit.svg | 65 - .../src/icons/faces/female32/background1.png | Bin 1824 -> 0 bytes .../src/icons/faces/female32/background2.png | Bin 1740 -> 0 bytes .../src/icons/faces/female32/background3.png | Bin 1846 -> 0 bytes .../src/icons/faces/female32/background4.png | Bin 1895 -> 0 bytes .../src/icons/faces/female32/background5.png | Bin 1669 -> 0 bytes .../src/icons/faces/female32/clothes1.png | Bin 387 -> 0 bytes .../src/icons/faces/female32/clothes10.png | Bin 432 -> 0 bytes .../src/icons/faces/female32/clothes11.png | Bin 792 -> 0 bytes .../src/icons/faces/female32/clothes12.png | Bin 803 -> 0 bytes .../src/icons/faces/female32/clothes13.png | Bin 789 -> 0 bytes .../src/icons/faces/female32/clothes14.png | Bin 792 -> 0 bytes .../src/icons/faces/female32/clothes15.png | Bin 803 -> 0 bytes .../src/icons/faces/female32/clothes16.png | Bin 801 -> 0 bytes .../src/icons/faces/female32/clothes17.png | Bin 719 -> 0 bytes .../src/icons/faces/female32/clothes18.png | Bin 743 -> 0 bytes .../src/icons/faces/female32/clothes19.png | Bin 720 -> 0 bytes .../src/icons/faces/female32/clothes2.png | Bin 440 -> 0 bytes .../src/icons/faces/female32/clothes20.png | Bin 728 -> 0 bytes .../src/icons/faces/female32/clothes21.png | Bin 731 -> 0 bytes .../src/icons/faces/female32/clothes22.png | Bin 733 -> 0 bytes .../src/icons/faces/female32/clothes23.png | Bin 709 -> 0 bytes .../src/icons/faces/female32/clothes24.png | Bin 717 -> 0 bytes .../src/icons/faces/female32/clothes25.png | Bin 723 -> 0 bytes .../src/icons/faces/female32/clothes26.png | Bin 571 -> 0 bytes .../src/icons/faces/female32/clothes27.png | Bin 426 -> 0 bytes .../src/icons/faces/female32/clothes28.png | Bin 610 -> 0 bytes .../src/icons/faces/female32/clothes29.png | Bin 619 -> 0 bytes .../src/icons/faces/female32/clothes3.png | Bin 439 -> 0 bytes .../src/icons/faces/female32/clothes30.png | Bin 629 -> 0 bytes .../src/icons/faces/female32/clothes31.png | Bin 635 -> 0 bytes .../src/icons/faces/female32/clothes32.png | Bin 626 -> 0 bytes .../src/icons/faces/female32/clothes33.png | Bin 613 -> 0 bytes .../src/icons/faces/female32/clothes34.png | Bin 569 -> 0 bytes .../src/icons/faces/female32/clothes35.png | Bin 577 -> 0 bytes .../src/icons/faces/female32/clothes36.png | Bin 568 -> 0 bytes .../src/icons/faces/female32/clothes37.png | Bin 571 -> 0 bytes .../src/icons/faces/female32/clothes38.png | Bin 560 -> 0 bytes .../src/icons/faces/female32/clothes39.png | Bin 569 -> 0 bytes .../src/icons/faces/female32/clothes4.png | Bin 431 -> 0 bytes .../src/icons/faces/female32/clothes40.png | Bin 571 -> 0 bytes .../src/icons/faces/female32/clothes41.png | Bin 535 -> 0 bytes .../src/icons/faces/female32/clothes42.png | Bin 559 -> 0 bytes .../src/icons/faces/female32/clothes43.png | Bin 532 -> 0 bytes .../src/icons/faces/female32/clothes44.png | Bin 537 -> 0 bytes .../src/icons/faces/female32/clothes45.png | Bin 537 -> 0 bytes .../src/icons/faces/female32/clothes46.png | Bin 560 -> 0 bytes .../src/icons/faces/female32/clothes47.png | Bin 554 -> 0 bytes .../src/icons/faces/female32/clothes48.png | Bin 544 -> 0 bytes .../src/icons/faces/female32/clothes49.png | Bin 551 -> 0 bytes .../src/icons/faces/female32/clothes5.png | Bin 440 -> 0 bytes .../src/icons/faces/female32/clothes50.png | Bin 697 -> 0 bytes .../src/icons/faces/female32/clothes51.png | Bin 615 -> 0 bytes .../src/icons/faces/female32/clothes52.png | Bin 724 -> 0 bytes .../src/icons/faces/female32/clothes53.png | Bin 475 -> 0 bytes .../src/icons/faces/female32/clothes54.png | Bin 690 -> 0 bytes .../src/icons/faces/female32/clothes55.png | Bin 829 -> 0 bytes .../src/icons/faces/female32/clothes56.png | Bin 438 -> 0 bytes .../src/icons/faces/female32/clothes57.png | Bin 739 -> 0 bytes .../src/icons/faces/female32/clothes58.png | Bin 439 -> 0 bytes .../src/icons/faces/female32/clothes59.png | Bin 960 -> 0 bytes .../src/icons/faces/female32/clothes6.png | Bin 440 -> 0 bytes .../src/icons/faces/female32/clothes7.png | Bin 440 -> 0 bytes .../src/icons/faces/female32/clothes8.png | Bin 440 -> 0 bytes .../src/icons/faces/female32/clothes9.png | Bin 435 -> 0 bytes .../src/icons/faces/female32/eye1.png | Bin 693 -> 0 bytes .../src/icons/faces/female32/eye10.png | Bin 751 -> 0 bytes .../src/icons/faces/female32/eye11.png | Bin 613 -> 0 bytes .../src/icons/faces/female32/eye12.png | Bin 853 -> 0 bytes .../src/icons/faces/female32/eye13.png | Bin 867 -> 0 bytes .../src/icons/faces/female32/eye14.png | Bin 868 -> 0 bytes .../src/icons/faces/female32/eye15.png | Bin 867 -> 0 bytes .../src/icons/faces/female32/eye16.png | Bin 829 -> 0 bytes .../src/icons/faces/female32/eye17.png | Bin 717 -> 0 bytes .../src/icons/faces/female32/eye18.png | Bin 695 -> 0 bytes .../src/icons/faces/female32/eye19.png | Bin 703 -> 0 bytes .../src/icons/faces/female32/eye2.png | Bin 693 -> 0 bytes .../src/icons/faces/female32/eye20.png | Bin 723 -> 0 bytes .../src/icons/faces/female32/eye21.png | Bin 690 -> 0 bytes .../src/icons/faces/female32/eye22.png | Bin 959 -> 0 bytes .../src/icons/faces/female32/eye23.png | Bin 826 -> 0 bytes .../src/icons/faces/female32/eye24.png | Bin 827 -> 0 bytes .../src/icons/faces/female32/eye25.png | Bin 819 -> 0 bytes .../src/icons/faces/female32/eye26.png | Bin 847 -> 0 bytes .../src/icons/faces/female32/eye27.png | Bin 841 -> 0 bytes .../src/icons/faces/female32/eye28.png | Bin 808 -> 0 bytes .../src/icons/faces/female32/eye29.png | Bin 849 -> 0 bytes .../src/icons/faces/female32/eye3.png | Bin 693 -> 0 bytes .../src/icons/faces/female32/eye30.png | Bin 834 -> 0 bytes .../src/icons/faces/female32/eye31.png | Bin 938 -> 0 bytes .../src/icons/faces/female32/eye32.png | Bin 938 -> 0 bytes .../src/icons/faces/female32/eye33.png | Bin 938 -> 0 bytes .../src/icons/faces/female32/eye34.png | Bin 938 -> 0 bytes .../src/icons/faces/female32/eye35.png | Bin 712 -> 0 bytes .../src/icons/faces/female32/eye36.png | Bin 658 -> 0 bytes .../src/icons/faces/female32/eye37.png | Bin 638 -> 0 bytes .../src/icons/faces/female32/eye38.png | Bin 635 -> 0 bytes .../src/icons/faces/female32/eye39.png | Bin 642 -> 0 bytes .../src/icons/faces/female32/eye4.png | Bin 427 -> 0 bytes .../src/icons/faces/female32/eye40.png | Bin 631 -> 0 bytes .../src/icons/faces/female32/eye41.png | Bin 652 -> 0 bytes .../src/icons/faces/female32/eye42.png | Bin 658 -> 0 bytes .../src/icons/faces/female32/eye43.png | Bin 747 -> 0 bytes .../src/icons/faces/female32/eye44.png | Bin 661 -> 0 bytes .../src/icons/faces/female32/eye45.png | Bin 408 -> 0 bytes .../src/icons/faces/female32/eye46.png | Bin 610 -> 0 bytes .../src/icons/faces/female32/eye47.png | Bin 969 -> 0 bytes .../src/icons/faces/female32/eye48.png | Bin 1055 -> 0 bytes .../src/icons/faces/female32/eye49.png | Bin 687 -> 0 bytes .../src/icons/faces/female32/eye5.png | Bin 501 -> 0 bytes .../src/icons/faces/female32/eye50.png | Bin 412 -> 0 bytes .../src/icons/faces/female32/eye51.png | Bin 630 -> 0 bytes .../src/icons/faces/female32/eye52.png | Bin 641 -> 0 bytes .../src/icons/faces/female32/eye53.png | Bin 570 -> 0 bytes .../src/icons/faces/female32/eye6.png | Bin 506 -> 0 bytes .../src/icons/faces/female32/eye7.png | Bin 506 -> 0 bytes .../src/icons/faces/female32/eye8.png | Bin 754 -> 0 bytes .../src/icons/faces/female32/eye9.png | Bin 754 -> 0 bytes .../src/icons/faces/female32/face1.png | Bin 1797 -> 0 bytes .../src/icons/faces/female32/face2.png | Bin 1603 -> 0 bytes .../src/icons/faces/female32/face3.png | Bin 1661 -> 0 bytes .../src/icons/faces/female32/face4.png | Bin 1537 -> 0 bytes .../src/icons/faces/female32/head1.png | Bin 765 -> 0 bytes .../src/icons/faces/female32/head10.png | Bin 912 -> 0 bytes .../src/icons/faces/female32/head11.png | Bin 923 -> 0 bytes .../src/icons/faces/female32/head12.png | Bin 920 -> 0 bytes .../src/icons/faces/female32/head13.png | Bin 682 -> 0 bytes .../src/icons/faces/female32/head14.png | Bin 679 -> 0 bytes .../src/icons/faces/female32/head15.png | Bin 673 -> 0 bytes .../src/icons/faces/female32/head16.png | Bin 838 -> 0 bytes .../src/icons/faces/female32/head17.png | Bin 789 -> 0 bytes .../src/icons/faces/female32/head18.png | Bin 804 -> 0 bytes .../src/icons/faces/female32/head19.png | Bin 549 -> 0 bytes .../src/icons/faces/female32/head2.png | Bin 725 -> 0 bytes .../src/icons/faces/female32/head20.png | Bin 870 -> 0 bytes .../src/icons/faces/female32/head21.png | Bin 854 -> 0 bytes .../src/icons/faces/female32/head22.png | Bin 695 -> 0 bytes .../src/icons/faces/female32/head23.png | Bin 737 -> 0 bytes .../src/icons/faces/female32/head24.png | Bin 723 -> 0 bytes .../src/icons/faces/female32/head25.png | Bin 1457 -> 0 bytes .../src/icons/faces/female32/head26.png | Bin 1051 -> 0 bytes .../src/icons/faces/female32/head27.png | Bin 479 -> 0 bytes .../src/icons/faces/female32/head28.png | Bin 1287 -> 0 bytes .../src/icons/faces/female32/head29.png | Bin 1561 -> 0 bytes .../src/icons/faces/female32/head3.png | Bin 740 -> 0 bytes .../src/icons/faces/female32/head30.png | Bin 1111 -> 0 bytes .../src/icons/faces/female32/head31.png | Bin 1472 -> 0 bytes .../src/icons/faces/female32/head32.png | Bin 539 -> 0 bytes .../src/icons/faces/female32/head33.png | Bin 646 -> 0 bytes .../src/icons/faces/female32/head4.png | Bin 660 -> 0 bytes .../src/icons/faces/female32/head5.png | Bin 647 -> 0 bytes .../src/icons/faces/female32/head6.png | Bin 652 -> 0 bytes .../src/icons/faces/female32/head7.png | Bin 1314 -> 0 bytes .../src/icons/faces/female32/head8.png | Bin 1275 -> 0 bytes .../src/icons/faces/female32/head9.png | Bin 1370 -> 0 bytes .../src/icons/faces/female32/mouth1.png | Bin 379 -> 0 bytes .../src/icons/faces/female32/mouth10.png | Bin 438 -> 0 bytes .../src/icons/faces/female32/mouth11.png | Bin 413 -> 0 bytes .../src/icons/faces/female32/mouth12.png | Bin 357 -> 0 bytes .../src/icons/faces/female32/mouth13.png | Bin 461 -> 0 bytes .../src/icons/faces/female32/mouth14.png | Bin 468 -> 0 bytes .../src/icons/faces/female32/mouth15.png | Bin 421 -> 0 bytes .../src/icons/faces/female32/mouth16.png | Bin 389 -> 0 bytes .../src/icons/faces/female32/mouth17.png | Bin 425 -> 0 bytes .../src/icons/faces/female32/mouth2.png | Bin 484 -> 0 bytes .../src/icons/faces/female32/mouth3.png | Bin 431 -> 0 bytes .../src/icons/faces/female32/mouth4.png | Bin 382 -> 0 bytes .../src/icons/faces/female32/mouth5.png | Bin 519 -> 0 bytes .../src/icons/faces/female32/mouth6.png | Bin 420 -> 0 bytes .../src/icons/faces/female32/mouth7.png | Bin 482 -> 0 bytes .../src/icons/faces/female32/mouth8.png | Bin 439 -> 0 bytes .../src/icons/faces/female32/mouth9.png | Bin 410 -> 0 bytes .../src/icons/faces/female64/background1.png | Bin 3190 -> 0 bytes .../src/icons/faces/female64/background2.png | Bin 2935 -> 0 bytes .../src/icons/faces/female64/background3.png | Bin 3117 -> 0 bytes .../src/icons/faces/female64/background4.png | Bin 3289 -> 0 bytes .../src/icons/faces/female64/background5.png | Bin 3145 -> 0 bytes .../src/icons/faces/female64/clothes1.png | Bin 426 -> 0 bytes .../src/icons/faces/female64/clothes10.png | Bin 491 -> 0 bytes .../src/icons/faces/female64/clothes11.png | Bin 1347 -> 0 bytes .../src/icons/faces/female64/clothes12.png | Bin 1378 -> 0 bytes .../src/icons/faces/female64/clothes13.png | Bin 1335 -> 0 bytes .../src/icons/faces/female64/clothes14.png | Bin 1332 -> 0 bytes .../src/icons/faces/female64/clothes15.png | Bin 1349 -> 0 bytes .../src/icons/faces/female64/clothes16.png | Bin 1305 -> 0 bytes .../src/icons/faces/female64/clothes17.png | Bin 1084 -> 0 bytes .../src/icons/faces/female64/clothes18.png | Bin 1132 -> 0 bytes .../src/icons/faces/female64/clothes19.png | Bin 1105 -> 0 bytes .../src/icons/faces/female64/clothes2.png | Bin 504 -> 0 bytes .../src/icons/faces/female64/clothes20.png | Bin 1109 -> 0 bytes .../src/icons/faces/female64/clothes21.png | Bin 1131 -> 0 bytes .../src/icons/faces/female64/clothes22.png | Bin 1123 -> 0 bytes .../src/icons/faces/female64/clothes23.png | Bin 1113 -> 0 bytes .../src/icons/faces/female64/clothes24.png | Bin 1122 -> 0 bytes .../src/icons/faces/female64/clothes25.png | Bin 1121 -> 0 bytes .../src/icons/faces/female64/clothes26.png | Bin 640 -> 0 bytes .../src/icons/faces/female64/clothes27.png | Bin 485 -> 0 bytes .../src/icons/faces/female64/clothes28.png | Bin 743 -> 0 bytes .../src/icons/faces/female64/clothes29.png | Bin 717 -> 0 bytes .../src/icons/faces/female64/clothes3.png | Bin 498 -> 0 bytes .../src/icons/faces/female64/clothes30.png | Bin 756 -> 0 bytes .../src/icons/faces/female64/clothes31.png | Bin 877 -> 0 bytes .../src/icons/faces/female64/clothes32.png | Bin 848 -> 0 bytes .../src/icons/faces/female64/clothes33.png | Bin 854 -> 0 bytes .../src/icons/faces/female64/clothes34.png | Bin 789 -> 0 bytes .../src/icons/faces/female64/clothes35.png | Bin 771 -> 0 bytes .../src/icons/faces/female64/clothes36.png | Bin 724 -> 0 bytes .../src/icons/faces/female64/clothes37.png | Bin 796 -> 0 bytes .../src/icons/faces/female64/clothes38.png | Bin 802 -> 0 bytes .../src/icons/faces/female64/clothes39.png | Bin 780 -> 0 bytes .../src/icons/faces/female64/clothes4.png | Bin 499 -> 0 bytes .../src/icons/faces/female64/clothes40.png | Bin 761 -> 0 bytes .../src/icons/faces/female64/clothes41.png | Bin 686 -> 0 bytes .../src/icons/faces/female64/clothes42.png | Bin 688 -> 0 bytes .../src/icons/faces/female64/clothes43.png | Bin 661 -> 0 bytes .../src/icons/faces/female64/clothes44.png | Bin 713 -> 0 bytes .../src/icons/faces/female64/clothes45.png | Bin 706 -> 0 bytes .../src/icons/faces/female64/clothes46.png | Bin 690 -> 0 bytes .../src/icons/faces/female64/clothes47.png | Bin 684 -> 0 bytes .../src/icons/faces/female64/clothes48.png | Bin 697 -> 0 bytes .../src/icons/faces/female64/clothes49.png | Bin 689 -> 0 bytes .../src/icons/faces/female64/clothes5.png | Bin 493 -> 0 bytes .../src/icons/faces/female64/clothes50.png | Bin 967 -> 0 bytes .../src/icons/faces/female64/clothes51.png | Bin 916 -> 0 bytes .../src/icons/faces/female64/clothes52.png | Bin 1057 -> 0 bytes .../src/icons/faces/female64/clothes53.png | Bin 626 -> 0 bytes .../src/icons/faces/female64/clothes54.png | Bin 960 -> 0 bytes .../src/icons/faces/female64/clothes55.png | Bin 1399 -> 0 bytes .../src/icons/faces/female64/clothes56.png | Bin 522 -> 0 bytes .../src/icons/faces/female64/clothes57.png | Bin 1238 -> 0 bytes .../src/icons/faces/female64/clothes58.png | Bin 545 -> 0 bytes .../src/icons/faces/female64/clothes59.png | Bin 1461 -> 0 bytes .../src/icons/faces/female64/clothes6.png | Bin 505 -> 0 bytes .../src/icons/faces/female64/clothes7.png | Bin 491 -> 0 bytes .../src/icons/faces/female64/clothes8.png | Bin 506 -> 0 bytes .../src/icons/faces/female64/clothes9.png | Bin 491 -> 0 bytes .../src/icons/faces/female64/eye1.png | Bin 920 -> 0 bytes .../src/icons/faces/female64/eye10.png | Bin 853 -> 0 bytes .../src/icons/faces/female64/eye11.png | Bin 646 -> 0 bytes .../src/icons/faces/female64/eye12.png | Bin 1036 -> 0 bytes .../src/icons/faces/female64/eye13.png | Bin 1072 -> 0 bytes .../src/icons/faces/female64/eye14.png | Bin 1046 -> 0 bytes .../src/icons/faces/female64/eye15.png | Bin 1068 -> 0 bytes .../src/icons/faces/female64/eye16.png | Bin 982 -> 0 bytes .../src/icons/faces/female64/eye17.png | Bin 864 -> 0 bytes .../src/icons/faces/female64/eye18.png | Bin 878 -> 0 bytes .../src/icons/faces/female64/eye19.png | Bin 871 -> 0 bytes .../src/icons/faces/female64/eye2.png | Bin 913 -> 0 bytes .../src/icons/faces/female64/eye20.png | Bin 851 -> 0 bytes .../src/icons/faces/female64/eye21.png | Bin 862 -> 0 bytes .../src/icons/faces/female64/eye22.png | Bin 1556 -> 0 bytes .../src/icons/faces/female64/eye23.png | Bin 1229 -> 0 bytes .../src/icons/faces/female64/eye24.png | Bin 1314 -> 0 bytes .../src/icons/faces/female64/eye25.png | Bin 1044 -> 0 bytes .../src/icons/faces/female64/eye26.png | Bin 1136 -> 0 bytes .../src/icons/faces/female64/eye27.png | Bin 1160 -> 0 bytes .../src/icons/faces/female64/eye28.png | Bin 1038 -> 0 bytes .../src/icons/faces/female64/eye29.png | Bin 1132 -> 0 bytes .../src/icons/faces/female64/eye3.png | Bin 932 -> 0 bytes .../src/icons/faces/female64/eye30.png | Bin 1076 -> 0 bytes .../src/icons/faces/female64/eye31.png | Bin 1271 -> 0 bytes .../src/icons/faces/female64/eye32.png | Bin 1260 -> 0 bytes .../src/icons/faces/female64/eye33.png | Bin 1277 -> 0 bytes .../src/icons/faces/female64/eye34.png | Bin 1282 -> 0 bytes .../src/icons/faces/female64/eye35.png | Bin 904 -> 0 bytes .../src/icons/faces/female64/eye36.png | Bin 857 -> 0 bytes .../src/icons/faces/female64/eye37.png | Bin 706 -> 0 bytes .../src/icons/faces/female64/eye38.png | Bin 710 -> 0 bytes .../src/icons/faces/female64/eye39.png | Bin 745 -> 0 bytes .../src/icons/faces/female64/eye4.png | Bin 490 -> 0 bytes .../src/icons/faces/female64/eye40.png | Bin 741 -> 0 bytes .../src/icons/faces/female64/eye41.png | Bin 843 -> 0 bytes .../src/icons/faces/female64/eye42.png | Bin 856 -> 0 bytes .../src/icons/faces/female64/eye43.png | Bin 1085 -> 0 bytes .../src/icons/faces/female64/eye44.png | Bin 879 -> 0 bytes .../src/icons/faces/female64/eye45.png | Bin 456 -> 0 bytes .../src/icons/faces/female64/eye46.png | Bin 851 -> 0 bytes .../src/icons/faces/female64/eye47.png | Bin 1819 -> 0 bytes .../src/icons/faces/female64/eye48.png | Bin 1239 -> 0 bytes .../src/icons/faces/female64/eye49.png | Bin 911 -> 0 bytes .../src/icons/faces/female64/eye5.png | Bin 589 -> 0 bytes .../src/icons/faces/female64/eye50.png | Bin 485 -> 0 bytes .../src/icons/faces/female64/eye51.png | Bin 813 -> 0 bytes .../src/icons/faces/female64/eye52.png | Bin 908 -> 0 bytes .../src/icons/faces/female64/eye53.png | Bin 725 -> 0 bytes .../src/icons/faces/female64/eye6.png | Bin 612 -> 0 bytes .../src/icons/faces/female64/eye7.png | Bin 608 -> 0 bytes .../src/icons/faces/female64/eye8.png | Bin 864 -> 0 bytes .../src/icons/faces/female64/eye9.png | Bin 857 -> 0 bytes .../src/icons/faces/female64/face1.png | Bin 4899 -> 0 bytes .../src/icons/faces/female64/face2.png | Bin 4517 -> 0 bytes .../src/icons/faces/female64/face3.png | Bin 4697 -> 0 bytes .../src/icons/faces/female64/face4.png | Bin 4013 -> 0 bytes .../src/icons/faces/female64/head1.png | Bin 922 -> 0 bytes .../src/icons/faces/female64/head10.png | Bin 1277 -> 0 bytes .../src/icons/faces/female64/head11.png | Bin 1248 -> 0 bytes .../src/icons/faces/female64/head12.png | Bin 1268 -> 0 bytes .../src/icons/faces/female64/head13.png | Bin 845 -> 0 bytes .../src/icons/faces/female64/head14.png | Bin 803 -> 0 bytes .../src/icons/faces/female64/head15.png | Bin 813 -> 0 bytes .../src/icons/faces/female64/head16.png | Bin 1113 -> 0 bytes .../src/icons/faces/female64/head17.png | Bin 1108 -> 0 bytes .../src/icons/faces/female64/head18.png | Bin 1137 -> 0 bytes .../src/icons/faces/female64/head19.png | Bin 680 -> 0 bytes .../src/icons/faces/female64/head2.png | Bin 887 -> 0 bytes .../src/icons/faces/female64/head20.png | Bin 1101 -> 0 bytes .../src/icons/faces/female64/head21.png | Bin 1014 -> 0 bytes .../src/icons/faces/female64/head22.png | Bin 899 -> 0 bytes .../src/icons/faces/female64/head23.png | Bin 1014 -> 0 bytes .../src/icons/faces/female64/head24.png | Bin 1150 -> 0 bytes .../src/icons/faces/female64/head25.png | Bin 2349 -> 0 bytes .../src/icons/faces/female64/head26.png | Bin 1575 -> 0 bytes .../src/icons/faces/female64/head27.png | Bin 568 -> 0 bytes .../src/icons/faces/female64/head28.png | Bin 2017 -> 0 bytes .../src/icons/faces/female64/head29.png | Bin 2035 -> 0 bytes .../src/icons/faces/female64/head3.png | Bin 902 -> 0 bytes .../src/icons/faces/female64/head30.png | Bin 1537 -> 0 bytes .../src/icons/faces/female64/head31.png | Bin 2403 -> 0 bytes .../src/icons/faces/female64/head32.png | Bin 663 -> 0 bytes .../src/icons/faces/female64/head33.png | Bin 869 -> 0 bytes .../src/icons/faces/female64/head4.png | Bin 844 -> 0 bytes .../src/icons/faces/female64/head5.png | Bin 855 -> 0 bytes .../src/icons/faces/female64/head6.png | Bin 860 -> 0 bytes .../src/icons/faces/female64/head7.png | Bin 1909 -> 0 bytes .../src/icons/faces/female64/head8.png | Bin 1858 -> 0 bytes .../src/icons/faces/female64/head9.png | Bin 1842 -> 0 bytes .../src/icons/faces/female64/mouth1.png | Bin 435 -> 0 bytes .../src/icons/faces/female64/mouth10.png | Bin 512 -> 0 bytes .../src/icons/faces/female64/mouth11.png | Bin 526 -> 0 bytes .../src/icons/faces/female64/mouth12.png | Bin 376 -> 0 bytes .../src/icons/faces/female64/mouth13.png | Bin 487 -> 0 bytes .../src/icons/faces/female64/mouth14.png | Bin 573 -> 0 bytes .../src/icons/faces/female64/mouth15.png | Bin 517 -> 0 bytes .../src/icons/faces/female64/mouth16.png | Bin 482 -> 0 bytes .../src/icons/faces/female64/mouth17.png | Bin 529 -> 0 bytes .../src/icons/faces/female64/mouth2.png | Bin 588 -> 0 bytes .../src/icons/faces/female64/mouth3.png | Bin 518 -> 0 bytes .../src/icons/faces/female64/mouth4.png | Bin 476 -> 0 bytes .../src/icons/faces/female64/mouth5.png | Bin 689 -> 0 bytes .../src/icons/faces/female64/mouth6.png | Bin 472 -> 0 bytes .../src/icons/faces/female64/mouth7.png | Bin 500 -> 0 bytes .../src/icons/faces/female64/mouth8.png | Bin 540 -> 0 bytes .../src/icons/faces/female64/mouth9.png | Bin 451 -> 0 bytes .../src/icons/faces/male32/background1.png | Bin 1824 -> 0 bytes .../src/icons/faces/male32/background2.png | Bin 1740 -> 0 bytes .../src/icons/faces/male32/background3.png | Bin 1846 -> 0 bytes .../src/icons/faces/male32/background4.png | Bin 1895 -> 0 bytes .../src/icons/faces/male32/background5.png | Bin 1669 -> 0 bytes .../src/icons/faces/male32/clothes1.png | Bin 723 -> 0 bytes .../src/icons/faces/male32/clothes10.png | Bin 550 -> 0 bytes .../src/icons/faces/male32/clothes11.png | Bin 724 -> 0 bytes .../src/icons/faces/male32/clothes12.png | Bin 643 -> 0 bytes .../src/icons/faces/male32/clothes13.png | Bin 643 -> 0 bytes .../src/icons/faces/male32/clothes14.png | Bin 651 -> 0 bytes .../src/icons/faces/male32/clothes15.png | Bin 537 -> 0 bytes .../src/icons/faces/male32/clothes16.png | Bin 541 -> 0 bytes .../src/icons/faces/male32/clothes17.png | Bin 533 -> 0 bytes .../src/icons/faces/male32/clothes18.png | Bin 542 -> 0 bytes .../src/icons/faces/male32/clothes19.png | Bin 669 -> 0 bytes .../src/icons/faces/male32/clothes2.png | Bin 550 -> 0 bytes .../src/icons/faces/male32/clothes20.png | Bin 683 -> 0 bytes .../src/icons/faces/male32/clothes21.png | Bin 603 -> 0 bytes .../src/icons/faces/male32/clothes22.png | Bin 599 -> 0 bytes .../src/icons/faces/male32/clothes23.png | Bin 593 -> 0 bytes .../src/icons/faces/male32/clothes24.png | Bin 593 -> 0 bytes .../src/icons/faces/male32/clothes25.png | Bin 601 -> 0 bytes .../src/icons/faces/male32/clothes26.png | Bin 607 -> 0 bytes .../src/icons/faces/male32/clothes27.png | Bin 606 -> 0 bytes .../src/icons/faces/male32/clothes28.png | Bin 598 -> 0 bytes .../src/icons/faces/male32/clothes29.png | Bin 437 -> 0 bytes .../src/icons/faces/male32/clothes3.png | Bin 485 -> 0 bytes .../src/icons/faces/male32/clothes30.png | Bin 442 -> 0 bytes .../src/icons/faces/male32/clothes31.png | Bin 437 -> 0 bytes .../src/icons/faces/male32/clothes32.png | Bin 447 -> 0 bytes .../src/icons/faces/male32/clothes33.png | Bin 442 -> 0 bytes .../src/icons/faces/male32/clothes34.png | Bin 437 -> 0 bytes .../src/icons/faces/male32/clothes35.png | Bin 437 -> 0 bytes .../src/icons/faces/male32/clothes36.png | Bin 437 -> 0 bytes .../src/icons/faces/male32/clothes37.png | Bin 442 -> 0 bytes .../src/icons/faces/male32/clothes38.png | Bin 497 -> 0 bytes .../src/icons/faces/male32/clothes39.png | Bin 494 -> 0 bytes .../src/icons/faces/male32/clothes4.png | Bin 653 -> 0 bytes .../src/icons/faces/male32/clothes40.png | Bin 501 -> 0 bytes .../src/icons/faces/male32/clothes41.png | Bin 492 -> 0 bytes .../src/icons/faces/male32/clothes42.png | Bin 483 -> 0 bytes .../src/icons/faces/male32/clothes43.png | Bin 469 -> 0 bytes .../src/icons/faces/male32/clothes44.png | Bin 462 -> 0 bytes .../src/icons/faces/male32/clothes45.png | Bin 512 -> 0 bytes .../src/icons/faces/male32/clothes46.png | Bin 402 -> 0 bytes .../src/icons/faces/male32/clothes47.png | Bin 474 -> 0 bytes .../src/icons/faces/male32/clothes48.png | Bin 477 -> 0 bytes .../src/icons/faces/male32/clothes49.png | Bin 531 -> 0 bytes .../src/icons/faces/male32/clothes5.png | Bin 469 -> 0 bytes .../src/icons/faces/male32/clothes50.png | Bin 417 -> 0 bytes .../src/icons/faces/male32/clothes51.png | Bin 410 -> 0 bytes .../src/icons/faces/male32/clothes52.png | Bin 475 -> 0 bytes .../src/icons/faces/male32/clothes53.png | Bin 655 -> 0 bytes .../src/icons/faces/male32/clothes54.png | Bin 838 -> 0 bytes .../src/icons/faces/male32/clothes55.png | Bin 667 -> 0 bytes .../src/icons/faces/male32/clothes56.png | Bin 539 -> 0 bytes .../src/icons/faces/male32/clothes57.png | Bin 656 -> 0 bytes .../src/icons/faces/male32/clothes58.png | Bin 844 -> 0 bytes .../src/icons/faces/male32/clothes59.png | Bin 1108 -> 0 bytes .../src/icons/faces/male32/clothes6.png | Bin 758 -> 0 bytes .../src/icons/faces/male32/clothes60.png | Bin 1139 -> 0 bytes .../src/icons/faces/male32/clothes61.png | Bin 686 -> 0 bytes .../src/icons/faces/male32/clothes62.png | Bin 553 -> 0 bytes .../src/icons/faces/male32/clothes63.png | Bin 531 -> 0 bytes .../src/icons/faces/male32/clothes64.png | Bin 1013 -> 0 bytes .../src/icons/faces/male32/clothes65.png | Bin 934 -> 0 bytes .../src/icons/faces/male32/clothes7.png | Bin 541 -> 0 bytes .../src/icons/faces/male32/clothes8.png | Bin 541 -> 0 bytes .../src/icons/faces/male32/clothes9.png | Bin 542 -> 0 bytes .../src/icons/faces/male32/eye1.png | Bin 542 -> 0 bytes .../src/icons/faces/male32/eye10.png | Bin 752 -> 0 bytes .../src/icons/faces/male32/eye11.png | Bin 996 -> 0 bytes .../src/icons/faces/male32/eye12.png | Bin 720 -> 0 bytes .../src/icons/faces/male32/eye13.png | Bin 659 -> 0 bytes .../src/icons/faces/male32/eye14.png | Bin 742 -> 0 bytes .../src/icons/faces/male32/eye15.png | Bin 867 -> 0 bytes .../src/icons/faces/male32/eye16.png | Bin 599 -> 0 bytes .../src/icons/faces/male32/eye17.png | Bin 570 -> 0 bytes .../src/icons/faces/male32/eye18.png | Bin 558 -> 0 bytes .../src/icons/faces/male32/eye19.png | Bin 683 -> 0 bytes .../src/icons/faces/male32/eye2.png | Bin 511 -> 0 bytes .../src/icons/faces/male32/eye20.png | Bin 418 -> 0 bytes .../src/icons/faces/male32/eye21.png | Bin 640 -> 0 bytes .../src/icons/faces/male32/eye22.png | Bin 835 -> 0 bytes .../src/icons/faces/male32/eye23.png | Bin 643 -> 0 bytes .../src/icons/faces/male32/eye24.png | Bin 625 -> 0 bytes .../src/icons/faces/male32/eye25.png | Bin 570 -> 0 bytes .../src/icons/faces/male32/eye26.png | Bin 636 -> 0 bytes .../src/icons/faces/male32/eye27.png | Bin 558 -> 0 bytes .../src/icons/faces/male32/eye28.png | Bin 553 -> 0 bytes .../src/icons/faces/male32/eye29.png | Bin 587 -> 0 bytes .../src/icons/faces/male32/eye3.png | Bin 703 -> 0 bytes .../src/icons/faces/male32/eye30.png | Bin 635 -> 0 bytes .../src/icons/faces/male32/eye31.png | Bin 398 -> 0 bytes .../src/icons/faces/male32/eye32.png | Bin 414 -> 0 bytes .../src/icons/faces/male32/eye4.png | Bin 677 -> 0 bytes .../src/icons/faces/male32/eye5.png | Bin 730 -> 0 bytes .../src/icons/faces/male32/eye6.png | Bin 581 -> 0 bytes .../src/icons/faces/male32/eye7.png | Bin 588 -> 0 bytes .../src/icons/faces/male32/eye8.png | Bin 553 -> 0 bytes .../src/icons/faces/male32/eye9.png | Bin 498 -> 0 bytes .../src/icons/faces/male32/face1.png | Bin 1985 -> 0 bytes .../src/icons/faces/male32/face2.png | Bin 1932 -> 0 bytes .../src/icons/faces/male32/face3.png | Bin 1668 -> 0 bytes .../src/icons/faces/male32/face4.png | Bin 1946 -> 0 bytes .../src/icons/faces/male32/hair1.png | Bin 670 -> 0 bytes .../src/icons/faces/male32/hair10.png | Bin 565 -> 0 bytes .../src/icons/faces/male32/hair11.png | Bin 682 -> 0 bytes .../src/icons/faces/male32/hair12.png | Bin 1100 -> 0 bytes .../src/icons/faces/male32/hair13.png | Bin 664 -> 0 bytes .../src/icons/faces/male32/hair14.png | Bin 917 -> 0 bytes .../src/icons/faces/male32/hair15.png | Bin 831 -> 0 bytes .../src/icons/faces/male32/hair16.png | Bin 837 -> 0 bytes .../src/icons/faces/male32/hair17.png | Bin 879 -> 0 bytes .../src/icons/faces/male32/hair18.png | Bin 905 -> 0 bytes .../src/icons/faces/male32/hair19.png | Bin 502 -> 0 bytes .../src/icons/faces/male32/hair2.png | Bin 740 -> 0 bytes .../src/icons/faces/male32/hair20.png | Bin 833 -> 0 bytes .../src/icons/faces/male32/hair21.png | Bin 710 -> 0 bytes .../src/icons/faces/male32/hair22.png | Bin 417 -> 0 bytes .../src/icons/faces/male32/hair23.png | Bin 1533 -> 0 bytes .../src/icons/faces/male32/hair24.png | Bin 369 -> 0 bytes .../src/icons/faces/male32/hair25.png | Bin 494 -> 0 bytes .../src/icons/faces/male32/hair26.png | Bin 814 -> 0 bytes .../src/icons/faces/male32/hair27.png | Bin 746 -> 0 bytes .../src/icons/faces/male32/hair28.png | Bin 981 -> 0 bytes .../src/icons/faces/male32/hair29.png | Bin 1003 -> 0 bytes .../src/icons/faces/male32/hair3.png | Bin 705 -> 0 bytes .../src/icons/faces/male32/hair30.png | Bin 643 -> 0 bytes .../src/icons/faces/male32/hair31.png | Bin 509 -> 0 bytes .../src/icons/faces/male32/hair32.png | Bin 958 -> 0 bytes .../src/icons/faces/male32/hair33.png | Bin 496 -> 0 bytes .../src/icons/faces/male32/hair34.png | Bin 966 -> 0 bytes .../src/icons/faces/male32/hair35.png | Bin 969 -> 0 bytes .../src/icons/faces/male32/hair36.png | Bin 974 -> 0 bytes .../src/icons/faces/male32/hair4.png | Bin 648 -> 0 bytes .../src/icons/faces/male32/hair5.png | Bin 777 -> 0 bytes .../src/icons/faces/male32/hair6.png | Bin 737 -> 0 bytes .../src/icons/faces/male32/hair7.png | Bin 404 -> 0 bytes .../src/icons/faces/male32/hair8.png | Bin 684 -> 0 bytes .../src/icons/faces/male32/hair9.png | Bin 665 -> 0 bytes .../src/icons/faces/male32/mouth1.png | Bin 468 -> 0 bytes .../src/icons/faces/male32/mouth10.png | Bin 365 -> 0 bytes .../src/icons/faces/male32/mouth11.png | Bin 372 -> 0 bytes .../src/icons/faces/male32/mouth12.png | Bin 477 -> 0 bytes .../src/icons/faces/male32/mouth13.png | Bin 399 -> 0 bytes .../src/icons/faces/male32/mouth14.png | Bin 498 -> 0 bytes .../src/icons/faces/male32/mouth15.png | Bin 1096 -> 0 bytes .../src/icons/faces/male32/mouth16.png | Bin 398 -> 0 bytes .../src/icons/faces/male32/mouth17.png | Bin 381 -> 0 bytes .../src/icons/faces/male32/mouth18.png | Bin 846 -> 0 bytes .../src/icons/faces/male32/mouth19.png | Bin 474 -> 0 bytes .../src/icons/faces/male32/mouth2.png | Bin 499 -> 0 bytes .../src/icons/faces/male32/mouth20.png | Bin 854 -> 0 bytes .../src/icons/faces/male32/mouth21.png | Bin 349 -> 0 bytes .../src/icons/faces/male32/mouth22.png | Bin 525 -> 0 bytes .../src/icons/faces/male32/mouth23.png | Bin 755 -> 0 bytes .../src/icons/faces/male32/mouth24.png | Bin 866 -> 0 bytes .../src/icons/faces/male32/mouth25.png | Bin 793 -> 0 bytes .../src/icons/faces/male32/mouth26.png | Bin 516 -> 0 bytes .../src/icons/faces/male32/mouth3.png | Bin 469 -> 0 bytes .../src/icons/faces/male32/mouth4.png | Bin 670 -> 0 bytes .../src/icons/faces/male32/mouth5.png | Bin 576 -> 0 bytes .../src/icons/faces/male32/mouth6.png | Bin 680 -> 0 bytes .../src/icons/faces/male32/mouth7.png | Bin 536 -> 0 bytes .../src/icons/faces/male32/mouth8.png | Bin 457 -> 0 bytes .../src/icons/faces/male32/mouth9.png | Bin 412 -> 0 bytes .../src/icons/faces/male64/background1.png | Bin 3190 -> 0 bytes .../src/icons/faces/male64/background2.png | Bin 2935 -> 0 bytes .../src/icons/faces/male64/background3.png | Bin 3117 -> 0 bytes .../src/icons/faces/male64/background4.png | Bin 3289 -> 0 bytes .../src/icons/faces/male64/background5.png | Bin 3145 -> 0 bytes .../src/icons/faces/male64/clothes1.png | Bin 923 -> 0 bytes .../src/icons/faces/male64/clothes10.png | Bin 730 -> 0 bytes .../src/icons/faces/male64/clothes11.png | Bin 999 -> 0 bytes .../src/icons/faces/male64/clothes12.png | Bin 896 -> 0 bytes .../src/icons/faces/male64/clothes13.png | Bin 874 -> 0 bytes .../src/icons/faces/male64/clothes14.png | Bin 889 -> 0 bytes .../src/icons/faces/male64/clothes15.png | Bin 733 -> 0 bytes .../src/icons/faces/male64/clothes16.png | Bin 689 -> 0 bytes .../src/icons/faces/male64/clothes17.png | Bin 672 -> 0 bytes .../src/icons/faces/male64/clothes18.png | Bin 682 -> 0 bytes .../src/icons/faces/male64/clothes19.png | Bin 840 -> 0 bytes .../src/icons/faces/male64/clothes2.png | Bin 680 -> 0 bytes .../src/icons/faces/male64/clothes20.png | Bin 857 -> 0 bytes .../src/icons/faces/male64/clothes21.png | Bin 810 -> 0 bytes .../src/icons/faces/male64/clothes22.png | Bin 796 -> 0 bytes .../src/icons/faces/male64/clothes23.png | Bin 802 -> 0 bytes .../src/icons/faces/male64/clothes24.png | Bin 803 -> 0 bytes .../src/icons/faces/male64/clothes25.png | Bin 794 -> 0 bytes .../src/icons/faces/male64/clothes26.png | Bin 800 -> 0 bytes .../src/icons/faces/male64/clothes27.png | Bin 815 -> 0 bytes .../src/icons/faces/male64/clothes28.png | Bin 791 -> 0 bytes .../src/icons/faces/male64/clothes29.png | Bin 506 -> 0 bytes .../src/icons/faces/male64/clothes3.png | Bin 613 -> 0 bytes .../src/icons/faces/male64/clothes30.png | Bin 501 -> 0 bytes .../src/icons/faces/male64/clothes31.png | Bin 501 -> 0 bytes .../src/icons/faces/male64/clothes32.png | Bin 519 -> 0 bytes .../src/icons/faces/male64/clothes33.png | Bin 501 -> 0 bytes .../src/icons/faces/male64/clothes34.png | Bin 501 -> 0 bytes .../src/icons/faces/male64/clothes35.png | Bin 511 -> 0 bytes .../src/icons/faces/male64/clothes36.png | Bin 501 -> 0 bytes .../src/icons/faces/male64/clothes37.png | Bin 501 -> 0 bytes .../src/icons/faces/male64/clothes38.png | Bin 541 -> 0 bytes .../src/icons/faces/male64/clothes39.png | Bin 553 -> 0 bytes .../src/icons/faces/male64/clothes4.png | Bin 825 -> 0 bytes .../src/icons/faces/male64/clothes40.png | Bin 540 -> 0 bytes .../src/icons/faces/male64/clothes41.png | Bin 528 -> 0 bytes .../src/icons/faces/male64/clothes42.png | Bin 553 -> 0 bytes .../src/icons/faces/male64/clothes43.png | Bin 515 -> 0 bytes .../src/icons/faces/male64/clothes44.png | Bin 591 -> 0 bytes .../src/icons/faces/male64/clothes45.png | Bin 661 -> 0 bytes .../src/icons/faces/male64/clothes46.png | Bin 467 -> 0 bytes .../src/icons/faces/male64/clothes47.png | Bin 576 -> 0 bytes .../src/icons/faces/male64/clothes48.png | Bin 598 -> 0 bytes .../src/icons/faces/male64/clothes49.png | Bin 678 -> 0 bytes .../src/icons/faces/male64/clothes5.png | Bin 523 -> 0 bytes .../src/icons/faces/male64/clothes50.png | Bin 504 -> 0 bytes .../src/icons/faces/male64/clothes51.png | Bin 493 -> 0 bytes .../src/icons/faces/male64/clothes52.png | Bin 608 -> 0 bytes .../src/icons/faces/male64/clothes53.png | Bin 1010 -> 0 bytes .../src/icons/faces/male64/clothes54.png | Bin 1325 -> 0 bytes .../src/icons/faces/male64/clothes55.png | Bin 944 -> 0 bytes .../src/icons/faces/male64/clothes56.png | Bin 799 -> 0 bytes .../src/icons/faces/male64/clothes57.png | Bin 905 -> 0 bytes .../src/icons/faces/male64/clothes58.png | Bin 1454 -> 0 bytes .../src/icons/faces/male64/clothes59.png | Bin 1550 -> 0 bytes .../src/icons/faces/male64/clothes6.png | Bin 1095 -> 0 bytes .../src/icons/faces/male64/clothes60.png | Bin 1563 -> 0 bytes .../src/icons/faces/male64/clothes61.png | Bin 1070 -> 0 bytes .../src/icons/faces/male64/clothes62.png | Bin 719 -> 0 bytes .../src/icons/faces/male64/clothes63.png | Bin 700 -> 0 bytes .../src/icons/faces/male64/clothes64.png | Bin 1440 -> 0 bytes .../src/icons/faces/male64/clothes65.png | Bin 1371 -> 0 bytes .../src/icons/faces/male64/clothes7.png | Bin 674 -> 0 bytes .../src/icons/faces/male64/clothes8.png | Bin 737 -> 0 bytes .../src/icons/faces/male64/clothes9.png | Bin 744 -> 0 bytes .../src/icons/faces/male64/eye1.png | Bin 609 -> 0 bytes .../src/icons/faces/male64/eye10.png | Bin 940 -> 0 bytes .../src/icons/faces/male64/eye11.png | Bin 1839 -> 0 bytes .../src/icons/faces/male64/eye12.png | Bin 1081 -> 0 bytes .../src/icons/faces/male64/eye13.png | Bin 803 -> 0 bytes .../src/icons/faces/male64/eye14.png | Bin 1046 -> 0 bytes .../src/icons/faces/male64/eye15.png | Bin 1166 -> 0 bytes .../src/icons/faces/male64/eye16.png | Bin 731 -> 0 bytes .../src/icons/faces/male64/eye17.png | Bin 833 -> 0 bytes .../src/icons/faces/male64/eye18.png | Bin 735 -> 0 bytes .../src/icons/faces/male64/eye19.png | Bin 943 -> 0 bytes .../src/icons/faces/male64/eye2.png | Bin 627 -> 0 bytes .../src/icons/faces/male64/eye20.png | Bin 502 -> 0 bytes .../src/icons/faces/male64/eye21.png | Bin 910 -> 0 bytes .../src/icons/faces/male64/eye22.png | Bin 1592 -> 0 bytes .../src/icons/faces/male64/eye23.png | Bin 1018 -> 0 bytes .../src/icons/faces/male64/eye24.png | Bin 768 -> 0 bytes .../src/icons/faces/male64/eye25.png | Bin 750 -> 0 bytes .../src/icons/faces/male64/eye26.png | Bin 838 -> 0 bytes .../src/icons/faces/male64/eye27.png | Bin 722 -> 0 bytes .../src/icons/faces/male64/eye28.png | Bin 610 -> 0 bytes .../src/icons/faces/male64/eye29.png | Bin 889 -> 0 bytes .../src/icons/faces/male64/eye3.png | Bin 1038 -> 0 bytes .../src/icons/faces/male64/eye30.png | Bin 895 -> 0 bytes .../src/icons/faces/male64/eye31.png | Bin 513 -> 0 bytes .../src/icons/faces/male64/eye32.png | Bin 458 -> 0 bytes .../src/icons/faces/male64/eye4.png | Bin 1017 -> 0 bytes .../src/icons/faces/male64/eye5.png | Bin 1001 -> 0 bytes .../src/icons/faces/male64/eye6.png | Bin 608 -> 0 bytes .../src/icons/faces/male64/eye7.png | Bin 886 -> 0 bytes .../src/icons/faces/male64/eye8.png | Bin 615 -> 0 bytes .../src/icons/faces/male64/eye9.png | Bin 544 -> 0 bytes .../src/icons/faces/male64/face1.png | Bin 5352 -> 0 bytes .../src/icons/faces/male64/face2.png | Bin 4909 -> 0 bytes .../src/icons/faces/male64/face3.png | Bin 4405 -> 0 bytes .../src/icons/faces/male64/face4.png | Bin 5275 -> 0 bytes .../src/icons/faces/male64/hair1.png | Bin 811 -> 0 bytes .../src/icons/faces/male64/hair10.png | Bin 745 -> 0 bytes .../src/icons/faces/male64/hair11.png | Bin 901 -> 0 bytes .../src/icons/faces/male64/hair12.png | Bin 1602 -> 0 bytes .../src/icons/faces/male64/hair13.png | Bin 858 -> 0 bytes .../src/icons/faces/male64/hair14.png | Bin 1195 -> 0 bytes .../src/icons/faces/male64/hair15.png | Bin 1212 -> 0 bytes .../src/icons/faces/male64/hair16.png | Bin 1087 -> 0 bytes .../src/icons/faces/male64/hair17.png | Bin 1361 -> 0 bytes .../src/icons/faces/male64/hair18.png | Bin 1470 -> 0 bytes .../src/icons/faces/male64/hair19.png | Bin 679 -> 0 bytes .../src/icons/faces/male64/hair2.png | Bin 859 -> 0 bytes .../src/icons/faces/male64/hair20.png | Bin 1359 -> 0 bytes .../src/icons/faces/male64/hair21.png | Bin 1008 -> 0 bytes .../src/icons/faces/male64/hair22.png | Bin 514 -> 0 bytes .../src/icons/faces/male64/hair23.png | Bin 2490 -> 0 bytes .../src/icons/faces/male64/hair24.png | Bin 415 -> 0 bytes .../src/icons/faces/male64/hair25.png | Bin 718 -> 0 bytes .../src/icons/faces/male64/hair26.png | Bin 1604 -> 0 bytes .../src/icons/faces/male64/hair27.png | Bin 1050 -> 0 bytes .../src/icons/faces/male64/hair28.png | Bin 1463 -> 0 bytes .../src/icons/faces/male64/hair29.png | Bin 1772 -> 0 bytes .../src/icons/faces/male64/hair3.png | Bin 916 -> 0 bytes .../src/icons/faces/male64/hair30.png | Bin 857 -> 0 bytes .../src/icons/faces/male64/hair31.png | Bin 628 -> 0 bytes .../src/icons/faces/male64/hair32.png | Bin 1589 -> 0 bytes .../src/icons/faces/male64/hair33.png | Bin 662 -> 0 bytes .../src/icons/faces/male64/hair34.png | Bin 1653 -> 0 bytes .../src/icons/faces/male64/hair35.png | Bin 1604 -> 0 bytes .../src/icons/faces/male64/hair36.png | Bin 1598 -> 0 bytes .../src/icons/faces/male64/hair4.png | Bin 819 -> 0 bytes .../src/icons/faces/male64/hair5.png | Bin 970 -> 0 bytes .../src/icons/faces/male64/hair6.png | Bin 971 -> 0 bytes .../src/icons/faces/male64/hair7.png | Bin 441 -> 0 bytes .../src/icons/faces/male64/hair8.png | Bin 837 -> 0 bytes .../src/icons/faces/male64/hair9.png | Bin 798 -> 0 bytes .../src/icons/faces/male64/mouth1.png | Bin 539 -> 0 bytes .../src/icons/faces/male64/mouth10.png | Bin 429 -> 0 bytes .../src/icons/faces/male64/mouth11.png | Bin 407 -> 0 bytes .../src/icons/faces/male64/mouth12.png | Bin 627 -> 0 bytes .../src/icons/faces/male64/mouth13.png | Bin 413 -> 0 bytes .../src/icons/faces/male64/mouth14.png | Bin 594 -> 0 bytes .../src/icons/faces/male64/mouth15.png | Bin 1484 -> 0 bytes .../src/icons/faces/male64/mouth16.png | Bin 477 -> 0 bytes .../src/icons/faces/male64/mouth17.png | Bin 424 -> 0 bytes .../src/icons/faces/male64/mouth18.png | Bin 1481 -> 0 bytes .../src/icons/faces/male64/mouth19.png | Bin 590 -> 0 bytes .../src/icons/faces/male64/mouth2.png | Bin 703 -> 0 bytes .../src/icons/faces/male64/mouth20.png | Bin 1588 -> 0 bytes .../src/icons/faces/male64/mouth21.png | Bin 369 -> 0 bytes .../src/icons/faces/male64/mouth22.png | Bin 772 -> 0 bytes .../src/icons/faces/male64/mouth23.png | Bin 1054 -> 0 bytes .../src/icons/faces/male64/mouth24.png | Bin 1539 -> 0 bytes .../src/icons/faces/male64/mouth25.png | Bin 1310 -> 0 bytes .../src/icons/faces/male64/mouth26.png | Bin 748 -> 0 bytes .../src/icons/faces/male64/mouth3.png | Bin 602 -> 0 bytes .../src/icons/faces/male64/mouth4.png | Bin 879 -> 0 bytes .../src/icons/faces/male64/mouth5.png | Bin 755 -> 0 bytes .../src/icons/faces/male64/mouth6.png | Bin 905 -> 0 bytes .../src/icons/faces/male64/mouth7.png | Bin 686 -> 0 bytes .../src/icons/faces/male64/mouth8.png | Bin 565 -> 0 bytes .../src/icons/faces/male64/mouth9.png | Bin 483 -> 0 bytes retroshare-qml-app/src/icons/info.svg | 60 - retroshare-qml-app/src/icons/invite.svg | 74 - retroshare-qml-app/src/icons/keyring.svg | 7 - retroshare-qml-app/src/icons/leave.svg | 59 - retroshare-qml-app/src/icons/microphone.svg | 148 - .../src/icons/microphone_mute.svg | 164 -- retroshare-qml-app/src/icons/netgraph.svg | 54 - .../src/icons/network-connect.svg | 13 - .../src/icons/network-disconnect.svg | 21 - retroshare-qml-app/src/icons/network.svg | 68 - retroshare-qml-app/src/icons/options.svg | 62 - retroshare-qml-app/src/icons/paste.svg | 90 - .../src/icons/rating-unrated.svg | 13 - retroshare-qml-app/src/icons/rating.svg | 17 - retroshare-qml-app/src/icons/retroshare.png | 1 - retroshare-qml-app/src/icons/search.svg | 78 - retroshare-qml-app/src/icons/send-message.svg | 67 - retroshare-qml-app/src/icons/share.svg | 81 - retroshare-qml-app/src/icons/smiley.svg | 102 - .../src/icons/state-offline.svg | 27 - retroshare-qml-app/src/icons/state-ok.svg | 24 - retroshare-qml-app/src/jsonpath.js | 88 - .../src/libresapilocalclient.cpp | 176 -- retroshare-qml-app/src/libresapilocalclient.h | 95 - retroshare-qml-app/src/main-app.cpp | 153 - retroshare-qml-app/src/main-app.qml | 688 ----- retroshare-qml-app/src/platforminteracions.h | 32 - retroshare-qml-app/src/qml.qrc | 750 ----- retroshare-qml-app/src/qmldir | 7 - retroshare-qml-app/src/retroshare-qml-app.pro | 49 - retroshare-qml-app/src/rsqmlappengine.cpp | 40 - retroshare-qml-app/src/rsqmlappengine.h | 67 - retroshare-qml-app/src/styles/ChatStyle.qml | 74 - .../src/styles/SideBarStyle.qml | 34 - retroshare.pri | 39 +- supportlibs/rapidjson | 1 + 963 files changed, 73 insertions(+), 48608 deletions(-) create mode 100644 README.asciidoc delete mode 100644 README.md delete mode 100644 TODO.circles.txt delete mode 100644 TODO.txt delete mode 100755 android-prepare-toolchain.sh rename README-Android.asciidoc => build_scripts/Android/README.asciidoc (100%) rename MacOS_X_InstallGuide.md => build_scripts/OSX/MacOS_X_InstallGuide.md (100%) rename travis_makeOSXPackage.sh => build_scripts/OSX/travis_makeOSXPackage.sh (100%) rename WindowsMSys2_InstallGuide.md => build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md (100%) delete mode 100644 libresapi/src/.gitignore delete mode 100644 libresapi/src/README.md delete mode 100644 libresapi/src/api/ApiPluginHandler.cpp delete mode 100644 libresapi/src/api/ApiPluginHandler.h delete mode 100644 libresapi/src/api/ApiServer.cpp delete mode 100644 libresapi/src/api/ApiServer.h delete mode 100644 libresapi/src/api/ApiServerLocal.cpp delete mode 100644 libresapi/src/api/ApiServerLocal.h delete mode 100644 libresapi/src/api/ApiServerMHD.cpp delete mode 100644 libresapi/src/api/ApiServerMHD.h delete mode 100644 libresapi/src/api/ApiTypes.h delete mode 100644 libresapi/src/api/ChannelsHandler.cpp delete mode 100644 libresapi/src/api/ChannelsHandler.h delete mode 100644 libresapi/src/api/ChatHandler.cpp delete mode 100644 libresapi/src/api/ChatHandler.h delete mode 100644 libresapi/src/api/FileSearchHandler.cpp delete mode 100644 libresapi/src/api/FileSearchHandler.h delete mode 100644 libresapi/src/api/FileSharingHandler.cpp delete mode 100644 libresapi/src/api/FileSharingHandler.h delete mode 100644 libresapi/src/api/ForumHandler.cpp delete mode 100644 libresapi/src/api/ForumHandler.h delete mode 100644 libresapi/src/api/GetPluginInterfaces.cpp delete mode 100644 libresapi/src/api/GetPluginInterfaces.h delete mode 100644 libresapi/src/api/GxsMetaOperators.h delete mode 100644 libresapi/src/api/GxsResponseTask.cpp delete mode 100644 libresapi/src/api/GxsResponseTask.h delete mode 100644 libresapi/src/api/IdentityHandler.cpp delete mode 100644 libresapi/src/api/IdentityHandler.h delete mode 100644 libresapi/src/api/JsonStream.cpp delete mode 100644 libresapi/src/api/JsonStream.h delete mode 100644 libresapi/src/api/LivereloadHandler.cpp delete mode 100644 libresapi/src/api/LivereloadHandler.h delete mode 100644 libresapi/src/api/Operators.cpp delete mode 100644 libresapi/src/api/Operators.h delete mode 100644 libresapi/src/api/Pagination.h delete mode 100644 libresapi/src/api/PeersHandler.cpp delete mode 100644 libresapi/src/api/PeersHandler.h delete mode 100644 libresapi/src/api/README.md delete mode 100644 libresapi/src/api/ResourceRouter.cpp delete mode 100644 libresapi/src/api/ResourceRouter.h delete mode 100644 libresapi/src/api/RsControlModule.cpp delete mode 100644 libresapi/src/api/RsControlModule.h delete mode 100644 libresapi/src/api/ServiceControlHandler.cpp delete mode 100644 libresapi/src/api/ServiceControlHandler.h delete mode 100644 libresapi/src/api/SettingsHandler.cpp delete mode 100644 libresapi/src/api/SettingsHandler.h delete mode 100644 libresapi/src/api/StateTokenServer.cpp delete mode 100644 libresapi/src/api/StateTokenServer.h delete mode 100644 libresapi/src/api/StatsHandler.cpp delete mode 100644 libresapi/src/api/StatsHandler.h delete mode 100644 libresapi/src/api/TmpBlobStore.cpp delete mode 100644 libresapi/src/api/TmpBlobStore.h delete mode 100644 libresapi/src/api/TransfersHandler.cpp delete mode 100644 libresapi/src/api/TransfersHandler.h delete mode 100644 libresapi/src/api/json.cpp delete mode 100644 libresapi/src/api/json.h delete mode 100644 libresapi/src/libresapi.pro delete mode 100644 libresapi/src/use_libresapi.pri delete mode 100644 libresapi/src/util/ContentTypes.cpp delete mode 100644 libresapi/src/util/ContentTypes.h delete mode 100644 libresapi/src/webui-src/.gitignore delete mode 100644 libresapi/src/webui-src/README.md delete mode 100644 libresapi/src/webui-src/app/_chat.sass delete mode 100644 libresapi/src/webui-src/app/_reset.scss delete mode 100644 libresapi/src/webui-src/app/accountselect.js delete mode 100644 libresapi/src/webui-src/app/adddownloads.js delete mode 100644 libresapi/src/webui-src/app/addidentity.js delete mode 100644 libresapi/src/webui-src/app/addpeer.js delete mode 100644 libresapi/src/webui-src/app/assets/index.html delete mode 100644 libresapi/src/webui-src/app/chat.js delete mode 100644 libresapi/src/webui-src/app/createlogin.js delete mode 100644 libresapi/src/webui-src/app/downloads.js delete mode 100644 libresapi/src/webui-src/app/forums.js delete mode 100644 libresapi/src/webui-src/app/green-black.scss delete mode 100644 libresapi/src/webui-src/app/home.js delete mode 100644 libresapi/src/webui-src/app/identities.js delete mode 100644 libresapi/src/webui-src/app/main.js delete mode 100644 libresapi/src/webui-src/app/main.sass delete mode 100644 libresapi/src/webui-src/app/menu.js delete mode 100644 libresapi/src/webui-src/app/menudef.js delete mode 100644 libresapi/src/webui-src/app/mithril.js delete mode 100644 libresapi/src/webui-src/app/mithril.min.js delete mode 100644 libresapi/src/webui-src/app/mithril.min.js.map delete mode 100644 libresapi/src/webui-src/app/orange.scss delete mode 100644 libresapi/src/webui-src/app/peers.js delete mode 100644 libresapi/src/webui-src/app/retroshare.js delete mode 100644 libresapi/src/webui-src/app/search.js delete mode 100644 libresapi/src/webui-src/app/searchresult.js delete mode 100644 libresapi/src/webui-src/app/servicecontrol.js delete mode 100644 libresapi/src/webui-src/app/settings.js delete mode 100644 libresapi/src/webui-src/app/waiting.js delete mode 100644 libresapi/src/webui-src/brunch-config.js delete mode 100644 libresapi/src/webui-src/make-src/build.bat delete mode 100755 libresapi/src/webui-src/make-src/build.sh delete mode 100644 libresapi/src/webui-src/make-src/chat.css delete mode 100644 libresapi/src/webui-src/make-src/init.bat delete mode 100755 libresapi/src/webui-src/make-src/init.sh delete mode 100644 libresapi/src/webui-src/make-src/main.css delete mode 100644 libresapi/src/webui-src/make-src/readme.md delete mode 100644 libresapi/src/webui-src/make-src/template.js delete mode 100644 libresapi/src/webui-src/package.json delete mode 100644 rapidjson-1.1.0/license.txt delete mode 100644 rapidjson-1.1.0/rapid_json/allocators.h delete mode 100644 rapidjson-1.1.0/rapid_json/document.h delete mode 100644 rapidjson-1.1.0/rapid_json/encodedstream.h delete mode 100644 rapidjson-1.1.0/rapid_json/encodings.h delete mode 100644 rapidjson-1.1.0/rapid_json/error/en.h delete mode 100644 rapidjson-1.1.0/rapid_json/error/error.h delete mode 100644 rapidjson-1.1.0/rapid_json/filereadstream.h delete mode 100644 rapidjson-1.1.0/rapid_json/filewritestream.h delete mode 100644 rapidjson-1.1.0/rapid_json/fwd.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/biginteger.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/diyfp.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/dtoa.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/ieee754.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/itoa.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/meta.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/pow10.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/regex.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/stack.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/strfunc.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/strtod.h delete mode 100644 rapidjson-1.1.0/rapid_json/internal/swap.h delete mode 100644 rapidjson-1.1.0/rapid_json/istreamwrapper.h delete mode 100644 rapidjson-1.1.0/rapid_json/memorybuffer.h delete mode 100644 rapidjson-1.1.0/rapid_json/memorystream.h delete mode 100644 rapidjson-1.1.0/rapid_json/ostreamwrapper.h delete mode 100644 rapidjson-1.1.0/rapid_json/pointer.h delete mode 100644 rapidjson-1.1.0/rapid_json/prettywriter.h delete mode 100644 rapidjson-1.1.0/rapid_json/rapidjson.h delete mode 100644 rapidjson-1.1.0/rapid_json/reader.h delete mode 100644 rapidjson-1.1.0/rapid_json/schema.h delete mode 100644 rapidjson-1.1.0/rapid_json/stream.h delete mode 100644 rapidjson-1.1.0/rapid_json/stringbuffer.h delete mode 100644 rapidjson-1.1.0/rapid_json/writer.h delete mode 100644 retroshare-android-notify-service/src/AutologinManager.qml delete mode 120000 retroshare-android-notify-service/src/TokensManager.qml delete mode 120000 retroshare-android-notify-service/src/libresapilocalclient.cpp delete mode 120000 retroshare-android-notify-service/src/libresapilocalclient.h delete mode 100644 retroshare-android-notify-service/src/main.cpp delete mode 100644 retroshare-android-notify-service/src/main.qml delete mode 100644 retroshare-android-notify-service/src/notificationsbridge.h delete mode 100644 retroshare-android-notify-service/src/qml.qrc delete mode 100644 retroshare-android-notify-service/src/qmldir delete mode 100644 retroshare-android-notify-service/src/retroshare-android-notify-service.pro delete mode 100644 retroshare-android-service/src/retroshare-android-service.pro delete mode 100644 retroshare-android-service/src/service.cpp delete mode 100644 retroshare-nogui/src/TerminalApiClient.cpp delete mode 100644 retroshare-nogui/src/TerminalApiClient.h delete mode 100644 retroshare-nogui/src/introserver.cc delete mode 100644 retroshare-nogui/src/introserver.h delete mode 100644 retroshare-nogui/src/notifytxt.cc delete mode 100644 retroshare-nogui/src/notifytxt.h delete mode 100644 retroshare-nogui/src/protobuf.pri delete mode 100644 retroshare-nogui/src/resources/retroshare_win.rc delete mode 100644 retroshare-nogui/src/resources/retroshare_win.rc.h delete mode 100644 retroshare-nogui/src/resources/rs.ico delete mode 100644 retroshare-nogui/src/retroshare-nogui.pro delete mode 100644 retroshare-nogui/src/retroshare.cc delete mode 100644 retroshare-qml-app/src/AddTrustedNode.qml delete mode 100644 retroshare-qml-app/src/ApiImageExample.qml delete mode 100644 retroshare-qml-app/src/AppSettings.qml delete mode 100644 retroshare-qml-app/src/BusyOverlay.qml delete mode 100644 retroshare-qml-app/src/ChatBubbleDelegate.qml delete mode 100644 retroshare-qml-app/src/ChatCache.qml delete mode 100644 retroshare-qml-app/src/ChatView.qml delete mode 100644 retroshare-qml-app/src/ClipboardWrapper.qml delete mode 100644 retroshare-qml-app/src/ContactDetails.qml delete mode 100644 retroshare-qml-app/src/ContactSort.js delete mode 100644 retroshare-qml-app/src/Contacts.qml delete mode 100644 retroshare-qml-app/src/GxsIdentityDelegate.qml delete mode 100644 retroshare-qml-app/src/JSONListModel.qml delete mode 100644 retroshare-qml-app/src/Locations.qml delete mode 120000 retroshare-qml-app/src/NativeCalls.cpp delete mode 120000 retroshare-qml-app/src/NativeCalls.h delete mode 100644 retroshare-qml-app/src/Options.qml delete mode 100644 retroshare-qml-app/src/RsLoginPassView.qml delete mode 100644 retroshare-qml-app/src/TimedPopup.qml delete mode 100644 retroshare-qml-app/src/TokensManager.qml delete mode 100644 retroshare-qml-app/src/TrustedNodeDetails.qml delete mode 100644 retroshare-qml-app/src/TrustedNodesView.qml delete mode 100644 retroshare-qml-app/src/URI.js delete mode 100644 retroshare-qml-app/src/android/.gitignore delete mode 100644 retroshare-qml-app/src/android/AndroidManifest.xml delete mode 100644 retroshare-qml-app/src/android/android.iml delete mode 100644 retroshare-qml-app/src/android/build.gradle delete mode 100644 retroshare-qml-app/src/android/captures/org.retroshare.android.qml_app_2016.08.22_16.56.txt delete mode 100644 retroshare-qml-app/src/android/gradle.properties delete mode 100644 retroshare-qml-app/src/android/gradle/wrapper/gradle-wrapper.jar delete mode 100644 retroshare-qml-app/src/android/gradle/wrapper/gradle-wrapper.properties delete mode 100755 retroshare-qml-app/src/android/gradlew delete mode 100644 retroshare-qml-app/src/android/gradlew.bat delete mode 120000 retroshare-qml-app/src/android/res/drawable/retroshare_128x128.png delete mode 120000 retroshare-qml-app/src/android/res/drawable/retroshare_48x48.png delete mode 100644 retroshare-qml-app/src/android/res/values/libs.xml delete mode 100644 retroshare-qml-app/src/android/src/NativeCalls.cpp delete mode 100644 retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/AppUpdatedReceiver.java delete mode 100644 retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/BootCompletedReceiver.java delete mode 100644 retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/RetroShareAndroidNotifyService.java delete mode 100644 retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/RetroShareAndroidService.java delete mode 100644 retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/RetroShareQmlActivity.java delete mode 100644 retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/UsedByNativeCode.java delete mode 100644 retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/jni/NativeCalls.java delete mode 100644 retroshare-qml-app/src/android/src/org_retroshare_android_qml_app_jni_NativeCalls.h delete mode 100644 retroshare-qml-app/src/androidimagepicker.h delete mode 100644 retroshare-qml-app/src/androidplatforminteracions.cpp delete mode 100644 retroshare-qml-app/src/androidplatforminteracions.h delete mode 100644 retroshare-qml-app/src/components/AvatarOrColorHash.qml delete mode 100644 retroshare-qml-app/src/components/ButtonIcon.qml delete mode 100644 retroshare-qml-app/src/components/ButtonText.qml delete mode 100644 retroshare-qml-app/src/components/ColorHash.qml delete mode 100644 retroshare-qml-app/src/components/CustomFileChooser.qml delete mode 100644 retroshare-qml-app/src/components/Faces.qml delete mode 100644 retroshare-qml-app/src/components/SideBar.qml delete mode 100644 retroshare-qml-app/src/components/TextAndIcon.qml delete mode 100644 retroshare-qml-app/src/components/emoji/EmojiButton.qml delete mode 100644 retroshare-qml-app/src/components/emoji/EmojiCategoryButton.qml delete mode 100644 retroshare-qml-app/src/components/emoji/EmojiPicker.qml delete mode 100644 retroshare-qml-app/src/components/emoji/emoji.js delete mode 100644 retroshare-qml-app/src/defaultplatforminteracions.cpp delete mode 100644 retroshare-qml-app/src/defaultplatforminteracions.h delete mode 100644 retroshare-qml-app/src/deployment.pri delete mode 100644 retroshare-qml-app/src/fonts/OpenSansEmoji.ttf delete mode 100644 retroshare-qml-app/src/icons/add.svg delete mode 100644 retroshare-qml-app/src/icons/application-menu.svg delete mode 100644 retroshare-qml-app/src/icons/attach-image.svg delete mode 100644 retroshare-qml-app/src/icons/attach.svg delete mode 100644 retroshare-qml-app/src/icons/back.png delete mode 100644 retroshare-qml-app/src/icons/chat-bubble.svg delete mode 100644 retroshare-qml-app/src/icons/edit-image-face-detect.svg delete mode 100644 retroshare-qml-app/src/icons/emblem-locked.svg delete mode 100644 retroshare-qml-app/src/icons/exit.svg delete mode 100644 retroshare-qml-app/src/icons/faces/female32/background1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/background2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/background3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/background4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/background5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes18.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes19.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes20.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes21.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes22.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes23.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes24.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes25.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes26.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes27.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes28.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes29.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes30.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes31.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes32.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes33.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes34.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes35.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes36.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes37.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes38.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes39.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes40.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes41.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes42.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes43.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes44.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes45.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes46.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes47.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes48.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes49.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes50.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes51.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes52.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes53.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes54.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes55.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes56.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes57.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes58.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes59.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/clothes9.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye18.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye19.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye20.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye21.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye22.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye23.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye24.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye25.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye26.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye27.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye28.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye29.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye30.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye31.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye32.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye33.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye34.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye35.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye36.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye37.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye38.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye39.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye40.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye41.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye42.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye43.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye44.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye45.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye46.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye47.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye48.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye49.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye50.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye51.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye52.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye53.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/eye9.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/face1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/face2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/face3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/face4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head18.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head19.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head20.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head21.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head22.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head23.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head24.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head25.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head26.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head27.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head28.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head29.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head30.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head31.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head32.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head33.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/head9.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female32/mouth9.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/background1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/background2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/background3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/background4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/background5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes18.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes19.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes20.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes21.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes22.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes23.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes24.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes25.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes26.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes27.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes28.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes29.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes30.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes31.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes32.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes33.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes34.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes35.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes36.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes37.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes38.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes39.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes40.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes41.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes42.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes43.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes44.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes45.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes46.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes47.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes48.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes49.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes50.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes51.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes52.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes53.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes54.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes55.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes56.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes57.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes58.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes59.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/clothes9.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye18.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye19.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye20.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye21.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye22.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye23.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye24.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye25.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye26.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye27.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye28.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye29.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye30.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye31.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye32.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye33.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye34.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye35.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye36.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye37.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye38.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye39.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye40.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye41.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye42.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye43.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye44.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye45.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye46.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye47.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye48.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye49.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye50.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye51.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye52.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye53.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/eye9.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/face1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/face2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/face3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/face4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head18.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head19.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head20.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head21.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head22.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head23.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head24.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head25.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head26.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head27.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head28.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head29.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head30.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head31.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head32.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head33.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/head9.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth1.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth10.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth11.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth12.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth13.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth14.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth15.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth16.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth17.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth2.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth3.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth4.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth5.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth6.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth7.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth8.png delete mode 100644 retroshare-qml-app/src/icons/faces/female64/mouth9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/background1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/background2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/background3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/background4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/background5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes27.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes28.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes29.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes30.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes31.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes32.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes33.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes34.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes35.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes36.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes37.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes38.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes39.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes40.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes41.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes42.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes43.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes44.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes45.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes46.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes47.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes48.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes49.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes50.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes51.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes52.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes53.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes54.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes55.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes56.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes57.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes58.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes59.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes60.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes61.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes62.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes63.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes64.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes65.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/clothes9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye27.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye28.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye29.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye30.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye31.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye32.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/eye9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/face1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/face2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/face3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/face4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair27.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair28.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair29.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair30.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair31.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair32.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair33.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair34.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair35.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair36.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/hair9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male32/mouth9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/background1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/background2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/background3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/background4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/background5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes27.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes28.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes29.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes30.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes31.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes32.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes33.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes34.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes35.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes36.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes37.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes38.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes39.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes40.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes41.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes42.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes43.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes44.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes45.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes46.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes47.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes48.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes49.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes50.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes51.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes52.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes53.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes54.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes55.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes56.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes57.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes58.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes59.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes60.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes61.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes62.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes63.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes64.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes65.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/clothes9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye27.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye28.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye29.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye30.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye31.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye32.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/eye9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/face1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/face2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/face3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/face4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair27.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair28.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair29.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair30.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair31.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair32.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair33.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair34.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair35.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair36.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/hair9.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth1.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth10.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth11.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth12.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth13.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth14.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth15.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth16.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth17.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth18.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth19.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth2.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth20.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth21.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth22.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth23.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth24.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth25.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth26.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth3.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth4.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth5.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth6.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth7.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth8.png delete mode 100644 retroshare-qml-app/src/icons/faces/male64/mouth9.png delete mode 100644 retroshare-qml-app/src/icons/info.svg delete mode 100644 retroshare-qml-app/src/icons/invite.svg delete mode 100644 retroshare-qml-app/src/icons/keyring.svg delete mode 100644 retroshare-qml-app/src/icons/leave.svg delete mode 100644 retroshare-qml-app/src/icons/microphone.svg delete mode 100644 retroshare-qml-app/src/icons/microphone_mute.svg delete mode 100644 retroshare-qml-app/src/icons/netgraph.svg delete mode 100644 retroshare-qml-app/src/icons/network-connect.svg delete mode 100644 retroshare-qml-app/src/icons/network-disconnect.svg delete mode 100644 retroshare-qml-app/src/icons/network.svg delete mode 100644 retroshare-qml-app/src/icons/options.svg delete mode 100644 retroshare-qml-app/src/icons/paste.svg delete mode 100644 retroshare-qml-app/src/icons/rating-unrated.svg delete mode 100644 retroshare-qml-app/src/icons/rating.svg delete mode 120000 retroshare-qml-app/src/icons/retroshare.png delete mode 100644 retroshare-qml-app/src/icons/search.svg delete mode 100644 retroshare-qml-app/src/icons/send-message.svg delete mode 100644 retroshare-qml-app/src/icons/share.svg delete mode 100644 retroshare-qml-app/src/icons/smiley.svg delete mode 100644 retroshare-qml-app/src/icons/state-offline.svg delete mode 100644 retroshare-qml-app/src/icons/state-ok.svg delete mode 100644 retroshare-qml-app/src/jsonpath.js delete mode 100644 retroshare-qml-app/src/libresapilocalclient.cpp delete mode 100644 retroshare-qml-app/src/libresapilocalclient.h delete mode 100644 retroshare-qml-app/src/main-app.cpp delete mode 100644 retroshare-qml-app/src/main-app.qml delete mode 100644 retroshare-qml-app/src/platforminteracions.h delete mode 100644 retroshare-qml-app/src/qml.qrc delete mode 100644 retroshare-qml-app/src/qmldir delete mode 100644 retroshare-qml-app/src/retroshare-qml-app.pro delete mode 100644 retroshare-qml-app/src/rsqmlappengine.cpp delete mode 100644 retroshare-qml-app/src/rsqmlappengine.h delete mode 100644 retroshare-qml-app/src/styles/ChatStyle.qml delete mode 100644 retroshare-qml-app/src/styles/SideBarStyle.qml create mode 160000 supportlibs/rapidjson diff --git a/.gitmodules b/.gitmodules index ca1dc1b81..c35876fc6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,3 +11,6 @@ path = supportlibs/udp-discovery-cpp url = https://github.com/truvorskameikin/udp-discovery-cpp.git branch = develop +[submodule "supportlibs/rapidjson"] + path = supportlibs/rapidjson + url = https://github.com/Tencent/rapidjson.git diff --git a/README.asciidoc b/README.asciidoc new file mode 100644 index 000000000..2086c1bd5 --- /dev/null +++ b/README.asciidoc @@ -0,0 +1,49 @@ += RetroShare + +RetroShare is a decentralized, private, secure, cross-platform, communication +toolkit. +RetroShare provides filesharing, chat, messages, forums, channels and +more. + +.Build Status +|=============================================================================== +|GNU/Linux, MacOS, (via travis-ci) | image:https://travis-ci.org/RetroShare/RetroShare.svg?branch=master[link="https://travis-ci.org/RetroShare/RetroShare"] +|Windows (via appveyor) | image:https://ci.appveyor.com/api/projects/status/github/RetroShare/RetroShare?svg=true[link="https://ci.appveyor.com/project/RetroShare58622/retroshare"] +|=============================================================================== + + +== Compilation + +It is very difficult to keep a comprehensive (we support many platforms) and +updated documentation on how to build retroshare, instead we provide scripts and +receipts that are used to create the packages for the supported platforms and +more in the `build_scripts` directory of this repository. + + +== Using RetroShare on a headless computer with WebUI + +WARNING: This section is outdated need to be adapted to new WebUI + +The webUI needs to be enabled as a parameter option in retroshare-service: + +[source,bash] +-------- +./retroshare-nogui --webinterface 9090 --docroot /usr/share/retroshare/webui/ +-------- + +The webUI is only accessible on localhost:9090. It is advised to keep it that way so that your RS +cannot be controlled using an untrusted connection. + +To access your web UI from a distance, just open a SSH tunnel on it: + +[source,bash] +-------- +distant_machine:~/ > ssh rs_host -L 9090:localhost:9090 -N +-------- + +"rs_host" is the machine running retroshare-nogui. Then on the distant machine, access your webUI on + + + http://localhost:9090 + +That also works with a retroshare GUI of course. diff --git a/README.md b/README.md deleted file mode 100644 index 2619312a8..000000000 --- a/README.md +++ /dev/null @@ -1,151 +0,0 @@ -RetroShare -============================== -RetroShare is a decentralized, private and secure commmunication and sharing platform. RetroShare provides filesharing, chat, messages, forums and channels. - -Build Status ------------- - -| Platform | Build Status | -| :------------- | :------------- | -| GNU/Linux, MacOS, (via travis-ci) | [![Build Status](https://travis-ci.org/RetroShare/RetroShare.svg?branch=master)](https://travis-ci.org/RetroShare/RetroShare) | -| Windows, `MSys2` (via appveyor) | [![Build status](https://ci.appveyor.com/api/projects/status/github/RetroShare/RetroShare?svg=true)](https://ci.appveyor.com/project/RetroShare58622/retroshare) | - -Compilation on Windows ----------------------------- -Follow this file : [WindowsMSys2_InstallGuide.md](https://github.com/RetroShare/RetroShare/blob/master/WindowsMSys2_InstallGuide.md) - -Compilation on MacOSX ----------------------------- -Follow this file : [MacOS_X_InstallGuide](https://github.com/RetroShare/RetroShare/blob/master/MacOS_X_InstallGuide.md) - -Compilation for Android ---------------------------- -Follow this file : [README-Android](https://github.com/RetroShare/RetroShare/blob/master/README-Android.asciidoc) - -Compilation on Linux ----------------------------- - -1. Install package dependencies: - * Debian/Ubuntu - ```bash - sudo apt-get install libglib2.0-dev libupnp-dev qt4-dev-tools \ - libqt4-dev libssl-dev libxss-dev libgnome-keyring-dev libbz2-dev \ - libqt4-opengl-dev libqtmultimediakit1 qtmobility-dev libsqlcipher-dev \ - libspeex-dev libspeexdsp-dev libxslt1-dev libcurl4-openssl-dev \ - libopencv-dev tcl8.5 libmicrohttpd-dev rapidjson-dev - ``` - * openSUSE - ```bash - sudo zypper install gcc-c++ libqt4-devel libgnome-keyring-devel \ - glib2-devel speex-devel libssh-devel protobuf-devel libcurl-devel \ - libxml2-devel libxslt-devel sqlcipher-devel libmicrohttpd-devel \ - opencv-devel speexdsp-devel libupnp-devel libavcodec-devel rapidjson - ``` - * Arch Linux - ```bash - pacman -S base-devel libgnome-keyring libmicrohttpd libupnp libxslt \ - libxss opencv qt4 speex speexdsp sqlcipher rapidjson - ``` - -2. Checkout the source code - ```bash - mkdir ~/retroshare - cd ~/retroshare - git clone https://github.com/RetroShare/RetroShare.git trunk - ``` - -3. Compile - ```bash - cd trunk - qmake CONFIG+=debug - make - ``` - -4. Install - ```bash - sudo make install - ``` - - The executables produced will be: - - /usr/bin/retroshare - /usr/bin/retroshare-nogui - -5. Uninstall: - ```bash - sudo make uninstall - ``` - -Compile only retroshare-nogui ------------------------------ -If you want to run RetroShare on a server and don’t need the gui and plugins, -you can run the following commands to only compile/install the nogui version: - -```bash -qmake -make retroshare-nogui -sudo make retroshare-nogui-install_subtargets -``` - -For packagers -------------- -Packagers can use PREFIX and LIB\_DIR to customize the installation paths: -```bash -qmake PREFIX=/usr LIB_DIR=/usr/lib64 "CONFIG-=debug" "CONFIG+=release" -make -make INSTALL_ROOT=${PKGDIR} install -``` - -If libsqlcipher is not available as a package ---------------------------------------------- - -You need to place sqlcipher so that the hierarchy is: - - retroshare - | - +--- trunk - | - +--- lib - | - +---- sqlcipher -```bash -mkdir lib -cd lib -git clone git://github.com/sqlcipher/sqlcipher.git -cd sqlcipher -./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto" -make -cd .. -``` - -Using retroshare-nogui & webUI ------------------------------- - -The webUI needs to be enabled as a parameter option in retroshare-nogui: - -```bash -./retroshare-nogui --webinterface 9090 --docroot /usr/share/retroshare/webui/ -``` - -The webUI is only accessible on localhost:9090. It is advised to keep it that way so that your RS -cannot be controlled using an untrusted connection. - -To access your web UI from a distance, just open a SSH tunnel on it: - -```bash -distant_machine:~/ > ssh rs_host -L 9090:localhost:9090 -N -``` - -"rs_host" is the machine running retroshare-nogui. Then on the distant machine, access your webUI on - - - http://localhost:9090 - -That also works with a retroshare GUI of course. - -Compile and run tests ---------------------- - - qmake CONFIG+=tests - make - tests/unittests/unittests diff --git a/TODO.circles.txt b/TODO.circles.txt deleted file mode 100644 index 4e70dccc9..000000000 --- a/TODO.circles.txt +++ /dev/null @@ -1,47 +0,0 @@ -Legend: - [X]: done, [ ]: pending, [-]: Cancelled, [/]: ongoing - -GUI - [X] disable edit circles or make it work - [X] make GUI update when creating a circle - [ ] handle the display of encrypted forums/channels/etc when we do not have the keys - [ ] disable posting to circles for which we do not have the rights - [ ] warn about creating a circle without one of your ids in it - [X] group "show details" should be made up to date for restrinction options - [ ] allow to share circles publish rights - [X] allow non admin to see circles details but not edit - - [ ] update TS of groups linked to a modified circle, so as to cause updates when a new member is addded to the group - [X] forums GUI should show correct restriction options for restricted forums - [X] changing a circle's name should update the GUI - [ ] make sure we cannot post in forums using IDs that are not in the circle - [ ] make sure unauthorised ids are rejected when validating posts from a circle restricted group - [ ] add GUI for local circles in circle GUI - [ ] share publish rights between circles - [ ] clean GUI (hide IDs) - - -Tests - [X] create a safe testing environment: 2 peers with no other contacts, 2 IDs each, and some forums - [X] test #001: transactions should encrypt and decrypt ok on both sides - [X] test #002: peers inside a circles should see the data - [X] test #003: peers outside of a circles shouldn't see the data - [-] test #004: peers subscribed to encrypted circles shouldn't keep asking for the data if they cannot decrypt - [X] test #005: peers can be added/removed from circles, and the circles update between friends - [ ] test #006: peers subscribed to encrypted circles who recently got added to the circle should get the data - [ ] test #007: peers outside a circle shouldn't be able to post (or posts shouldn't propagate) - -Backend - [X] add debug output later RS_NXS_DEBUG_7 in rsgxsnetservice.cc for the crypto layer - -Bugs - [X] Peers cannot be removed from a circle - [X] Context menu should not allow to edit non admin circles - [X] Editing circles make them subscribed, even non admin ones. - [X] Disable autosync for circles (in rsinit.cc) - [-] Add explicit circle sync request for all grps restricted to a circle (same as IDs) - [X] when a peer receives a circle, there is no way to view its details, only the id is available - [X] if a peer has circles available in "Circles (others)"... if you click on - "Create Circle" on the gui, then all circles are automatically subscribed - - diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index b130f80d8..000000000 --- a/TODO.txt +++ /dev/null @@ -1,135 +0,0 @@ -Legend: - E: easy. Just GUI stuff, no algorithmics involved. That does not mean it's easy to come up with. - M: medium, either because it's a big task, or because it needs to understand a lot of code. - H: hard. Needs digging deep into libretroshare, possibly involving some crypto. - - [ ] pending - [/] half-done, someone's on it - [-] cancelled - [?] needs discussion. Not sure we need this. - [X] done - -PS: no tabs in this file,thx ;-) - ----------------------------------------- TODO for RC --------------------------------------------- - - E [ ] Implement creation of a default (signed) gxs id in startup wizard. Needs to show to the user a proper separation between nodes (network layer) and GXS ids (service layer). - E [ ] add tooltips in in permission matrix when hovering over the top most button/service name explain what the service does and the dependencies - E [ ] finish pass of GXS network service - ------------------------------------------ TODO list ---------------------------------------------- - -GUI - E [X] add a "Contact" list to help selecting peers in People/FriendChooser/messages/etc. - E [ ] fix posted GUI. Needs to be more handy and more appealing. - E [ ] add RS links for GXS identities, so that they can be transferred easily between nodes in forums, etc - E [ ] enable people dialog - M [ ] Personal Page (Profile Page for GXS ID Users,view latest Posts, public forum/channels,posted posts, comments in all areas, Reputation Infos, Popularity and more) - E [ ] fix RSButtonOnText::eventFilter, and fix all places where RSButtonOnText gets deleted - E [ ] find all places where the deprecated(in Qt5) Q_WS_WIN and other Q_WS* macros are used, and replace with something else - E [ ] Make RS fully compatible with High DPI screens. - M [ ] improve comments in channels. Comments should be more available, more visible, and easier to handle. - E [ ] make GRouter statistics less CPU greedy - M [ ] Merge the various help systems. there's 3 of them now. Lots of duplicate code, etc. - M [ ] New and consistent icon set (Purplehaze420 said he would provide a consistent set of icons. Is that still alive?) - M [ ] add in options->Network a way to select which network interface is used to talk (choice between "auto" or selected from a list) - M [?] add a RS link for encrypted messages (encrypt for multiple GXS ids at once). Messages will appear as a link when encrypted and - be automatically decrypted when a suitable GXS id is available for it. Could be a way to securely post something in a public place. - -File transfer (all 3 tasks are related) - E [ ] Add a limit of the total number of files simultaneously asked to the same peer using direct transfer. - H [ ] implement a new file list management, with new info such as access time,total upload, popularity, etc - H [ ] implement a new file list sharing service based on auto-sync system - M [ ] get rid of the old cache system (remove CacheStrapper, CacheSource,etc) - M [ ] implement end-to-end encryption using chacha20 and H(F), requesting file on H(H(F)). Make this optional and backward compatible. - -DHT - H [-] improve DHT lookups to find masquerading peers using fake peers. First experiments (by cyril) do not prove very efficient. - -GXS - M [X] create a tunnel service from distant chat code to make it (1) more generic (2) resistant to packet loss. - M [X] optimise GXS sync BW. For the moment too much is sent between nodes. - H [/] add the ability to use anonymous identities into circles. Needs new distribution model using items encrypted for multiple GXS keys. - H [ ] use different and incompatible classes for public and private keys in GxsSecurity - -VOIP - H [ ] use proper video encoding. What we have now is decent for video, but sound should be prioritized. Experiments - with QtAV seem to work nicely. Finish and integrate! - M [ ] Deactivate Voip Buttons, when Friend has no Voip plugin enabled. - M [ ] Implement Voice for Video Chat - M [ ] Improve Voice and Video Quality - M [ ] Video Quality/Resolution Settings (High, Medium, Low) HD, HQ, SD ) - M [ ] Video Device: WebCam(s) or Desktop Selection - M [ ] Audio Input Device Selection (Microphone) - M [ ] Audio Output Device Selection (Speaker) - M [ ] Video Snapshots https://support.skype.com/en/faq/FA1222/what-is-video-snapshot - M [ ] Voice Messaging (record and send a voice message) - M [ ] Video Messages (send a video greeting to multiple friends/coworkers/developers at once.) - M [ ] Add Call status (when im on the phone changes my status with phone icon) - H [ ] Audio Conference - H [ ] Video Conference - -Messages - H [X] make the mail system re-send failed emails notified by the global router. This is hard because it needs a proper management of duplicate messages - E [X] add flags to allow distant messaging from contact list only / everyone / noone / only signed ids. - M [ ] add Signature feature to messages - M [ ] add vacation responser for messages (automatic replies) - -Chat - E [X] add flags to allow distant chat from contact list only / everyone / noone / only signed ids. - -Libretroshare - E [X] groups small packets in pqistreamer::handleoutgoing_locked(), and see if that removes some padding overhead - E [ ] make sure at least one location is kept when removing old locations as it avoids lots of connection problems. - M [ ] improve serialisation system. Lots of serialisation tasks (header, verifications, serialiser=>template, can be factored) - M [ ] separate chat stuff from rsmsgs.h into rschat.h - M [ ] crash at shutdown due to memory management already cleared while new objects keep being requested. - - #0 0x0000000000da52eb in RsMemoryManagement:¿mallObject:¿mallObject() () - #1 0x0000000000da3694 in RsItem::RsItem(unsigned int) () - #2 0x0000000000dcb365 in RsRawItem::RsRawItem (this=0x0, t=33559555, size=38) at ./serialiser/rsserial.h - #3 0x0000000000fc1643 in RsServiceSerialiser::deserialise(void*, unsigned int*) () - #4 0x0000000000da4451 in RsSerialiser::deserialise(void*, unsigned int*) () - #5 0x0000000000fb5b4b in pqistreamer::handleincoming_locked() () - #6 0x0000000000fb4b3e in pqistreamer::tick_recv(unsigned int) () - #7 0x0000000000fb744a in pqithreadstreamer::data_tick() () - #8 0x0000000000e19b27 in RsTickingThread::runloop (this=0x7fffb004e7e8) at util/rsthreads.cc:196 - #9 0x0000000000e19748 in RsThread::rsthread_init (p=0x7fffb004e7e8) at util/rsthreads.cc:63 - #10 0x00007ffff4006f6b in start_thread () from /lib64/libpthread.so.0 - #11 0x00007ffff351c7ed in clone () from /lib64/libc.so.6 - -Channels - E [ ] allow to set a download directory per channel - M [ ] Thumbnail View for Channels - M [ ] Count commments on Comments Button - M [ ] Notify Channel comments/replies - -Posted - E [ ] Show an info page for unsubscribed posted threads (same as forums) - E [ ] Make the GUI of Posted more sexy: more compact items, remove unecessary text, use consistent icons,... - -Forums - E [ ] do we keep "Getting Started" ? the look needs to be improved. Any help doing this is welcome! - E [ ] some widgets in the GUI do not follow the system style => GUI looks bad on these systems - -Bugs - E [ ] find the bug that shows some peers online in Network although they are not. - M [X] Selecting different options in messages composer -> contact list then come back, - shows disappearing / re-appearing people. What causes this??? - -Sounds - E [ ] add default sounds for Friend go online, New Chat Message, Message arrived, Download complete - M [ ] make sure sound is working for users on linux. We also need a "test sound" button in config->sound. - -Packaging - E [ ] Sound files should be part of the install package at least on ubuntu (put them in /usr/share) - -List of pending non backward compatible changes -=============================================== - - * RsGxsGrpMetaData::deserialis should use a proper TLV_STR_TYPE_NAME instead of 0 for - mGroupName and mMsgName, in rsgxsdata.cc - * p3IdService::service_CreateGroup() should convert the mPgpSign member to radix64!! For now - it is hard-coded in binary in a string. - - diff --git a/android-prepare-toolchain.sh b/android-prepare-toolchain.sh deleted file mode 100755 index 100b426ff..000000000 --- a/android-prepare-toolchain.sh +++ /dev/null @@ -1,333 +0,0 @@ -#!/bin/bash - -## Define default value for variable, take two arguments, $1 variable name, -## $2 default variable value, if the variable is not already define define it -## with default value. -function define_default_value() -{ - VAR_NAME="${1}" - DEFAULT_VALUE="${2}" - - [ -z "${!VAR_NAME}" ] && export ${VAR_NAME}="${DEFAULT_VALUE}" -} - -## You are supposed to provide the following variables according to your system setup -define_default_value ANDROID_NDK_PATH "/opt/android-ndk/" -define_default_value ANDROID_NDK_ARCH "arm" -define_default_value ANDROID_NDK_ABI_VER "4.9" -define_default_value ANDROID_PLATFORM_VER "18" -define_default_value NATIVE_LIBS_TOOLCHAIN_PATH "${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}-abi${ANDROID_NDK_ABI_VER}/" -define_default_value HOST_NUM_CPU $(nproc) - -define_default_value BZIP2_SOURCE_VERSION "1.0.6" -define_default_value BZIP2_SOURCE_SHA256 a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd - -define_default_value OPENSSL_SOURCE_VERSION "1.0.2n" -define_default_value OPENSSL_SOURCE_SHA256 370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe - -define_default_value SQLITE_SOURCE_YEAR "2018" -define_default_value SQLITE_SOURCE_VERSION "3220000" -define_default_value SQLITE_SOURCE_SHA256 2824ab1238b706bc66127320afbdffb096361130e23291f26928a027b885c612 - -define_default_value SQLCIPHER_SOURCE_VERSION "3.4.2" -define_default_value SQLCIPHER_SOURCE_SHA256 69897a5167f34e8a84c7069f1b283aba88cdfa8ec183165c4a5da2c816cfaadb - -define_default_value LIBUPNP_SOURCE_VERSION "1.6.24" -define_default_value LIBUPNP_SOURCE_SHA256 7d83d79af3bb4062e5c3a58bf2e90d2da5b8b99e2b2d57c23b5b6f766288cf96 - -define_default_value INSTALL_QT_ANDROID "false" -define_default_value QT_VERSION "5.9.4" -define_default_value QT_ANDROID_INSTALLER_SHA256 a214084e2295c9a9f8727e8a0131c37255bf724bfc69e80f7012ba3abeb1f763 - - -## $1 filename, $2 sha256 hash -function check_sha256() -{ - echo ${2} "${1}" | sha256sum -c &> /dev/null -} - -## $1 filename, $2 sha256 hash, $3 url -function verified_download() -{ - FILENAME="$1" - SHA256="$2" - URL="$3" - - check_sha256 "${FILENAME}" "${SHA256}" || - { - rm -rf "${FILENAME}" - - wget -O "${FILENAME}" "$URL" || - { - echo "Failed downloading ${FILENAME} from $URL" - exit 1 - } - - check_sha256 "${FILENAME}" "${SHA256}" || - { - echo "SHA256 mismatch for ${FILENAME} from ${URL} expected sha256 ${SHA256} got $(sha256sum ${FILENAME} | awk '{print $1}')" - exit 1 - } - } -} - - - -if [ "${ANDROID_NDK_ARCH}" == "x86" ]; then - cArch="i686" - eABI="" -else - cArch="${ANDROID_NDK_ARCH}" - eABI="eabi" -fi -export SYSROOT="${NATIVE_LIBS_TOOLCHAIN_PATH}/sysroot" -export PREFIX="${SYSROOT}" -export CC="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-gcc" -export CXX="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-g++" -export AR="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar" -export RANLIB="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib" -export ANDROID_DEV="${ANDROID_NDK_PATH}/platforms/android-${ANDROID_PLATFORM_VER}/arch-${ANDROID_NDK_ARCH}/usr" - - -## More information available at https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html -build_toolchain() -{ - rm -rf ${NATIVE_LIBS_TOOLCHAIN_PATH} - [ "${ANDROID_NDK_ARCH}" == "x86" ] && toolchainName="${ANDROID_NDK_ARCH}-${ANDROID_NDK_ABI_VER}" || toolchainName="${ANDROID_NDK_ARCH}-linux-androideabi-${ANDROID_NDK_ABI_VER}" - ${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh --ndk-dir=${ANDROID_NDK_PATH} --arch=${ANDROID_NDK_ARCH} --install-dir=${NATIVE_LIBS_TOOLCHAIN_PATH} --platform=android-${ANDROID_PLATFORM_VER} --toolchain=${toolchainName} --verbose -} - -## More information available at https://gitlab.com/relan/provisioners/merge_requests/1 and http://stackoverflow.com/a/34032216 -install_qt_android() -{ - QT_VERSION_CODE=$(echo $QT_VERSION | tr -d .) - QT_INSTALL_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}/Qt - QT_INSTALLER="qt-unified-linux-x64-3.0.2-online.run" - - verified_download $QT_INSTALLER $QT_ANDROID_INSTALLER_SHA256 \ - http://master.qt.io/archive/online_installers/3.0/${QT_INSTALLER} - - chmod a+x ${QT_INSTALLER} - - QT_INSTALLER_SCRIPT="qt_installer_script.js" - cat << EOF > "${QT_INSTALLER_SCRIPT}" -function Controller() { - installer.autoRejectMessageBoxes(); - installer.installationFinished.connect(function() { - gui.clickButton(buttons.NextButton); - }); - - var welcomePage = gui.pageWidgetByObjectName("WelcomePage"); - welcomePage.completeChanged.connect(function() { - if (gui.currentPageWidget().objectName == welcomePage.objectName) - gui.clickButton(buttons.NextButton); - }); -} - -Controller.prototype.WelcomePageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.CredentialsPageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.IntroductionPageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.TargetDirectoryPageCallback = function() { - gui.currentPageWidget().TargetDirectoryLineEdit.setText("$QT_INSTALL_PATH"); - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.ComponentSelectionPageCallback = function() { - var widget = gui.currentPageWidget(); - - // You can get these component names by running the installer with the - // --verbose flag. It will then print out a resource tree. - - widget.deselectComponent("qt.tools.qtcreator"); - widget.deselectComponent("qt.tools.doc"); - widget.deselectComponent("qt.tools.examples"); - - widget.selectComponent("qt.$QT_VERSION_CODE.android_armv7"); - - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.LicenseAgreementPageCallback = function() { - gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true); - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.StartMenuDirectoryPageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.ReadyForInstallationPageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.FinishedPageCallback = function() { - var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm; - if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) - checkBoxForm.launchQtCreatorCheckBox.checked = false; - gui.clickButton(buttons.FinishButton); -} -EOF - -QT_QPA_PLATFORM=minimal ./${QT_INSTALLER} --script ${QT_INSTALLER_SCRIPT} -} - -## More information available at retroshare://file?name=Android%20Native%20Development%20Kit%20Cookbook.pdf&size=29214468&hash=0123361c1b14366ce36118e82b90faf7c7b1b136 -build_bzlib() -{ - B_dir="bzip2-${BZIP2_SOURCE_VERSION}" - rm -rf $B_dir - - verified_download $B_dir.tar.gz $BZIP2_SOURCE_SHA256 \ - http://www.bzip.org/${BZIP2_SOURCE_VERSION}/bzip2-${BZIP2_SOURCE_VERSION}.tar.gz - - tar -xf $B_dir.tar.gz - cd $B_dir - sed -i "/^CC=.*/d" Makefile - sed -i "/^AR=.*/d" Makefile - sed -i "/^RANLIB=.*/d" Makefile - sed -i "/^LDFLAGS=.*/d" Makefile - sed -i "s/^all: libbz2.a bzip2 bzip2recover test/all: libbz2.a bzip2 bzip2recover/" Makefile - make -j${HOST_NUM_CPU} - make install PREFIX=${SYSROOT}/usr -# sed -i "/^CC=.*/d" Makefile-libbz2_so -# make -f Makefile-libbz2_so -j${HOST_NUM_CPU} -# cp libbz2.so.1.0.6 ${SYSROOT}/usr/lib/libbz2.so - cd .. -} - -## More information available at http://doc.qt.io/qt-5/opensslsupport.html -build_openssl() -{ - B_dir="openssl-${OPENSSL_SOURCE_VERSION}" - rm -rf $B_dir - - verified_download $B_dir.tar.gz $OPENSSL_SOURCE_SHA256 \ - https://www.openssl.org/source/$B_dir.tar.gz - - tar -xf $B_dir.tar.gz - cd $B_dir - if [ "${ANDROID_NDK_ARCH}" == "arm" ]; then - oArch="armv7" - else - oArch="${ANDROID_NDK_ARCH}" - fi -# ANDROID_NDK_ROOT="${ANDROID_NDK_PATH}" ./Configure android-${oArch} shared --prefix="${SYSROOT}/usr" --openssldir="${SYSROOT}/etc/ssl" -## We link openssl statically to avoid android silently sneaking in his own -## version of libssl.so (we noticed this because it had some missing symbol -## that made RS crash), the crash in some android version is only one of the -## possible problems the fact that android insert his own binary libssl.so pose -## non neglegible security concerns. - ANDROID_NDK_ROOT="${ANDROID_NDK_PATH}" ./Configure android-${oArch} --prefix="${SYSROOT}/usr" --openssldir="${SYSROOT}/etc/ssl" - sed -i 's/LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \\/LIBNAME=$$i \\/g' Makefile - sed -i '/LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \\/d' Makefile - make -j${HOST_NUM_CPU} - make install -# cp *.so "${SYSROOT}/usr/lib" - cd .. -} - -build_sqlite() -{ - B_dir="sqlite-autoconf-${SQLITE_SOURCE_VERSION}" - - verified_download $B_dir.tar.gz $SQLITE_SOURCE_SHA256 \ - https://www.sqlite.org/${SQLITE_SOURCE_YEAR}/$B_dir.tar.gz - - tar -xf $B_dir.tar.gz - cd $B_dir - ./configure --prefix="${SYSROOT}/usr" --host=${ANDROID_NDK_ARCH}-linux - make -j${HOST_NUM_CPU} - make install - rm -f ${SYSROOT}/usr/lib/libsqlite3.so* -# ${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl -# cp libsqlite3.so "${SYSROOT}/usr/lib" - cd .. -} - -build_sqlcipher() -{ - B_dir="sqlcipher-${SQLCIPHER_SOURCE_VERSION}" - rm -rf $B_dir - - T_file="${B_dir}.tar.gz" - - verified_download $T_file $SQLCIPHER_SOURCE_SHA256 \ - https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_SOURCE_VERSION}.tar.gz - - tar -xf $T_file - cd $B_dir - ./configure --build=$(sh ./config.guess) \ - --host=${ANDROID_NDK_ARCH}-linux \ - --prefix="${SYSROOT}/usr" --with-sysroot="${SYSROOT}" \ - --enable-tempstore=yes \ - --disable-tcl --disable-shared \ - CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="${SYSROOT}/usr/lib/libcrypto.a" - make -j${HOST_NUM_CPU} - make install - cd .. -} - -build_libupnp() -{ - B_dir="libupnp-${LIBUPNP_SOURCE_VERSION}" - rm -rf $B_dir - - verified_download $B_dir.tar.bz2 $LIBUPNP_SOURCE_SHA256 \ - https://sourceforge.net/projects/pupnp/files/pupnp/libUPnP%20${LIBUPNP_SOURCE_VERSION}/$B_dir.tar.bz2 - - tar -xf $B_dir.tar.bz2 - cd $B_dir -## liupnp must be configured as static library because if not the linker will -## look for libthreadutils.so.6 at runtime that cannot be packaged on android -## as it supports only libname.so format for libraries, thus resulting in a -## crash at startup. - ./configure --enable-static --disable-shared --disable-samples --prefix="${SYSROOT}/usr" --host=${ANDROID_NDK_ARCH}-linux - make -j${HOST_NUM_CPU} - make install - cd .. -} - -build_libmicrohttpd() -{ - echo "libmicrohttpd not supported yet on android" - return 0 - - B_dir="libmicrohttpd-0.9.50" - rm -rf $B_dir - [ -f $B_dir.tar.gz ] || wget ftp://ftp.gnu.org/gnu/libmicrohttpd/$B_dir.tar.gz - tar -xf $B_dir.tar.gz - cd $B_dir - ./configure --prefix="${SYSROOT}/usr" --host=${ANDROID_NDK_ARCH}-linux - #make -e ? - make -j${HOST_NUM_CPU} - make install - cd .. -} - -build_rapidjson() -{ - B_dir="rapidjson-1.1.0" - [ -f $B_dir.tar.gz ] || wget -O $B_dir.tar.gz https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz - tar -xf $B_dir.tar.gz - cp -r rapidjson-1.1.0/include/rapidjson/ "${SYSROOT}/usr/include/rapidjson" -} - -build_toolchain -[ "${INSTALL_QT_ANDROID}X" == "trueX" ] && install_qt_android -build_bzlib -build_openssl -build_sqlite -build_sqlcipher -build_libupnp -build_rapidjson - -echo NATIVE_LIBS_TOOLCHAIN_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH} diff --git a/README-Android.asciidoc b/build_scripts/Android/README.asciidoc similarity index 100% rename from README-Android.asciidoc rename to build_scripts/Android/README.asciidoc diff --git a/build_scripts/Debian/debian/copyright b/build_scripts/Debian/debian/copyright index fe0eb5010..8b187a84b 100644 --- a/build_scripts/Debian/debian/copyright +++ b/build_scripts/Debian/debian/copyright @@ -23,10 +23,7 @@ Files: src/retroshare-gui/src/TorControl/ Copyright: 2014, John Brooks License: BSD-New -Files: src/libresapi/src/api/json.h \ - libresapi/src/webui-src/app/mithril.min.js \ - src/rapidjson-1.1.0/* \ - retroshare-gui/src/gui/common/PictureFlow.* \ +Files: retroshare-gui/src/gui/common/PictureFlow.* \ src/retroshare-gui/src/qss/qdarkstyle.qss Copyright: 2013 Jeff Weinstein License: MIT diff --git a/MacOS_X_InstallGuide.md b/build_scripts/OSX/MacOS_X_InstallGuide.md similarity index 100% rename from MacOS_X_InstallGuide.md rename to build_scripts/OSX/MacOS_X_InstallGuide.md diff --git a/travis_makeOSXPackage.sh b/build_scripts/OSX/travis_makeOSXPackage.sh similarity index 100% rename from travis_makeOSXPackage.sh rename to build_scripts/OSX/travis_makeOSXPackage.sh diff --git a/WindowsMSys2_InstallGuide.md b/build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md similarity index 100% rename from WindowsMSys2_InstallGuide.md rename to build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md diff --git a/libresapi/src/.gitignore b/libresapi/src/.gitignore deleted file mode 100644 index afe2a0b3d..000000000 --- a/libresapi/src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -webui/* diff --git a/libresapi/src/README.md b/libresapi/src/README.md deleted file mode 100644 index ee8cf5671..000000000 --- a/libresapi/src/README.md +++ /dev/null @@ -1,14 +0,0 @@ -libresapi: resource_api and new webinterface -============================================ - -* ./api contains a C++ backend to control retroshare from webinterfaces or scripting -* ./webui contains compiled files for the webinterface (after build) -* ./webui-src contains HTML/CSS/JavaScript source files for the webinterface (NEW, webinterface made with mithril.js) - -Quickinfo for builders and packagers -==================================== - -* copy the files in ./webui to -* ./webui (Windows) -* /usr/share/retroshare/webui (Linux) -* other OS: see RsAccountsDetail::PathDataDirectory() diff --git a/libresapi/src/api/ApiPluginHandler.cpp b/libresapi/src/api/ApiPluginHandler.cpp deleted file mode 100644 index 29253aa42..000000000 --- a/libresapi/src/api/ApiPluginHandler.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiPluginHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "ApiPluginHandler.h" - -namespace resource_api -{ - -ApiPluginHandler::ApiPluginHandler(StateTokenServer* statetokenserver, const RsPlugInInterfaces& ifaces) -{ - for(int i = 0; i < ifaces.mPluginHandler->nbPlugins(); i++) - { - RsPlugin* plugin = ifaces.mPluginHandler->plugin(i); - // if plugin is not loaded, pointer is null - if(plugin == 0) - continue; - std::string entrypoint; - ResourceRouter* child = plugin->new_resource_api_handler(ifaces, statetokenserver, entrypoint); - if(child != 0) - { - mChildren.push_back(child); - if(isNameUsed(entrypoint)) - { - std::cerr << "Cannot add plugin api entry point with name=" << entrypoint << ", becaus ethis name is already in use!" << std::endl; - } - else - { - std::cerr << "Added libresapi plugin with entrypoint " << entrypoint << std::endl; - addResourceHandler(entrypoint, child, &ResourceRouter::handleRequest); - } - } - } -} - -ApiPluginHandler::~ApiPluginHandler() -{ - for(std::vector::iterator vit = mChildren.begin(); vit != mChildren.end(); ++vit) - { - delete *vit; - } - mChildren.clear(); -} - -} // namespace resource_api diff --git a/libresapi/src/api/ApiPluginHandler.h b/libresapi/src/api/ApiPluginHandler.h deleted file mode 100644 index 600e8b505..000000000 --- a/libresapi/src/api/ApiPluginHandler.h +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiPluginHandler.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include "ResourceRouter.h" -#include - -namespace resource_api -{ - -// forwards all incoming requests to retroshare plugins -class ApiPluginHandler: public ResourceRouter -{ -public: - ApiPluginHandler(StateTokenServer* statetokenserver, const RsPlugInInterfaces& ifaces); - virtual ~ApiPluginHandler(); - -private: - std::vector mChildren; -}; - -} // namespace resource_api diff --git a/libresapi/src/api/ApiServer.cpp b/libresapi/src/api/ApiServer.cpp deleted file mode 100644 index 8217dc7f6..000000000 --- a/libresapi/src/api/ApiServer.cpp +++ /dev/null @@ -1,464 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiServer.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "ApiServer.h" - -#include -#include - -#include -#include -#include -#include -#include "json.h" - -#include -#include "JsonStream.h" -#include "StateTokenServer.h" // for the state token serialisers - -#include "ApiPluginHandler.h" -#include "ChannelsHandler.h" -#include "StatsHandler.h" - -#ifdef LIBRESAPI_SETTINGS - #include "SettingsHandler.h" -#endif - -/* -data types in json http://json.org/ -string (utf-8 unicode) -number (int and float) -object (key value pairs, key must be a string) -true -false -null - -data types in lua http://www.lua.org/pil/2.html -nil -boolean -number (double) -string (8-bit) -table (key value pairs, keys can be anything except nil) - -data types in QML http://qt-project.org/doc/qt-5/qtqml-typesystem-basictypes.html -bool -string -real/double -int -list -object types? - -QML has many more types with special meaning like date - - -C++ delivers -std::string -bool -int -(double? i don't know) -enum -bitflags -raw binary data - -objects -std::vector -std::list - -different types of ids/hashes --> convert to/from string with a generic operator --> the operator signals ok/fail to the stream - - -*/ - -/* - -data types to handle: -- bool -- string -- bitflags -- enums - -containers: -- arrays: collection of objects or values without name, usually of the same type -- objects: objects and values with names - -careful: the json lib has many asserts, so retroshare will stop if the smalles thing goes wrong --> check type of json before usage - -there are two possible implementations: -- with a virtual base class for the serialisation targets - - better documentation of the interface -- with templates - -*/ - -/* - -the general idea is: -want output in many different formats, while the retrival of the source data is always the same - -get, put - -ressource adress like -.org.retroshare.api.peers - -generic router from adress to the ressource handler object - -data formats for input and output: -- json -- lua -- QObject -- maybe just a typed c++ object - -rest inspired / resource based interface -- have resources with adresses -- requests: - - put - - get -- request has parameters -- response: - - returncode: - - ok - - not modified - - error - - data = object or list of objects - -want to have a typesafe interface at the top? -probably not, a system with generic return values is enough -this interface is for scripting languages which don't have types - -the interface at the top should look like this: -template -processRequest(const RequestMeta& req, const RequestDataFormatT& reqData, - ResponseMeta& respMeta, ResponseDataFormatT& respData); - -idea: pass all the interfaces to the retroshare core to this function, -or have this function as part of an object - -the processor then applies all members of the request and response data to the data format like this: -reqData << "member1" << member1 - << "member2" << member2 ... ; - -these operators have to be implemented for common things like boolean, int, std::string, std::vector, std::list ... -request data gets only deserialised -response data gets only serialised - -response and request meta contains things like resource address, method and additional parameters - -want generic resource caching mechanism -- on first request a request handler is created -- request handler is stored with its input data -- if a request handler for a given resource adress and parameters exists - then the request handler is asked if the result is still valid - if yes the result from the existing handler is used -- request handler gets deleted after timeout -- can have two types of resource handlers: static handlers and dynamic handlers - - static handlers don't get deleted, because they don't contain result data - - dynamic handlers contain result data, and thus get deleted after a while - -it is even possible to implement a resource-changed check at the highest level -this allows to compute everything on the server side and only send changes to the client -the different resource providers don't have to implement a resource changed check then -a top level change detector will poll them -of course this does not work with a deep resource tree with millions of nodes - -for this we have the dynamic handlers, -they are created on demand and know how to listen for changes which affect them - -*/ - -namespace resource_api{ - -// old code, only to copy and paste from -// to be removed -/* -class ChatlobbiesHandler -{ -public: - ChatlobbiesHandler(RsMsgs* msgs): mMsgs(msgs) {} - - template - void handleRequest(Request& req, InputT& reqData, Response& resp, OutputT& respData) - { - if(req.mMethod == "GET") - { - typename OutputT::Array result; - // subscribed lobbies - std::list slobbies; - mMsgs->getChatLobbyList(slobbies); - for(std::list::iterator lit = slobbies.begin(); lit != slobbies.end(); lit++) - { - typename OutputT::Object lobby; - ChatLobbyInfo& lobbyRecord = *lit; - lobby["name"] = lobbyRecord.lobby_name; - RsPeerId pid; - mMsgs->getVirtualPeerId(lobbyRecord.lobby_id, pid); - lobby["id"] = pid.toStdString(); - lobby["subscribed"] = true; - result.push_back(lobby); - } - // unsubscirbed lobbies - std::vector ulobbies; - mMsgs->getListOfNearbyChatLobbies(ulobbies); - for(std::vector::iterator vit = ulobbies.begin(); vit != ulobbies.end(); vit++) - { - typename OutputT::Object lobby; - VisibleChatLobbyRecord& lobbyRecord = *vit; - lobby["name"] = lobbyRecord.lobby_name; - RsPeerId pid; - mMsgs->getVirtualPeerId(lobbyRecord.lobby_id, pid); - lobby["id"] = pid.toStdString(); - lobby["subscribed"] = false; - result.push_back(lobby); - } - respData = result; - } - else if(req.mMethod == "PUT") - { - RsPeerId id = RsPeerId(req.mAdress.substr(1)); - - if(!id.isNull() && reqData.HasKey("msg")) - { - // for now can send only id as message - mMsgs->sendPrivateChat(id, reqData["msg"]); - } - } - } - - RsMsgs* mMsgs; -}; -*/ - -class ApiServerMainModules -{ -public: - ApiServerMainModules(ResourceRouter& router, StateTokenServer* sts, const RsPlugInInterfaces &ifaces): - mPeersHandler(sts, ifaces.mNotify, ifaces.mPeers, ifaces.mMsgs), - mIdentityHandler(sts, ifaces.mNotify, ifaces.mIdentity), - mForumHandler(ifaces.mGxsForums), - mServiceControlHandler(ifaces.mServiceControl), - mFileSearchHandler(sts, ifaces.mNotify, ifaces.mTurtle, ifaces.mFiles), - mFileSharingHandler(sts, ifaces.mFiles, *ifaces.mNotify), - mTransfersHandler(sts, ifaces.mFiles, ifaces.mPeers, *ifaces.mNotify), - mChatHandler(sts, ifaces.mNotify, ifaces.mMsgs, ifaces.mPeers, ifaces.mIdentity, &mPeersHandler), - mApiPluginHandler(sts, ifaces), - mChannelsHandler(*ifaces.mGxsChannels), - mStatsHandler() -#ifdef LIBRESAPI_SETTINGS - ,mSettingsHandler(sts) -#endif - { - // the dynamic cast is to not confuse the addResourceHandler template like this: - // addResourceHandler(derived class, parent class) - // the template would then be instantiated using derived class as parameter - // and then parent class would not match the type - router.addResourceHandler("peers",dynamic_cast(&mPeersHandler), - &PeersHandler::handleRequest); - router.addResourceHandler("identity", dynamic_cast(&mIdentityHandler), - &IdentityHandler::handleRequest); - router.addResourceHandler("forums", dynamic_cast(&mForumHandler), - &ForumHandler::handleRequest); - router.addResourceHandler("servicecontrol", dynamic_cast(&mServiceControlHandler), - &ServiceControlHandler::handleRequest); - router.addResourceHandler("filesearch", dynamic_cast(&mFileSearchHandler), - &FileSearchHandler::handleRequest); - router.addResourceHandler("filesharing", dynamic_cast(&mFileSharingHandler), - &FileSharingHandler::handleRequest); - router.addResourceHandler("transfers", dynamic_cast(&mTransfersHandler), - &TransfersHandler::handleRequest); - router.addResourceHandler("chat", dynamic_cast(&mChatHandler), - &ChatHandler::handleRequest); - router.addResourceHandler("apiplugin", dynamic_cast(&mApiPluginHandler), - &ChatHandler::handleRequest); - router.addResourceHandler("channels", dynamic_cast(&mChannelsHandler), - &ChannelsHandler::handleRequest); - router.addResourceHandler("stats", dynamic_cast(&mStatsHandler), - &StatsHandler::handleRequest); -#ifdef LIBRESAPI_SETTINGS - router.addResourceHandler("settings", dynamic_cast(&mSettingsHandler), - &SettingsHandler::handleRequest); -#endif - } - - PeersHandler mPeersHandler; - IdentityHandler mIdentityHandler; - ForumHandler mForumHandler; - ServiceControlHandler mServiceControlHandler; - FileSearchHandler mFileSearchHandler; - FileSharingHandler mFileSharingHandler; - TransfersHandler mTransfersHandler; - ChatHandler mChatHandler; - ApiPluginHandler mApiPluginHandler; - ChannelsHandler mChannelsHandler; - StatsHandler mStatsHandler; - -#ifdef LIBRESAPI_SETTINGS - SettingsHandler mSettingsHandler; -#endif -}; - -ApiServer::ApiServer(): - mMtx("ApiServer mMtx"), - mStateTokenServer(), - mLivereloadhandler(&mStateTokenServer), - mTmpBlobStore(&mStateTokenServer), - mMainModules(0) -{ - mRouter.addResourceHandler("statetokenservice", dynamic_cast(&mStateTokenServer), - &StateTokenServer::handleRequest); - mRouter.addResourceHandler("livereload", dynamic_cast(&mLivereloadhandler), - &LivereloadHandler::handleRequest); -} - -ApiServer::~ApiServer() -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - for(std::vector::iterator vit = mRequests.begin(); vit != mRequests.end(); ++vit) - delete vit->task; - mRequests.clear(); - - if(mMainModules) - delete mMainModules; -} - -void ApiServer::loadMainModules(const RsPlugInInterfaces &ifaces) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - if(mMainModules == 0) - mMainModules = new ApiServerMainModules(mRouter, &mStateTokenServer, ifaces); -} - -std::string ApiServer::handleRequest(Request &request) -{ - resource_api::JsonStream outstream; - std::stringstream debugString; - - StreamBase& data = outstream.getStreamToMember("data"); - resource_api::Response resp(data, debugString); - - ResponseTask* task = 0; - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - task = mRouter.handleRequest(request, resp); - } - - //time_t start = time(NULL); - bool morework = true; - while(task && morework) - { - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - morework = task->doWork(request, resp); - } - if(morework) - usleep(10*1000); - /*if(time(NULL) > (start+5)) - { - std::cerr << "ApiServer::handleRequest() Error: task timed out" << std::endl; - resp.mDebug << "Error: task timed out." << std::endl; - resp.mReturnCode = resource_api::Response::FAIL; - break; - }*/ - } - if(task) - delete task; - - std::string returncode; - switch(resp.mReturnCode){ - case resource_api::Response::NOT_SET: - returncode = "not_set"; - break; - case resource_api::Response::OK: - returncode = "ok"; - break; - case resource_api::Response::WARNING: - returncode = "warning"; - break; - case resource_api::Response::FAIL: - returncode = "fail"; - break; - } - - // evil HACK, remove this - if(data.isRawData()) - return data.getRawData(); - - if(!resp.mCallbackName.empty()) - outstream << resource_api::makeKeyValueReference("callback_name", resp.mCallbackName); - - outstream << resource_api::makeKeyValue("debug_msg", debugString.str()); - outstream << resource_api::makeKeyValueReference("returncode", returncode); - if(!resp.mStateToken.isNull()) - outstream << resource_api::makeKeyValueReference("statetoken", resp.mStateToken); - return outstream.getJsonString(); -} - -ApiServer::RequestId ApiServer::handleRequest(Request &request, Response &response) -{ - RequestId id; - ResponseTask* task = 0; - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - task = mRouter.handleRequest(request, response); - } - if(task == 0) - { - id.done = true; - return id; - } - id.done = false, - id.task = task; - id.request = &request; - id.response = &response; - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - mRequests.push_back(id); - } - return id; -} - -bool ApiServer::isRequestDone(RequestId id) -{ - if(id.done) - return true; - - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - std::vector::iterator vit = std::find(mRequests.begin(), mRequests.end(), id); - // Request id not found, maybe the id is old and was removed from the list - if(vit == mRequests.end()) - return true; - - if(id.task->doWork(*id.request, *id.response)) - return false; - - // if we reach this point, the request is in the list and done - // remove the id from the list of valid ids - // delete the ResponseTask object - - *vit = mRequests.back(); - mRequests.pop_back(); - - delete id.task; - return true; -} - -} // namespace resource_api diff --git a/libresapi/src/api/ApiServer.h b/libresapi/src/api/ApiServer.h deleted file mode 100644 index 42331c33e..000000000 --- a/libresapi/src/api/ApiServer.h +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiServer.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include - -#include "ApiTypes.h" -#include "PeersHandler.h" -#include "IdentityHandler.h" -#include "ForumHandler.h" -#include "ServiceControlHandler.h" -#include "StateTokenServer.h" -#include "FileSearchHandler.h" -#include "FileSharingHandler.h" -#include "TransfersHandler.h" -#include "LivereloadHandler.h" -#include "TmpBlobStore.h" -#include "ChatHandler.h" - -namespace resource_api{ - -class ApiServerMainModules; - -// main entry point for all resource_api calls -// general part of the api server -// should work with any http library or a different transport protocol (e.g. SSH) - -// call chain is like this: -// HTTP server -> ApiServer -> different handlers -// or -// GUI -> ApiServer -> different handlers -// multiple clients can use the same ApiServer instance at the same time - -// ALL public methods in this class are thread safe -// this allows differen threads to send requests -class ApiServer -{ -public: - ApiServer(); - ~ApiServer(); - - class RequestId{ - public: - RequestId(): done(false), task(0), request(0), response(0){} - bool operator ==(const RequestId& r){ - const RequestId& l = *this; - return (l.done==r.done)&&(l.task==r.task)&&(l.request==r.request)&&(l.response&&r.response); - } - private: - friend class ApiServer; - bool done; // this flag will be set to true, to signal the task id is valid and the task is done - // (in case there was no ResponseTask and task was zero) - ResponseTask* task; // null when the task id is invalid or when there was no task - Request* request; - Response* response; - }; - - // process the requestgiven by request and return the response as json string - // blocks until the request was processed - std::string handleRequest(Request& request); - - // request and response must stay valid until isRequestDone returns true - // this method may do some work but it does not block - RequestId handleRequest(Request& request, Response& response); - - // ticks the request - // returns true if the request is done or the id is invalid - // this method may do some work but it does not block - bool isRequestDone(RequestId id); - - // load the main api modules - void loadMainModules(const RsPlugInInterfaces& ifaces); - - // allows to add more handlers - // make sure the livetime of the handlers is longer than the api server - template - void addResourceHandler(std::string name, T* instance, ResponseTask* (T::*callback)(Request& req, Response& resp)); - template - void addResourceHandler(std::string name, T* instance, void (T::*callback)(Request& req, Response& resp)); - - StateTokenServer* getStateTokenServer(){ return &mStateTokenServer; } - TmpBlobStore* getTmpBlobStore(){ return &mTmpBlobStore; } - -private: - RsMutex mMtx; - StateTokenServer mStateTokenServer; // goes first, as others may depend on it - // is always loaded, because it has no dependencies - LivereloadHandler mLivereloadhandler; - TmpBlobStore mTmpBlobStore; - - // only pointers here, to load/unload modules at runtime - ApiServerMainModules* mMainModules; // loaded when RS is started - - ResourceRouter mRouter; - - std::vector mRequests; -}; - -// implementations -template -void ApiServer::addResourceHandler(std::string name, T* instance, ResponseTask* (T::*callback)(Request& req, Response& resp)) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - mRouter.addResourceHandler(name, instance, callback); -} -template -void ApiServer::addResourceHandler(std::string name, T* instance, void (T::*callback)(Request& req, Response& resp)) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - mRouter.addResourceHandler(name, instance, callback); -} - -} diff --git a/libresapi/src/api/ApiServerLocal.cpp b/libresapi/src/api/ApiServerLocal.cpp deleted file mode 100644 index e856f2db2..000000000 --- a/libresapi/src/api/ApiServerLocal.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiServer.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2016 by Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ - -#include -#include -#include - -#include "ApiServerLocal.h" -#include "JsonStream.h" - - -namespace resource_api{ - -ApiServerLocal::ApiServerLocal(ApiServer* server, - const QString &listenPath, QObject *parent) : - QObject(parent), serverThread(this), - // Must have no parent to be movable to other thread - localListener(server, listenPath) -{ - qRegisterMetaType(); - localListener.moveToThread(&serverThread); - serverThread.start(); -} - -ApiServerLocal::~ApiServerLocal() -{ - serverThread.quit(); - serverThread.wait(); -} - -ApiLocalListener::ApiLocalListener(ApiServer *server, - const QString &listenPath, - QObject *parent) : - QObject(parent), mApiServer(server), mLocalServer(this) -{ - QFileInfo fileInfo(listenPath); - if(fileInfo.exists()) - { - std::cerr << __PRETTY_FUNCTION__ << listenPath.toLatin1().data() - << " already exists. " - << "Removing it assuming it's a past crash leftover! " - << "Are you sure another instance is not listening there?" - << std::endl; - mLocalServer.removeServer(listenPath); - } -#if QT_VERSION >= 0x050000 - mLocalServer.setSocketOptions(QLocalServer::UserAccessOption); -#endif - connect( &mLocalServer, &QLocalServer::newConnection, - this, &ApiLocalListener::handleConnection ); - - QDir&& lDir(fileInfo.absoluteDir()); - if(!lDir.exists()) - { - std::cerr << __PRETTY_FUNCTION__ << " Directory for listening socket " - << listenPath.toLatin1().data() << " doesn't exists. " - << " Creating it!" << std::endl; - lDir.mkpath(lDir.absolutePath()); - } - - if(!mLocalServer.listen(listenPath)) - { - std::cerr << __PRETTY_FUNCTION__ << " mLocalServer.listen(" - << listenPath.toLatin1().data() << ") failed with: " - << mLocalServer.errorString().toLatin1().data() << std::endl; - } -} - -void ApiLocalListener::handleConnection() -{ - new ApiLocalConnectionHandler(mApiServer, - mLocalServer.nextPendingConnection(), this); -} - -ApiLocalConnectionHandler::ApiLocalConnectionHandler( - ApiServer* apiServer, QLocalSocket* sock, QObject *parent) : - QObject(parent), mApiServer(apiServer), mLocalSocket(sock), - mState(WAITING_PATH) -{ - connect(mLocalSocket, SIGNAL(disconnected()), this, SLOT(deleteLater())); - connect(sock, SIGNAL(readyRead()), this, SLOT(handlePendingRequests())); -} - -ApiLocalConnectionHandler::~ApiLocalConnectionHandler() -{ - /* Any attempt of closing the socket here also deferred method call, causes - * crash when the core is asked to stop, at least from the JSON API call. - * QMetaObject::invokeMethod(&app, "close", Qt::QueuedConnection) - * mLocalSocket->disconnectFromServer() - * mLocalSocket->close() */ - mLocalSocket->deleteLater(); -} - -void ApiLocalConnectionHandler::handlePendingRequests() -{ - switch(mState) - { - case WAITING_PATH: - { - if(mLocalSocket->canReadLine()) - { -readPath: - QString rString(mLocalSocket->readLine()); - rString = rString.simplified(); - if (!rString.isEmpty()) - { - if(rString.startsWith("PUT", Qt::CaseInsensitive)) reqMeth = resource_api::Request::PUT; - else if (rString.startsWith("DELETE", Qt::CaseInsensitive)) reqMeth = resource_api::Request::DELETE_AA; - else reqMeth = resource_api::Request::GET; - if(rString.contains(' ')) rString = rString.split(' ')[1]; - - reqPath = rString.toStdString(); - mState = WAITING_DATA; - - /* Because QLocalSocket is SOCK_STREAM some clients implementations - * like the one based on QLocalSocket feel free to send the whole - * request (PATH + DATA) in a single write(), causing readyRead() - * signal being emitted only once, in that case we should continue - * processing without waiting for readyRead() being fired again, so - * we don't break here as there may be more lines to read */ - } - else break; - } - } - case WAITING_DATA: - { - if(mLocalSocket->canReadLine()) - { - resource_api::JsonStream reqJson; - reqJson.setJsonString(std::string(mLocalSocket->readLine().constData())); - resource_api::Request req(reqJson); - req.mMethod = reqMeth; - req.setPath(reqPath); - - // Need this idiom because binary result may contains \0 - std::string&& resultString = mApiServer->handleRequest(req); - QByteArray rB(resultString.data(), resultString.length()); - - // Dirty trick to support avatars answers - if(rB.contains("\n") || !rB.startsWith("{") || !rB.endsWith("}")) - mLocalSocket->write(rB.toBase64()); - else mLocalSocket->write(rB); - mLocalSocket->write("\n\0"); - - mState = WAITING_PATH; - - /* Because QLocalSocket is SOCK_STREAM some clients implementations - * like the one based on QLocalSocket feel free to coalesce multiple - * upper level write() into a single socket write(), causing - * readyRead() signal being emitted only once, in that case we should - * keep processing without waiting for readyRead() being fired again */ - if(mLocalSocket->canReadLine()) goto readPath; - - // Now there are no more requests to process we can break - break; - } - } - } -} - -} // namespace resource_api diff --git a/libresapi/src/api/ApiServerLocal.h b/libresapi/src/api/ApiServerLocal.h deleted file mode 100644 index c9ef246b8..000000000 --- a/libresapi/src/api/ApiServerLocal.h +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiServer.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2016 by Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include "ApiTypes.h" -#include "ApiServer.h" - -namespace resource_api -{ - -class ApiLocalListener : public QObject -{ - Q_OBJECT - -public: - ApiLocalListener(ApiServer* server, const QString &listenPath, QObject *parent=0); - ~ApiLocalListener() { mLocalServer.close(); } - -public slots: - void handleConnection(); - -private: - ApiServer* mApiServer; - QLocalServer mLocalServer; -}; - -class ApiServerLocal : public QObject -{ - Q_OBJECT - -public: - ApiServerLocal(ApiServer* server, const QString& listenPath, QObject *parent=0); - ~ApiServerLocal(); - - const static QString& loginServerPath() - { - const static QString sockPath(RsAccounts::ConfigDirectory() - .append("/libresapi.sock").c_str()); - return sockPath; - } - - const static QString& serverPath() - { - const static QString sockPath(RsAccounts::AccountDirectory() - .append("/libresapi.sock").c_str()); - return sockPath; - } - -private: - QThread serverThread; - ApiLocalListener localListener; -}; - -class ApiLocalConnectionHandler : public QObject -{ - Q_OBJECT - -public: - ApiLocalConnectionHandler(ApiServer* apiServer, QLocalSocket* sock, QObject *parent = 0); - ~ApiLocalConnectionHandler(); - enum State {WAITING_PATH, WAITING_DATA}; - -public slots: - void handlePendingRequests(); - -private: - ApiServer* mApiServer; - QLocalSocket* mLocalSocket; - State mState; - std::string reqPath; - resource_api::Request::Method reqMeth; -}; - -} // namespace resource_api diff --git a/libresapi/src/api/ApiServerMHD.cpp b/libresapi/src/api/ApiServerMHD.cpp deleted file mode 100644 index 81da6893d..000000000 --- a/libresapi/src/api/ApiServerMHD.cpp +++ /dev/null @@ -1,693 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiServerMHD.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "ApiServerMHD.h" - -#include -#include -#include -#include -#include - -#include -#include "util/ContentTypes.h" - -// for filestreamer -#include - -// to determine default docroot -#include - -#include "JsonStream.h" -#include "ApiServer.h" - -#if MHD_VERSION < 0x00090000 - // very old version, probably v0.4.x on old debian/ubuntu - #define OLD_04_MHD_FIX -#endif - -// filestreamer only works if a content reader callback is allowed to return 0 -// this is allowed since libmicrohttpd revision 30402 -#if MHD_VERSION >= 0x00093101 // 0.9.31-1 - #define ENABLE_FILESTREAMER -#else - #warning libmicrohttpd is too old to support file streaming. upgrade to a newer version. -#endif - -#ifdef OLD_04_MHD_FIX -#define MHD_CONTENT_READER_END_OF_STREAM ((size_t) -1LL) -/** - * Create a response object. The response object can be extended with - * header information and then be used any number of times. - * - * @param size size of the data portion of the response - * @param fd file descriptor referring to a file on disk with the - * data; will be closed when response is destroyed; - * fd should be in 'blocking' mode - * @return NULL on error (i.e. invalid arguments, out of memory) - * @ingroup response - */ -struct MHD_Response * MHD_create_response_from_fd(size_t size, int fd) -{ - unsigned char *buf = (unsigned char *)malloc(size) ; - - if(buf == 0) - { - std::cerr << "replacement MHD_create_response_from_fd: malloc failed, size was " << size << std::endl; - close(fd); - return NULL ; - } - if(read(fd,buf,size) != size) - { - std::cerr << "replacement MHD_create_response_from_fd: READ error in file descriptor " << fd << " requested read size was " << size << std::endl; - close(fd); - free(buf) ; - return NULL ; - } - else - { - close(fd); - return MHD_create_response_from_data(size, buf,1,0) ; - } -} -#endif - -namespace resource_api{ - -std::string getDefaultDocroot() -{ - return RsAccounts::systemDataDirectory(false) + "/webui"; -} - -const char* API_ENTRY_PATH = "/api/v2"; -const char* FILESTREAMER_ENTRY_PATH = "/fstream/"; -const char* STATIC_FILES_ENTRY_PATH = "/static/"; -const char* UPLOAD_ENTRY_PATH = "/upload/"; - -static void secure_queue_response(MHD_Connection *connection, unsigned int status_code, struct MHD_Response* response); -static void sendMessage(MHD_Connection *connection, unsigned int status, std::string message); - -// interface for request handler classes -class MHDHandlerBase -{ -public: - virtual ~MHDHandlerBase(){} - // return MHD_NO to terminate connection - // return MHD_YES otherwise - // this function will get called by MHD until a response was queued - virtual int handleRequest( struct MHD_Connection *connection, - const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size) = 0; -}; - -// handles calls to the resource_api -class MHDUploadHandler: public MHDHandlerBase -{ -public: - MHDUploadHandler(ApiServer* s): mState(BEGIN), mApiServer(s){} - virtual ~MHDUploadHandler(){} - // return MHD_NO or MHD_YES - virtual int handleRequest( struct MHD_Connection *connection, - const char */*url*/, const char *method, const char */*version*/, - const char *upload_data, size_t *upload_data_size) - { - // new request - if(mState == BEGIN) - { - if(strcmp(method, "POST") == 0) - { - mState = WAITING_DATA; - // first time there is no data, do nothing and return - return MHD_YES; - } - } - if(mState == WAITING_DATA) - { - if(upload_data && *upload_data_size) - { - mRequesString += std::string(upload_data, *upload_data_size); - *upload_data_size = 0; - return MHD_YES; - } - } - - std::vector bytes(mRequesString.begin(), mRequesString.end()); - - int id = mApiServer->getTmpBlobStore()->storeBlob(bytes); - - resource_api::JsonStream responseStream; - if(id) - responseStream << makeKeyValue("ok", true); - else - responseStream << makeKeyValue("ok", false); - - responseStream << makeKeyValueReference("id", id); - - std::string result = responseStream.getJsonString(); - - struct MHD_Response* resp = MHD_create_response_from_data(result.size(), (void*)result.data(), 0, 1); - - MHD_add_response_header(resp, "Content-Type", "application/json"); - - secure_queue_response(connection, MHD_HTTP_OK, resp); - MHD_destroy_response(resp); - return MHD_YES; - } - enum State {BEGIN, WAITING_DATA}; - State mState; - std::string mRequesString; - ApiServer* mApiServer; -}; - -// handles calls to the resource_api -class MHDApiHandler: public MHDHandlerBase -{ -public: - MHDApiHandler(ApiServer* s): mState(BEGIN), mApiServer(s){} - virtual ~MHDApiHandler(){} - // return MHD_NO or MHD_YES - virtual int handleRequest( struct MHD_Connection *connection, - const char *url, const char *method, const char */*version*/, - const char *upload_data, size_t *upload_data_size) - { - // new request - if(mState == BEGIN) - { - if(strcmp(method, "POST") == 0) - { - mState = WAITING_DATA; - // first time there is no data, do nothing and return - return MHD_YES; - } - } - if(mState == WAITING_DATA) - { - if(upload_data && *upload_data_size) - { - mRequesString += std::string(upload_data, *upload_data_size); - *upload_data_size = 0; - return MHD_YES; - } - } - - if(strstr(url, API_ENTRY_PATH) != url) - { - std::cerr << "FATAL ERROR in MHDApiHandler::handleRequest(): url does not start with api entry path, which is \"" << API_ENTRY_PATH << "\"" << std::endl; - return MHD_NO; - } - std::string path2 = (url + strlen(API_ENTRY_PATH)); - - resource_api::JsonStream instream; - instream.setJsonString(mRequesString); - resource_api::Request req(instream); - - if(strcmp(method, "GET") == 0) - { - req.mMethod = resource_api::Request::GET; - } - else if(strcmp(method, "POST") == 0) - { - req.mMethod = resource_api::Request::PUT; - } - else if(strcmp(method, "DELETE") == 0) - { - req.mMethod = resource_api::Request::DELETE_AA; - } - - req.setPath(path2); - - std::string result = mApiServer->handleRequest(req); - - struct MHD_Response* resp = MHD_create_response_from_data(result.size(), (void*)result.data(), 0, 1); - - // EVIL HACK remove - if(result[0] != '{') - MHD_add_response_header(resp, "Content-Type", "image/png"); - else - MHD_add_response_header(resp, "Content-Type", "application/json"); - - secure_queue_response(connection, MHD_HTTP_OK, resp); - MHD_destroy_response(resp); - return MHD_YES; - } - enum State {BEGIN, WAITING_DATA}; - State mState; - std::string mRequesString; - ApiServer* mApiServer; -}; - -#ifdef ENABLE_FILESTREAMER -class MHDFilestreamerHandler: public MHDHandlerBase -{ -public: - MHDFilestreamerHandler(): mSize(0){} - virtual ~MHDFilestreamerHandler(){} - - RsFileHash mHash; - uint64_t mSize; - - // return MHD_NO or MHD_YES - virtual int handleRequest( struct MHD_Connection *connection, - const char *url, const char */*method*/, const char */*version*/, - const char */*upload_data*/, size_t */*upload_data_size*/) - { - if(rsFiles == 0) - { - sendMessage(connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "Error: rsFiles is null. Retroshare is probably not yet started."); - return MHD_YES; - } - std::string urls(url); - urls = urls.substr(strlen(FILESTREAMER_ENTRY_PATH)); - size_t perpos = urls.find('/'); - if(perpos == std::string::npos){ - mHash = RsFileHash(urls); - }else{ - mHash = RsFileHash(urls.substr(0, perpos)); - } - if(urls.empty() || mHash.isNull()) - { - sendMessage(connection, MHD_HTTP_NOT_FOUND, "Error: URL is not a valid file hash"); - return MHD_YES; - } - - FileInfo info; - std::list dls; - rsFiles->FileDownloads(dls); - if(!(rsFiles->alreadyHaveFile(mHash, info) || std::find(dls.begin(), dls.end(), mHash) != dls.end())) - { - sendMessage(connection, MHD_HTTP_NOT_FOUND, "Error: file not existing on local peer and not downloading. Start the download before streaming it."); - return MHD_YES; - } - mSize = info.size; - - struct MHD_Response* resp = MHD_create_response_from_callback( - mSize, 1024*1024, &contentReadercallback, this, NULL); - - // get content-type from extension - std::string ext = ""; - std::string::size_type i = info.fname.rfind('.'); - if(i != std::string::npos) - ext = info.fname.substr(i+1); - MHD_add_response_header(resp, "Content-Type", ContentTypes::cTypeFromExt(ext).c_str()); - - secure_queue_response(connection, MHD_HTTP_OK, resp); - MHD_destroy_response(resp); - return MHD_YES; - } - - static ssize_t contentReadercallback(void *cls, uint64_t pos, char *buf, size_t max) - { - MHDFilestreamerHandler* handler = (MHDFilestreamerHandler*)cls; - if(pos >= handler->mSize) - return MHD_CONTENT_READER_END_OF_STREAM; - uint32_t size_to_send = max; - if(!rsFiles->getFileData(handler->mHash, pos, size_to_send, (uint8_t*)buf)) - return 0; - return size_to_send; - } -}; -#endif // ENABLE_FILESTREAMER - -// MHD will call this for each element of the http header -static int _extract_host_header_it_cb(void *cls, - enum MHD_ValueKind kind, - const char *key, - const char *value) -{ - if(kind == MHD_HEADER_KIND) - { - // check if key is host - const char* h = "host"; - while(*key && *h) - { - if(tolower(*key) != *h) - return MHD_YES; - key++; - h++; - } - // strings have same length and content - if(*key == 0 && *h == 0) - { - *((std::string*)cls) = value; - } - } - return MHD_YES; -} - -// add security related headers and send the response on the given connection -// the reference counter is not touched -// this function is a wrapper around MHD_queue_response -// MHD_queue_response should be replaced with this function -static void secure_queue_response(MHD_Connection *connection, unsigned int status_code, struct MHD_Response* response) -{ - // TODO: protect againts handling untrusted content to the browser - // see: - // http://www.dotnetnoob.com/2012/09/security-through-http-response-headers.html - // http://www.w3.org/TR/CSP2/ - // https://code.google.com/p/doctype-mirror/wiki/ArticleContentSniffing - - // check content type - // don't server when no type or no whitelisted type is given - // TODO sending invalid mime types is as bad as not sending them TODO - /* - std::vector allowed_types; - allowed_types.push_back("text/html"); - allowed_types.push_back("application/json"); - allowed_types.push_back("image/png"); - */ - const char* type = MHD_get_response_header(response, "Content-Type"); - if(type == 0 /*|| std::find(allowed_types.begin(), allowed_types.end(), std::string(type)) == allowed_types.end()*/) - { - std::string page; - if(type == 0) - page = "

Fatal Error: no content type was set on this response. This is a bug.

"; - else - page = "

Fatal Error: this content type is not allowed. This is a bug.
Content-Type: "+std::string(type)+"

"; - struct MHD_Response* resp = MHD_create_response_from_data(page.size(), (void*)page.data(), 0, 1); - MHD_add_response_header(resp, "Content-Type", "text/html"); - MHD_queue_response(connection, MHD_HTTP_INTERNAL_SERVER_ERROR, resp); - MHD_destroy_response(resp); - } - - // tell Internet Explorer to not do content sniffing - MHD_add_response_header(response, "X-Content-Type-Options", "nosniff"); - - // Prevent clickjacking attacks (also prevented by CSP, but not in all browsers, including FireFox) - MHD_add_response_header(response, "X-Frame-Options", "SAMEORIGIN"); - - // Content security policy header, its a new technology and not implemented everywhere - - // get own host name as the browser sees it - std::string host; - MHD_get_connection_values(connection, MHD_HEADER_KIND, _extract_host_header_it_cb, (void*)&host); - - std::string csp; - csp += "default-src 'none';"; - csp += "script-src '"+host+STATIC_FILES_ENTRY_PATH+"';"; - csp += "font-src '"+host+STATIC_FILES_ENTRY_PATH+"';"; - csp += "img-src 'self';"; // allow images from all paths on this server - csp += "media-src 'self';"; // allow media files from all paths on this server - - MHD_add_response_header(response, "X-Content-Security-Policy", csp.c_str()); - - MHD_queue_response(connection, status_code, response); -} - -// wraps the given string in a html page and sends it as response with the given status code -static void sendMessage(MHD_Connection *connection, unsigned int status, std::string message) -{ - std::string page = "

"+message+"

"; - struct MHD_Response* resp = MHD_create_response_from_data(page.size(), (void*)page.data(), 0, 1); - MHD_add_response_header(resp, "Content-Type", "text/html"); - secure_queue_response(connection, status, resp); - MHD_destroy_response(resp); -} - -// convert all character to hex html entities -static std::string escape_html(std::string in) -{ - std::string out; - for(uint32_t i = 0; i < in.size(); i++) - { - char a = (in[i]&0xF0)>>4; - a = a < 10? a+'0': a-10+'A'; - char b = (in[i]&0x0F); - b = b < 10? b+'0': b-10+'A'; - out += std::string("&#x")+a+b+";"; - } - return out; -} - -ApiServerMHD::ApiServerMHD(ApiServer *server): - mConfigOk(false), mDaemon(0), mApiServer(server) -{ - memset(&mListenAddr, 0, sizeof(mListenAddr)); -} - -ApiServerMHD::~ApiServerMHD() -{ - stop(); -} - -bool ApiServerMHD::configure(std::string docroot, uint16_t port, std::string /*bind_address*/, bool allow_from_all) -{ - mRootDir = docroot; - // make sure the docroot dir ends with a slash - if(mRootDir.empty()) - mRootDir = "./"; - else if (mRootDir[mRootDir.size()-1] != '/' && mRootDir[mRootDir.size()-1] != '\\') - mRootDir += "/"; - - mListenAddr.sin_family = AF_INET; - mListenAddr.sin_port = htons(port); - - // untested - /* - if(!bind_address.empty()) - { - if(!inet_pton(AF_INET6, bind_address.c_str(), &mListenAddr.sin6_addr)) - { - std::cerr << "ApiServerMHD::configure() invalid bind address: \"" << bind_address << "\"" << std::endl; - return false; - } - } - else*/ if(allow_from_all) - { - mListenAddr.sin_addr.s_addr = htonl(INADDR_ANY); - std::cerr << "ApiServerMHD::configure(): will serve the webinterface to ALL IP adresses." << std::endl; - } - else - { - mListenAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - std::cerr << "ApiServerMHD::configure(): will serve the webinterface to LOCALHOST only." << std::endl; - } - - mConfigOk = true; - return true; -} - -bool ApiServerMHD::start() -{ - if(!mConfigOk) - { - std::cerr << "ApiServerMHD::start() ERROR: server not configured. You have to call configure() first." << std::endl; - return false; - } - if(mDaemon) - { - std::cerr << "ApiServerMHD::start() ERROR: server already started. You have to call stop() first." << std::endl; - return false; - } - mDaemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, 9999, // port will be overwritten by MHD_OPTION_SOCK_ADDR - &static_acceptPolicyCallback, this, - &static_accessHandlerCallback, this, - MHD_OPTION_NOTIFY_COMPLETED, &static_requestCompletedCallback, this, - MHD_OPTION_SOCK_ADDR, &mListenAddr, - MHD_OPTION_END); - if(mDaemon) - { - std::cerr << "ApiServerMHD::start() SUCCESS. Started server on port " << ntohs(mListenAddr.sin_port) << ". Serving files from \"" << mRootDir << "\" at " << STATIC_FILES_ENTRY_PATH << std::endl; - return true; - } - else - { - std::cerr << "ApiServerMHD::start() ERROR: starting the server failed. Maybe port " << ntohs(mListenAddr.sin_port) << " is already in use?" << std::endl; - return false; - } -} - -void ApiServerMHD::stop() -{ - if(mDaemon == 0) - return; - MHD_stop_daemon(mDaemon); - mDaemon = 0; -} - -int ApiServerMHD::static_acceptPolicyCallback(void *cls, const sockaddr *addr, socklen_t addrlen) -{ - return ((ApiServerMHD*)cls)->acceptPolicyCallback(addr, addrlen); -} - -int ApiServerMHD::static_accessHandlerCallback(void* cls, struct MHD_Connection * connection, - const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, - void **con_cls) -{ - return ((ApiServerMHD*)cls)->accessHandlerCallback(connection, url, method, version, - upload_data, upload_data_size, con_cls); -} - -void ApiServerMHD::static_requestCompletedCallback(void *cls, MHD_Connection* connection, - void **con_cls, MHD_RequestTerminationCode toe) -{ - ((ApiServerMHD*)cls)->requestCompletedCallback(connection, con_cls, toe); -} - - -int ApiServerMHD::acceptPolicyCallback(const sockaddr* /*addr*/, socklen_t /*addrlen*/) -{ - // accept all connetions - return MHD_YES; -} - -int ApiServerMHD::accessHandlerCallback(MHD_Connection *connection, - const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, - void **con_cls) -{ - // is this call a continuation for an existing request? - if(*con_cls) - { - return ((MHDHandlerBase*)(*con_cls))->handleRequest(connection, url, method, version, upload_data, upload_data_size); - } - - // these characters are not allowed in the url, raise an error if they occur - // reason: don't want to serve files outside the current document root - const char *double_dots = ".."; - if(strstr(url, double_dots)) - { - const char *error = "

Fatal error: found double dots (\"..\") in the url. This is not allowed

"; - struct MHD_Response* resp = MHD_create_response_from_data(strlen(error), (void*)error, 0, 1); - MHD_add_response_header(resp, "Content-Type", "text/html"); - secure_queue_response(connection, MHD_HTTP_INTERNAL_SERVER_ERROR, resp); - MHD_destroy_response(resp); - return MHD_YES; - } - - // if no path is given, redirect to index.html in static files directory - if(strlen(url) == 1 && url[0] == '/') - { - std::string location = std::string(STATIC_FILES_ENTRY_PATH) + "index.html"; - std::string errstr = "

Webinterface is at "+location+"

"; - const char *error = errstr.c_str(); - struct MHD_Response* resp = MHD_create_response_from_data(strlen(error), (void*)error, 0, 1); - MHD_add_response_header(resp, "Content-Type", "text/html"); - MHD_add_response_header(resp, "Location", location.c_str()); - secure_queue_response(connection, MHD_HTTP_FOUND, resp); - MHD_destroy_response(resp); - return MHD_YES; - } - // is it a call to the resource api? - if(strstr(url, API_ENTRY_PATH) == url) - { - // create a new handler and store it in con_cls - MHDHandlerBase* handler = new MHDApiHandler(mApiServer); - *con_cls = (void*) handler; - return handler->handleRequest(connection, url, method, version, upload_data, upload_data_size); - } - // is it a call to the filestreamer? - if(strstr(url, FILESTREAMER_ENTRY_PATH) == url) - { -#ifdef ENABLE_FILESTREAMER - // create a new handler and store it in con_cls - MHDHandlerBase* handler = new MHDFilestreamerHandler(); - *con_cls = (void*) handler; - return handler->handleRequest(connection, url, method, version, upload_data, upload_data_size); -#else - sendMessage(connection, MHD_HTTP_NOT_FOUND, "The filestreamer is not available, because this executable was compiled with a too old version of libmicrohttpd."); - return MHD_YES; -#endif - } - // is it a path to the static files? - if(strstr(url, STATIC_FILES_ENTRY_PATH) == url) - { - url = url + strlen(STATIC_FILES_ENTRY_PATH); - // else server static files - std::string filename = mRootDir + url; - // important: binary open mode (windows) - // else libmicrohttpd will replace crlf with lf and add garbage at the end of the file -#ifdef O_BINARY - int fd = open(filename.c_str(), O_RDONLY | O_BINARY); -#else - int fd = open(filename.c_str(), O_RDONLY); -#endif - if(fd == -1) - { - std::string direxists; - if(RsDirUtil::checkDirectory(mRootDir)) - direxists = "directory ""+mRootDir+"" exists"; - else - direxists = "directory ""+mRootDir+"" does not exist!"; - std::string msg = "

Error: can't open the requested file. path=""+escape_html(filename)+""

"+direxists+"

"; - sendMessage(connection, MHD_HTTP_NOT_FOUND, msg); - return MHD_YES; - } - - struct stat s; - if(fstat(fd, &s) == -1) - { - close(fd); - const char *error = "

Error: file was opened but stat failed.

"; - struct MHD_Response* resp = MHD_create_response_from_data(strlen(error), (void*)error, 0, 1); - MHD_add_response_header(resp, "Content-Type", "text/html"); - secure_queue_response(connection, MHD_HTTP_NOT_FOUND, resp); - MHD_destroy_response(resp); - return MHD_YES; - } - - // find the file extension and the content type - std::string extension; - int i = filename.size()-1; - while(i >= 0 && filename[i] != '.') - { - extension = filename[i] + extension; - i--; - }; - - struct MHD_Response* resp = MHD_create_response_from_fd(s.st_size, fd); - MHD_add_response_header(resp, "Content-Type", ContentTypes::cTypeFromExt(extension).c_str()); - secure_queue_response(connection, MHD_HTTP_OK, resp); - MHD_destroy_response(resp); - return MHD_YES; - } - - if(strstr(url, UPLOAD_ENTRY_PATH) == url) - { - // create a new handler and store it in con_cls - MHDHandlerBase* handler = new MHDUploadHandler(mApiServer); - *con_cls = (void*) handler; - return handler->handleRequest(connection, url, method, version, upload_data, upload_data_size); - } - - // if url is not a valid path, then serve a help page - sendMessage(connection, MHD_HTTP_NOT_FOUND, - "This address is invalid. Try one of the adresses below:
" - "
    " - "
  • /
    Retroshare webinterface
  • " - "
  • "+std::string(API_ENTRY_PATH)+"
    JSON over http api
  • " - "
  • "+std::string(FILESTREAMER_ENTRY_PATH)+"
    file streamer
  • " - "
  • "+std::string(STATIC_FILES_ENTRY_PATH)+"
    static files
  • " - "
" - ); - return MHD_YES; -} - -void ApiServerMHD::requestCompletedCallback(struct MHD_Connection */*connection*/, - void **con_cls, MHD_RequestTerminationCode /*toe*/) -{ - if(*con_cls) - { - delete (MHDHandlerBase*)(*con_cls); - } -} - -} // namespace resource_api diff --git a/libresapi/src/api/ApiServerMHD.h b/libresapi/src/api/ApiServerMHD.h deleted file mode 100644 index 8258e90ad..000000000 --- a/libresapi/src/api/ApiServerMHD.h +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiServerMHD.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include -#include -#include -#include -#include -#include - -#ifndef WINDOWS_SYS -#include -#endif - -namespace resource_api{ -class ApiServer; - -// returns the default docroot path -// (it is differen on different operating systems) -std::string getDefaultDocroot(); - -class ApiServerMHD -{ -public: - ApiServerMHD(ApiServer* server); - ~ApiServerMHD(); - /** - * @brief configure the http server - * @param docroot sets the directory from which static files should be served. default = ./ - * @param port the port to listen on. The server will listen on ipv4 and ipv6. - * @param bind_address NOT IMPLEMENTED optional, specifies an ipv6 adress to listen on. - * @param allow_from_all when true, listen on all ips. (only when bind_adress is empty) - * @return true on success - */ - bool configure(std::string docroot, uint16_t port, std::string bind_address, bool allow_from_all); - bool start(); - void stop(); - -private: - // static callbacks for libmicrohttpd, they call the members below - static int static_acceptPolicyCallback(void* cls, const struct sockaddr * addr, socklen_t addrlen); - static int static_accessHandlerCallback(void* cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls); - static void static_requestCompletedCallback(void *cls, struct MHD_Connection* connection, void **con_cls, enum MHD_RequestTerminationCode toe); - int acceptPolicyCallback(const struct sockaddr * addr, socklen_t addrlen); - int accessHandlerCallback(struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls); - void requestCompletedCallback(struct MHD_Connection *connection, void **con_cls, MHD_RequestTerminationCode toe); - bool mConfigOk; - std::string mRootDir; - struct sockaddr_in mListenAddr; - MHD_Daemon* mDaemon; - ApiServer* mApiServer; -}; - -} // namespace resource_api diff --git a/libresapi/src/api/ApiTypes.h b/libresapi/src/api/ApiTypes.h deleted file mode 100644 index ba171f9be..000000000 --- a/libresapi/src/api/ApiTypes.h +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - * libresapi/api/ApiTypes.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include -#include -#include -#include -#include - -#include "util/rsdeprecate.h" - -namespace resource_api -{ -// things to clean up: -// - temporary variables when serialising rs-ids -// - always ensure proper return values -// - add help functions -// - remove unused functions or implement them -// - add operators or functions for std::set, std::list, std::vector, std::map - - -// idea: -// make a second parameter like -// ValueReference(this->member, OPTIONAL); // optional signals that it is not an error if this member is missing -// make a third parameter with a type hint: time, length, kilobytes - -// to make arrays -template -class ValueReference -{ -public: - ValueReference(T& value): value(value){} - T& value; -}; - -template -ValueReference makeValueReference(T& value); - -template -class Value -{ -public: - Value(T value): value(value){} - operator ValueReference(){ return ValueReference(value);} - T value; -}; - -template -Value makeValue(T value); - -// to make objects -template -class KeyValueReference -{ -public: - KeyValueReference(std::string key, T& value): key(key), value(value){} - //KeyValueReference(const char* key, T& value): key(key), value(value){} - std::string key; - T& value; -}; - -template -KeyValueReference makeKeyValueReference(std::string key, T& value); - -// for serialisation -// copies the supplied value -// automatically converts itself to a KeyValueReference -template -class KeyValue -{ -public: - KeyValue(std::string key, T value): key(key), value(value){} - - operator KeyValueReference(){ return KeyValueReference(key, value);} - - std::string key; - T value; -}; - -template -KeyValue makeKeyValue(std::string key, T value); - -// interface for streams -class StreamBase -{ -public: - // the stream provides operators for basic data types - // everything else should be broken down by others - // the same stream can either become an object or an array stream, or a binary data object - // a binary data object is just raw binary data without any decoration - // binary data is good to pass things like images and small files - // this depends on how this stream is used - // but once the stream is used as array, then only array operations are allowed - // same with an stream used as object - - // idea: can have filter streams which forward the calls to another stream - // to make debug protocols of other steam implementations - // idea: make a stream shich creates a hash from the input to detect changes in the data - - // make an array - virtual StreamBase& operator<<(ValueReference value) = 0; - virtual StreamBase& operator<<(ValueReference value) = 0; - virtual StreamBase& operator<<(ValueReference value) = 0; - virtual StreamBase& operator<<(ValueReference value) = 0; - // usefull if the new array member should be an array or object - // the reference should be at least valid until another method of this class gets called - virtual StreamBase& getStreamToMember() = 0; - - // make an object - virtual StreamBase& operator<<(KeyValueReference keyValue) = 0; - virtual StreamBase& operator<<(KeyValueReference keyValue) = 0; - virtual StreamBase& operator<<(KeyValueReference keyValue) = 0; - virtual StreamBase& operator<<(KeyValueReference keyValue) = 0; - // usefull if the new object member should be an array or object - // the reference should be at least valid until another method of this class gets called - virtual StreamBase& getStreamToMember(std::string name) = 0; - - // make a binay data object (not a real object, just binary data) - // idea: can use vector.swap() to allow passing larger data items without copying - virtual StreamBase& operator<<(std::vector& data) = 0; - - // return true if there are more members in this object/array - // useful for array reading - virtual bool hasMore() = 0; - - virtual bool serialise() = 0; // let external operators find out they should serialise or deserialise - // return true if no serialisation/deserialisation error occoured - virtual bool isOK() = 0; - virtual void setError() = 0; // let external operators set the failed bit - //virtual void addLogMsg(std::string msg) = 0; - virtual void addErrorMsg(std::string msg) = 0; - virtual std::string getLog() = 0; - virtual std::string getErrorLog() = 0; - - virtual bool isRawData() = 0; - virtual std::string getRawData() = 0;// HACK, remove this -}; - -// todo: -// define clear rules how a response to a request should look like -// the clients should be able to know when something failed -// then it is desired to have a minimum of debug output to track the errors down -// currently no check for successful serialisation/deserialisation is performed -// -// response metadata: -// - etag, when will this result expire -// - maybe a hint how often this etag should be checked for updates -// -// outcome of a request: -// - full ok -// - partial ok -// - resource not found, invalid address or resource not available -// - not ok, internal error -// - wrong usage, parameters or POST data is wrong, like deserialisation error -// is is hard to find the cause of the error -// maybe include a comment with additional info -// -// want to include a mime type of the resulting data? -// because some data is json, othe plain text, other unknown binary stuff - -// live-stream resources -// some resources like typing notifications are only valid for a short time - -// resource types: -// - list, either with objects or adresses of objects. -// lists need a navigation mechanism like get objects before and get objects after -// - object -// - stream -// - binary data, for example files - -// TODO: record a timestamp for each token, to allow garbage collection of very old tokens -class StateToken{ -public: - StateToken(): value(0){} - StateToken(uint32_t value): value(value){} - std::string toString(); - - uint32_t getValue() const {return value;} - bool isNull() const {return value == 0;} -private: - uint32_t value; // 0 is reserved for invalid token -}; - -class Request -{ -public: - Request(StreamBase& stream) : mStream(stream), mMethod(GET){} - - RS_DEPRECATED bool isGet(){ return mMethod == GET;} - RS_DEPRECATED bool isPut(){ return mMethod == PUT;} - RS_DEPRECATED bool isDelete(){ return mMethod == DELETE_AA;} - RS_DEPRECATED bool isExec(){ return mMethod == EXEC;} - - /** - * Path is the adress to the resource if the path has multiple parts which - * get handled by different handlers, then each handler should pop the top - * element - */ - std::stack mPath; - std::string mFullPath; - bool setPath(const std::string &reqPath) - { - std::string str; - std::string::const_reverse_iterator sit; - for( sit = reqPath.rbegin(); sit != reqPath.rend(); ++sit ) - { - // add to front because we are traveling in reverse order - if((*sit) != '/') str = *sit + str; - else if(!str.empty()) - { - mPath.push(str); - str.clear(); - } - } - if(!str.empty()) mPath.push(str); - mFullPath = reqPath; - - return true; - } - - /// Contains data for new resources - StreamBase& mStream; - - /** - * @deprecated - * Method and derivated stuff usage is deprecated as it make implementation - * more complex and less readable without advantage - */ - enum Method { GET, PUT, DELETE_AA, EXEC}; - RS_DEPRECATED Method mMethod; -}; - -// new notes on responses -// later we want to send multiple requests over the same link -// and we want to be able to send the responses in a different order than the requests -// for this we need a unique token in every request which gets returned in the response - -// response: -// message token -// status (ok, warning, fail) -// data (different for different resources) -// debugstring (a human readable error message in case something went wrong) - -class Response -{ -public: - Response(StreamBase& stream, std::ostream& debug): mReturnCode(NOT_SET), mDataStream(stream), mDebug(debug){} - - // WARNING means: a valid result is available, but an error occoured - // FAIL means: the result is not valid - enum ReturnCode{ NOT_SET, OK, WARNING, FAIL}; - ReturnCode mReturnCode; - - StateToken mStateToken; - - //Just for GUI benefit - std::string mCallbackName; - - // the result - StreamBase& mDataStream; - - // humand readable string for debug messages/logging - std::ostream& mDebug; - - inline void setOk(){mReturnCode = OK;} - inline void setWarning(std::string msg = ""){ - mReturnCode = WARNING; - if(msg != "") - mDebug << msg << std::endl;} - inline void setFail(std::string msg = ""){ - mReturnCode = FAIL; - if(msg != "") - mDebug << msg << std::endl; - } -}; - -// if a response can not be handled immediately, -// then the handler should return a ResponseTask object -// the api server will then call the doWork() method periodically -class ResponseTask -{ -public: - virtual ~ResponseTask(){} - // return true if function should get called again - // return false when finished - virtual bool doWork(Request& req, Response& resp) = 0; -}; - -// implementations - -template -ValueReference makeValueReference(T& value) -{ - return ValueReference(value); -} - -template -Value makeValue(T value) -{ - return Value(value); -} - -template -KeyValueReference makeKeyValueReference(std::string key, T& value) -{ - return KeyValueReference(key, value); -} - -template -KeyValue makeKeyValue(std::string key, T value) -{ - return KeyValue(key, value); -} - -} // namespace resource_api diff --git a/libresapi/src/api/ChannelsHandler.cpp b/libresapi/src/api/ChannelsHandler.cpp deleted file mode 100644 index 01000f7d0..000000000 --- a/libresapi/src/api/ChannelsHandler.cpp +++ /dev/null @@ -1,540 +0,0 @@ -/******************************************************************************* - * libresapi/api/ChannelsHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ - -#include "ChannelsHandler.h" - -#include -#include -#include -#include -#include - -#include "Operators.h" - -namespace resource_api -{ - -StreamBase& operator << (StreamBase& left, RsGxsFile& file) -{ - left << makeKeyValueReference("name", file.mName) - << makeKeyValueReference("hash", file.mHash); - if(left.serialise()) - { - double size = file.mSize; - left << makeKeyValueReference("size", size); - } - else - { - double size = 0; - left << makeKeyValueReference("size", size); - file.mSize = size; - } - return left; -} - -ChannelsHandler::ChannelsHandler(RsGxsChannels& channels): mChannels(channels) -{ - addResourceHandler("list_channels", this, - &ChannelsHandler::handleListChannels); - addResourceHandler("get_channel_info", this, &ChannelsHandler::handleGetChannelInfo); - addResourceHandler("get_channel_content", this, &ChannelsHandler::handleGetChannelContent); - addResourceHandler("toggle_subscribe", this, &ChannelsHandler::handleToggleSubscription); - addResourceHandler("toggle_auto_download", this, &ChannelsHandler::handleToggleAutoDownload); - addResourceHandler("toggle_read", this, &ChannelsHandler::handleTogglePostRead); - addResourceHandler("create_channel", this, &ChannelsHandler::handleCreateChannel); - addResourceHandler("create_post", this, &ChannelsHandler::handleCreatePost); -} - -void ChannelsHandler::handleListChannels(Request& /*req*/, Response& resp) -{ - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; - uint32_t token; - - RsTokenService& tChannels = *mChannels.getTokenService(); - - tChannels.requestGroupInfo(token, RS_DEPRECATED_TOKREQ_ANSTYPE, opts); - - time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - - std::list grps; - if( tChannels.requestStatus(token) == RsTokenService::COMPLETE - && mChannels.getGroupSummary(token, grps) ) - { - for( RsGroupMetaData& grp : grps ) - { - KeyValueReference id("channel_id", grp.mGroupId); - KeyValueReference vis_msg("visible_msg_count", grp.mVisibleMsgCount); - bool own = (grp.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN); - bool subscribed = IS_GROUP_SUBSCRIBED(grp.mSubscribeFlags); - std::string lastPostTsStr = std::to_string(grp.mLastPost); - std::string publishTsStr = std::to_string(grp.mPublishTs); - resp.mDataStream.getStreamToMember() - << id - << makeKeyValueReference("name", grp.mGroupName) - << makeKeyValueReference("last_post_ts", lastPostTsStr) - << makeKeyValueReference("popularity", grp.mPop) - << makeKeyValueReference("publish_ts", publishTsStr) - << vis_msg - << makeKeyValueReference("group_status", grp.mGroupStatus) - << makeKeyValueReference("author_id", grp.mAuthorId) - << makeKeyValueReference("parent_grp_id", grp.mParentGrpId) - << makeKeyValueReference("own", own) - << makeKeyValueReference("subscribed", subscribed); - } - - resp.setOk(); - } - else resp.setFail("Cant get data from GXS!"); -} - -void ChannelsHandler::handleGetChannelInfo(Request& req, Response& resp) -{ - std::string chanIdStr; - req.mStream << makeKeyValueReference("channel_id", chanIdStr); - if(chanIdStr.empty()) - { - resp.setFail("channel_id required!"); - return; - } - - RsGxsGroupId chanId(chanIdStr); - if(chanId.isNull()) - { - resp.setFail("Invalid channel_id:" + chanIdStr); - return; - } - - bool wantThumbnail = true; - req.mStream << makeKeyValueReference("want_thumbnail", wantThumbnail); - - std::list groupIds; groupIds.push_back(chanId); - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - uint32_t token; - - RsTokenService& tChannels = *mChannels.getTokenService(); - tChannels.requestGroupInfo( token, RS_DEPRECATED_TOKREQ_ANSTYPE, - opts, groupIds ); - - time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - - std::vector grps; - if( tChannels.requestStatus(token) == RsTokenService::COMPLETE - && mChannels.getGroupData(token, grps) ) - { - for( RsGxsChannelGroup& grp : grps ) - { - KeyValueReference id("channel_id", grp.mMeta.mGroupId); - KeyValueReference vis_msg("visible_msg_count", grp.mMeta.mVisibleMsgCount); - bool own = (grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN); - bool subscribed = IS_GROUP_SUBSCRIBED(grp.mMeta.mSubscribeFlags); - std::string lastPostTsStr = std::to_string(grp.mMeta.mLastPost); - std::string publishTsStr = std::to_string(grp.mMeta.mPublishTs); - StreamBase& rgrp(resp.mDataStream.getStreamToMember()); - rgrp << id - << makeKeyValueReference("name", grp.mMeta.mGroupName) - << makeKeyValueReference("last_post_ts", lastPostTsStr) - << makeKeyValueReference("popularity", grp.mMeta.mPop) - << makeKeyValueReference("publish_ts", publishTsStr) - << vis_msg - << makeKeyValueReference("group_status", grp.mMeta.mGroupStatus) - << makeKeyValueReference("author_id", grp.mMeta.mAuthorId) - << makeKeyValueReference("parent_grp_id", grp.mMeta.mParentGrpId) - << makeKeyValueReference("description", grp.mDescription) - << makeKeyValueReference("own", own) - << makeKeyValueReference("subscribed", subscribed) - << makeKeyValueReference("auto_download", grp.mAutoDownload); - - if(wantThumbnail) - { - std::string thumbnail_base64; - Radix64::encode(grp.mImage.mData, grp.mImage.mSize, thumbnail_base64); - rgrp << makeKeyValueReference("thumbnail_base64_png", thumbnail_base64); - } - } - - resp.setOk(); - } - else resp.setFail("Cant get data from GXS!"); -} - -void ChannelsHandler::handleGetChannelContent(Request& req, Response& resp) -{ - std::string chanIdStr; - req.mStream << makeKeyValueReference("channel_id", chanIdStr); - if(chanIdStr.empty()) - { - resp.setFail("channel_id required!"); - return; - } - - RsGxsGroupId chanId(chanIdStr); - if(chanId.isNull()) - { - resp.setFail("Invalid channel_id:" + chanIdStr); - return; - } - - std::list groupIds; groupIds.push_back(chanId); - uint32_t token; - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; - - if(! mChannels.getTokenService()-> - requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds) ) - { - resp.setFail("Unknown GXS error!"); - return; - } - - time_t start = time(NULL); - while((mChannels.getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) - &&(mChannels.getTokenService()->requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - - std::vector posts; - std::vector comments; - if( mChannels.getTokenService()->requestStatus(token) == - RsTokenService::COMPLETE && - mChannels.getPostData(token, posts, comments) ) - { - for( std::vector::iterator vit = posts.begin(); - vit != posts.end(); ++vit ) - { - RsGxsChannelPost& post = *vit; - RsMsgMetaData& pMeta = post.mMeta; - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("channel_id", pMeta.mGroupId) - << makeKeyValueReference("name", pMeta.mMsgName) - << makeKeyValueReference("post_id", pMeta.mMsgId) - << makeKeyValueReference("parent_id", pMeta.mParentId) - << makeKeyValueReference("author_id", pMeta.mAuthorId) - << makeKeyValueReference("orig_msg_id", pMeta.mOrigMsgId) - << makeKeyValueReference("thread_id", pMeta.mThreadId) - << makeKeyValueReference("message", post.mMsg); - } - - for( std::vector::iterator vit = comments.begin(); - vit != comments.end(); ++vit ) - { - RsGxsComment& comment = *vit; - RsMsgMetaData& cMeta = comment.mMeta; - std::string scoreStr = std::to_string(comment.mScore); - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("channel_id", cMeta.mGroupId) - << makeKeyValueReference("name", cMeta.mMsgName) - << makeKeyValueReference("comment_id", cMeta.mMsgId) - << makeKeyValueReference("parent_id", cMeta.mParentId) - << makeKeyValueReference("author_id", cMeta.mAuthorId) - << makeKeyValueReference("orig_msg_id", cMeta.mOrigMsgId) - << makeKeyValueReference("thread_id", cMeta.mThreadId) - << makeKeyValueReference("score", scoreStr) - << makeKeyValueReference("message", comment.mComment); - } - - resp.setOk(); - } - else resp.setFail("Cant get data from GXS!"); -} - -void ChannelsHandler::handleToggleSubscription(Request& req, Response& resp) -{ - std::string chanIdStr; - bool subscribe = true; - - req.mStream << makeKeyValueReference("channel_id", chanIdStr) - << makeKeyValueReference("subscribe", subscribe); - - if(chanIdStr.empty()) - { - resp.setFail("channel_id required!"); - return; - } - - RsGxsGroupId chanId(chanIdStr); - if(chanId.isNull()) - { - resp.setFail("Invalid channel_id:" + chanIdStr); - return; - } - - uint32_t token; - if(mChannels.subscribeToGroup(token, chanId, subscribe)) - { - RsTokenService& tChannels = *mChannels.getTokenService(); - - time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - - if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) - resp.setOk(); - else resp.setFail("Unknown GXS error!"); - } - else resp.setFail("Unknown GXS error!"); -} - -void ChannelsHandler::handleCreateChannel(Request& req, Response& resp) -{ - RsGxsChannelGroup chan; - RsGroupMetaData& cMeta = chan.mMeta; - std::string authorIdStr; - std::string thumbnail_base64; - - req.mStream << makeKeyValueReference("author_id", authorIdStr) - << makeKeyValueReference("name", cMeta.mGroupName) - << makeKeyValueReference("description", chan.mDescription) - << makeKeyValueReference("thumbnail_base64_png", thumbnail_base64); - - if(cMeta.mGroupName.empty()) - { - resp.setFail("Channel name required!"); - return; - } - - if(thumbnail_base64.empty()) chan.mImage.clear(); - else - { - std::vector png_data = Radix64::decode(thumbnail_base64); - if(!png_data.empty()) - { - if(png_data.size() < 8) - { - resp.setFail("Decoded thumbnail_base64_png is smaller than 8 byte. This can't be a valid png file!"); - return; - } - uint8_t png_magic_number[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a}; - if(!std::equal(&png_magic_number[0],&png_magic_number[8],png_data.begin())) - { - resp.setFail("Decoded thumbnail_base64_png does not seem to be a png file. (Header is missing magic number)"); - return; - } - chan.mImage.copy(png_data.data(), png_data.size()); - } - } - - if(!authorIdStr.empty()) cMeta.mAuthorId = RsGxsId(authorIdStr); - - // ATM supports creating only public channels - cMeta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_PUBLIC; - - // I am not sure about those flags I have reversed them with the debugger - // that gives 520 as value of this member when a channel with default - // options is created from Qt Gui - cMeta.mSignFlags = GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN | - GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED; - - uint32_t token; - if(mChannels.createGroup(token, chan)) - { - RsTokenService& tChannels = *mChannels.getTokenService(); - - time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - - if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) - resp.setOk(); - else resp.setFail("Unknown GXS error!"); - } - else resp.setFail("Unkown GXS error!"); -} - -void ChannelsHandler::handleToggleAutoDownload(Request& req, Response& resp) -{ - - std::string chanIdStr; - bool autoDownload = true; - - req.mStream << makeKeyValueReference("channel_id", chanIdStr) - << makeKeyValueReference("auto_download", autoDownload); - - if(chanIdStr.empty()) - { - resp.setFail("channel_id required!"); - return; - } - - RsGxsGroupId chanId(chanIdStr); - if(chanId.isNull()) - { - resp.setFail("Invalid channel_id:" + chanIdStr); - return; - } - - if(mChannels.setChannelAutoDownload(chanId, autoDownload)) - resp.setOk(); - else resp.setFail(); -} - -void ChannelsHandler::handleTogglePostRead(Request& req, Response& resp) -{ - std::string chanIdStr; - std::string postIdStr; - bool read = true; - - req.mStream << makeKeyValueReference("channel_id", chanIdStr) - << makeKeyValueReference("post_id", postIdStr) - << makeKeyValueReference("read", read); - - if(chanIdStr.empty()) - { - resp.setFail("channel_id required!"); - return; - } - - RsGxsGroupId chanId(chanIdStr); - if(chanId.isNull()) - { - resp.setFail("Invalid channel_id:" + chanIdStr); - return; - } - - if(postIdStr.empty()) - { - resp.setFail("post_id required!"); - return; - } - - RsGxsMessageId postId(postIdStr); - if(postId.isNull()) - { - resp.setFail("Invalid post_id:" + postIdStr); - return; - } - - std::cerr << __PRETTY_FUNCTION__ << " " << chanIdStr << " " << postIdStr - << " " << read << std::endl; - - uint32_t token; - mChannels.setMessageReadStatus(token, std::make_pair(chanId,postId), read); - - RsTokenService& tChannels = *mChannels.getTokenService(); - - time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - - if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) - resp.setOk(); - else resp.setFail("Unknown GXS error!"); -} - -void ChannelsHandler::handleCreatePost(Request &req, Response &resp) -{ - RsGxsChannelPost post; - - req.mStream << makeKeyValueReference("channel_id", post.mMeta.mGroupId); - req.mStream << makeKeyValueReference("subject", post.mMeta.mMsgName); - req.mStream << makeKeyValueReference("message", post.mMsg); - - StreamBase& file_array = req.mStream.getStreamToMember("files"); - while(file_array.hasMore()) - { - RsGxsFile file; - file_array.getStreamToMember() << file; - post.mFiles.push_back(file); - } - - std::string thumbnail_base64; - req.mStream << makeKeyValueReference("thumbnail_base64_png", thumbnail_base64); - - if(post.mMeta.mGroupId.isNull()) - { - resp.setFail("groupd_id is null"); - return; - } - if(post.mMeta.mMsgName.empty()) - { - resp.setFail("subject is empty"); - return; - } - if(post.mMsg.empty()) - { - resp.setFail("msg text is empty"); - return; - } - // empty file list is ok, but files have to be valid - for(std::list::iterator lit = post.mFiles.begin(); lit != post.mFiles.end(); ++lit) - { - if(lit->mHash.isNull()) - { - resp.setFail("at least one file hash is empty"); - return; - } - if(lit->mName.empty()) - { - resp.setFail("at leats one file name is empty"); - return; - } - if(lit->mSize == 0) - { - resp.setFail("at least one file size is empty"); - return; - } - } - - std::vector png_data = Radix64::decode(thumbnail_base64); - if(!png_data.empty()) - { - if(png_data.size() < 8) - { - resp.setFail("Decoded thumbnail_base64_png is smaller than 8 byte. This can't be a valid png file!"); - return; - } - uint8_t png_magic_number[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a}; - if(!std::equal(&png_magic_number[0],&png_magic_number[8],png_data.begin())) - { - resp.setFail("Decoded thumbnail_base64_png does not seem to be a png file. (Header is missing magic number)"); - return; - } - post.mThumbnail.copy(png_data.data(), png_data.size()); - } - - uint32_t token; - if(mChannels.createPost(token, post)) - { - RsTokenService& tChannels = *mChannels.getTokenService(); - - time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - - if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) - resp.setOk(); - else resp.setFail("Unknown GXS error!"); - } - else resp.setFail("Unknown GXS error!"); -} - -} // namespace resource_api diff --git a/libresapi/src/api/ChannelsHandler.h b/libresapi/src/api/ChannelsHandler.h deleted file mode 100644 index 3a731e321..000000000 --- a/libresapi/src/api/ChannelsHandler.h +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * libresapi/api/ChannelsHandler.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include "ResourceRouter.h" - -class RsGxsChannels; - -namespace resource_api -{ - -struct ChannelsHandler : ResourceRouter -{ - ChannelsHandler(RsGxsChannels& channels); - -private: - void handleListChannels(Request& req, Response& resp); - void handleGetChannelInfo(Request& req, Response& resp); - void handleGetChannelContent(Request& req, Response& resp); - void handleToggleSubscription(Request& req, Response& resp); - void handleCreateChannel(Request& req, Response& resp); - void handleToggleAutoDownload(Request& req, Response& resp); - void handleTogglePostRead(Request& req, Response& resp); - void handleCreatePost(Request& req, Response& resp); - - RsGxsChannels& mChannels; -}; - -} // namespace resource_api diff --git a/libresapi/src/api/ChatHandler.cpp b/libresapi/src/api/ChatHandler.cpp deleted file mode 100644 index a266a8540..000000000 --- a/libresapi/src/api/ChatHandler.cpp +++ /dev/null @@ -1,1491 +0,0 @@ -/******************************************************************************* - * libresapi/api/ChatHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2015 by electron128 * - * Copyright 2017 by Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ - -#include "ChatHandler.h" -#include "Pagination.h" -#include "Operators.h" -#include "GxsResponseTask.h" - -#include -#include -#include - -#include -#include -#include -#include - -namespace resource_api -{ - -std::string id(const ChatHandler::Msg& m) -{ - std::stringstream ss; - ss << m.id; - return ss.str(); -} - -StreamBase& operator << (StreamBase& left, ChatHandler::Msg& m) -{ - left << makeKeyValueReference("incoming", m.incoming) - << makeKeyValueReference("was_send", m.was_send) - << makeKeyValueReference("read", m.read) - << makeKeyValueReference("author_id", m.author_id) - << makeKeyValueReference("author_name", m.author_name) - << makeKeyValueReference("msg", m.msg) - << makeKeyValueReference("recv_time", m.recv_time) - << makeKeyValueReference("send_time", m.send_time) - << makeKeyValueReference("id", m.id); - StreamBase& ls = left.getStreamToMember("links"); - ls.getStreamToMember(); - for(std::vector::iterator vit = m.links.begin(); vit != m.links.end(); ++vit) - { - ls.getStreamToMember() << makeKeyValueReference("first", vit->first) - << makeKeyValueReference("second", vit->second) - << makeKeyValueReference("third", vit->third); - } - return left; -} - -bool compare_lobby_id(const ChatHandler::Lobby& l1, const ChatHandler::Lobby& l2) -{ - if(l1.auto_subscribe && !l2.auto_subscribe) return true; - if(!l1.auto_subscribe && l2.auto_subscribe) return false; - if(l1.is_private && !l2.is_private) return true; - if(!l1.is_private && l2.is_private) return false; - if(l1.subscribed && !l2.subscribed) return true; - if(!l1.subscribed && l2.subscribed) return false; - return l1.id < l2.id; -} - -StreamBase& operator <<(StreamBase& left, KeyValueReference kv) -{ - if(left.serialise()) - { - std::stringstream ss; - ss << kv.value; - left << makeKeyValue(kv.key, ss.str()); - } - else - { - std::string val; - left << makeKeyValueReference(kv.key, val); - std::stringstream ss(val); - ss >> kv.value; - } - return left; -} - -StreamBase& operator << (StreamBase& left, ChatHandler::Lobby& l) -{ - ChatId chatId(l.id); - if (l.is_broadcast) - chatId = ChatId::makeBroadcastId(); - left << makeKeyValueReference("id", l.id) - << makeKeyValue("chat_id", chatId.toStdString()) - << makeKeyValueReference("name",l.name) - << makeKeyValueReference("topic", l.topic) - << makeKeyValueReference("subscribed", l.subscribed) - << makeKeyValueReference("auto_subscribe", l.auto_subscribe) - << makeKeyValueReference("is_private", l.is_private) - << makeKeyValueReference("is_broadcast", l.is_broadcast) - << makeKeyValueReference("gxs_id", l.gxs_id); - return left; -} - -StreamBase& operator << (StreamBase& left, ChatHandler::ChatInfo& info) -{ - left << makeKeyValueReference("remote_author_id", info.remote_author_id) - << makeKeyValueReference("remote_author_name", info.remote_author_name) - << makeKeyValueReference("own_author_id", info.own_author_id) - << makeKeyValueReference("own_author_name", info.own_author_name) - << makeKeyValueReference("is_broadcast", info.is_broadcast) - << makeKeyValueReference("is_distant_chat_id", info.is_distant_chat_id) - << makeKeyValueReference("is_lobby", info.is_lobby) - << makeKeyValueReference("is_peer", info.is_peer); - return left; -} - -class SendLobbyParticipantsTask: public GxsResponseTask -{ -public: - SendLobbyParticipantsTask(RsIdentity* idservice, ChatHandler::LobbyParticipantsInfo pi): - GxsResponseTask(idservice, 0), mParticipantsInfo(pi) - { - const auto& map = mParticipantsInfo.participants; - for(auto mit = map.begin(); mit != map.end(); ++mit) - { - requestGxsId(mit->first); - } - } -private: - ChatHandler::LobbyParticipantsInfo mParticipantsInfo; -protected: - virtual void gxsDoWork(Request &/*req*/, Response &resp) - { - resp.mDataStream.getStreamToMember(); - const auto& map = mParticipantsInfo.participants; - for(auto mit = map.begin(); mit != map.end(); ++mit) - { - StreamBase& stream = resp.mDataStream.getStreamToMember(); - double last_active = mit->second; - stream << makeKeyValueReference("last_active", last_active); - streamGxsId(mit->first, stream.getStreamToMember("identity")); - } - resp.mStateToken = mParticipantsInfo.state_token; - resp.setOk(); - done(); - } - -}; - -ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs, RsPeers* peers, RsIdentity* identity, UnreadMsgNotify* unread): - mStateTokenServer(sts), mNotify(notify), mRsMsgs(msgs), mRsPeers(peers), mRsIdentity(identity), mUnreadMsgNotify(unread), mMtx("ChatHandler::mMtx") -{ - mNotify->registerNotifyClient(this); - mStateTokenServer->registerTickClient(this); - - mMsgStateToken = mStateTokenServer->getNewToken(); - mLobbiesStateToken = mStateTokenServer->getNewToken(); - mUnreadMsgsStateToken = mStateTokenServer->getNewToken(); - mInvitationsStateToken = mStateTokenServer->getNewToken(); - - addResourceHandler("*", this, &ChatHandler::handleWildcard); - addResourceHandler("lobbies", this, &ChatHandler::handleLobbies); - addResourceHandler("create_lobby", this, &ChatHandler::handleCreateLobby); - addResourceHandler("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby); - addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby); - addResourceHandler("autosubscribe_lobby", this, &ChatHandler::handleAutoSubsribeLobby); - addResourceHandler("clear_lobby", this, &ChatHandler::handleClearLobby); - addResourceHandler("invite_to_lobby", this, &ChatHandler::handleInviteToLobby); - addResourceHandler("get_invitations_to_lobby", this, &ChatHandler::handleGetInvitationsToLobby); - addResourceHandler("answer_to_invitation", this, &ChatHandler::handleAnswerToInvitation); - addResourceHandler("lobby_participants", this, &ChatHandler::handleLobbyParticipants); - addResourceHandler("get_default_identity_for_chat_lobby", this, &ChatHandler::handleGetDefaultIdentityForChatLobby); - addResourceHandler("set_default_identity_for_chat_lobby", this, &ChatHandler::handleSetDefaultIdentityForChatLobby); - addResourceHandler("get_identity_for_chat_lobby", this, &ChatHandler::handleGetIdentityForChatLobby); - addResourceHandler("set_identity_for_chat_lobby", this, &ChatHandler::handleSetIdentityForChatLobby); - addResourceHandler("messages", this, &ChatHandler::handleMessages); - addResourceHandler("send_message", this, &ChatHandler::handleSendMessage); - addResourceHandler("mark_message_as_read", this, &ChatHandler::handleMarkMessageAsRead); - addResourceHandler("mark_chat_as_read", this, &ChatHandler::handleMarkChatAsRead); - addResourceHandler("info", this, &ChatHandler::handleInfo); - addResourceHandler("receive_status", this, &ChatHandler::handleReceiveStatus); - addResourceHandler("send_status", this, &ChatHandler::handleSendStatus); - addResourceHandler("unread_msgs", this, &ChatHandler::handleUnreadMsgs); - addResourceHandler("initiate_distant_chat", this, &ChatHandler::handleInitiateDistantChatConnexion); - addResourceHandler("distant_chat_status", this, &ChatHandler::handleDistantChatStatus); - addResourceHandler("close_distant_chat", this, &ChatHandler::handleCloseDistantChatConnexion); -} - -ChatHandler::~ChatHandler() -{ - mNotify->unregisterNotifyClient(this); - mStateTokenServer->unregisterTickClient(this); -} - -void ChatHandler::notifyChatMessage(const ChatMessage &msg) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - mRawMsgs.push_back(msg); -} - -void ChatHandler::notifyChatCleared(const ChatId &chat_id) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - //Remove processed messages - std::list& msgs = mMsgs[chat_id]; - msgs.clear(); - //Remove unprocessed messages - for(std::list::iterator lit = mRawMsgs.begin(); lit != mRawMsgs.end();) - { - ChatMessage& msg = *lit; - if (msg.chat_id == chat_id) - { - lit = mRawMsgs.erase(lit); - } else { - ++lit; - } - } -} - -void ChatHandler::notifyChatStatus(const ChatId &chat_id, const std::string &status) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - locked_storeTypingInfo(chat_id, status); -} - -void ChatHandler::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type, - const RsGxsId &nickname, const std::string& any_string) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - if(event_type == RS_CHAT_LOBBY_EVENT_PEER_STATUS) - { - locked_storeTypingInfo(ChatId(lobby_id), any_string, nickname); - } -} - -void ChatHandler::notifyListChange(int list, int /*type*/) -{ - if(list == NOTIFY_LIST_CHAT_LOBBY_INVITATION) - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - mStateTokenServer->replaceToken(mInvitationsStateToken); - } -} - -void ChatHandler::tick() -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - - // first fetch lobbies - std::vector lobbies; - std::list subscribed_ids; - mRsMsgs->getChatLobbyList(subscribed_ids); - for(std::list::iterator lit = subscribed_ids.begin(); lit != subscribed_ids.end(); ++lit) - { - ChatLobbyInfo info; - if(mRsMsgs->getChatLobbyInfo(*lit,info)) - { - Lobby l; - l.id = *lit; - l.name = info.lobby_name; - l.topic = info.lobby_topic; - l.subscribed = true; - l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE; - l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC); - l.is_broadcast = false; - l.gxs_id = info.gxs_id; - lobbies.push_back(l); - - // update the lobby participants list - // maybe it causes to much traffic to do this in every tick, - // because the client would get the whole list every time a message was received - // we could reduce the checking frequency - std::map::iterator mit = mLobbyParticipantsInfos.find(*lit); - if(mit == mLobbyParticipantsInfos.end()) - { - mLobbyParticipantsInfos[*lit].participants = info.gxs_ids; - mLobbyParticipantsInfos[*lit].state_token = mStateTokenServer->getNewToken(); - } - else - { - LobbyParticipantsInfo& pi = mit->second; - if(!std::equal(pi.participants.begin(), pi.participants.end(), info.gxs_ids.begin()) - || pi.participants.size() != info.gxs_ids.size()) - { - pi.participants = info.gxs_ids; - mStateTokenServer->replaceToken(pi.state_token); - } - } - } - } - - // remove participants info of old lobbies - std::vector participants_info_to_delete; - for(std::map::iterator mit = mLobbyParticipantsInfos.begin(); - mit != mLobbyParticipantsInfos.end(); ++mit) - { - if(std::find(subscribed_ids.begin(), subscribed_ids.end(), mit->first) == subscribed_ids.end()) - { - participants_info_to_delete.push_back(mit->first); - } - } - for(std::vector::iterator vit = participants_info_to_delete.begin(); vit != participants_info_to_delete.end(); ++vit) - { - LobbyParticipantsInfo& pi = mLobbyParticipantsInfos[*vit]; - mStateTokenServer->discardToken(pi.state_token); - mLobbyParticipantsInfos.erase(*vit); - } - - { - Lobby l; - l.name = "BroadCast"; - l.topic = "Retroshare broadcast chat: messages are sent to all connected friends."; - l.subscribed = true; - l.auto_subscribe = false; - l.is_private = false; - l.is_broadcast = true; - lobbies.push_back(l); - } - - std::vector unsubscribed_lobbies; - mRsMsgs->getListOfNearbyChatLobbies(unsubscribed_lobbies); - for(std::vector::iterator vit = unsubscribed_lobbies.begin(); vit != unsubscribed_lobbies.end(); ++vit) - { - const VisibleChatLobbyRecord& info = *vit; - if(std::find(subscribed_ids.begin(), subscribed_ids.end(), info.lobby_id) == subscribed_ids.end()) - { - Lobby l; - l.id = info.lobby_id; - l.name = info.lobby_name; - l.topic = info.lobby_topic; - l.subscribed = false; - l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE; - l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC); - l.is_broadcast = false; - l.gxs_id = RsGxsId(); - lobbies.push_back(l); - } - } - - // process new messages - bool changed = false; - bool lobby_unread_count_changed = false; - std::vector::iterator> done; - std::vector peers_changed; - - bool gxs_id_failed = false; // to prevent asking for multiple failing gxs ids in one tick, to not flush the cache - - for(std::list::iterator lit = mRawMsgs.begin(); lit != mRawMsgs.end(); ++lit) - { - ChatMessage& msg = *lit; - std::string author_id; - std::string author_name; - if(msg.chat_id.isBroadcast()) - { - author_id = msg.broadcast_peer_id.toStdString(); - author_name = mRsPeers->getPeerName(msg.broadcast_peer_id); - } - else if(msg.chat_id.isDistantChatId()) - { - DistantChatPeerInfo dcpinfo ; - - if(!rsMsgs->getDistantChatStatus(msg.chat_id.toDistantChatId(),dcpinfo)) - { - std::cerr << "(EE) cannot get info for distant chat peer " << msg.chat_id.toDistantChatId() << std::endl; - continue ; - } - - RsIdentityDetails details; - if(!gxs_id_failed && mRsIdentity->getIdDetails(msg.incoming? dcpinfo.to_id: dcpinfo.own_id, details)) - { - author_id = details.mId.toStdString(); - author_name = details.mNickname; - } - else - { - gxs_id_failed = true; - continue; - } - } - else if(msg.chat_id.isLobbyId()) - { - author_id = msg.lobby_peer_gxs_id.toStdString(); - RsIdentityDetails details; - if(!gxs_id_failed && mRsIdentity->getIdDetails(msg.lobby_peer_gxs_id, details)) - { - author_name = details.mNickname; - lobby_unread_count_changed = true; - } - else - { - gxs_id_failed = true; - continue; - } - } - else if(msg.chat_id.isPeerId()) - { - RsPeerId id; - if(msg.incoming) - id = msg.chat_id.toPeerId(); - else - id = mRsPeers->getOwnId(); - author_id = id.toStdString(); - author_name = mRsPeers->getPeerName(id); - if(std::find(peers_changed.begin(), peers_changed.end(), msg.chat_id.toPeerId()) == peers_changed.end()) - peers_changed.push_back(msg.chat_id.toPeerId()); - } - else - { - std::cerr << "Error in ChatHandler::tick(): unhandled chat_id=" << msg.chat_id.toStdString() << std::endl; - // remove from queue, so msgs with wrong ids to not pile up - done.push_back(lit); - continue; - } - - if(mChatInfo.find(msg.chat_id) == mChatInfo.end()) - { - ChatInfo info; - info.is_broadcast = msg.chat_id.isBroadcast(); - info.is_distant_chat_id = msg.chat_id.isDistantChatId(); - info.is_lobby = msg.chat_id.isLobbyId(); - info.is_peer = msg.chat_id.isPeerId(); - if(msg.chat_id.isLobbyId()) - { - for(std::vector::iterator vit = mLobbies.begin(); vit != mLobbies.end(); ++vit) - { - if(vit->id == msg.chat_id.toLobbyId()) - info.remote_author_name = vit->name; - } - } - else if(msg.chat_id.isDistantChatId()) - { - RsIdentityDetails detailsRemoteIdentity; - RsIdentityDetails detailsOwnIdentity; - DistantChatPeerInfo dcpinfo; - - if( !gxs_id_failed && - rsMsgs->getDistantChatStatus( - msg.chat_id.toDistantChatId(), dcpinfo ) - && mRsIdentity->getIdDetails(dcpinfo.to_id, detailsRemoteIdentity) - && mRsIdentity->getIdDetails(dcpinfo.own_id, detailsOwnIdentity)) - { - info.remote_author_id = detailsRemoteIdentity.mId.toStdString(); - info.remote_author_name = detailsRemoteIdentity.mNickname; - - info.own_author_id = detailsOwnIdentity.mId.toStdString(); - info.own_author_name = detailsOwnIdentity.mNickname; - } - else - { - gxs_id_failed = true; - continue; - } - } - else if(msg.chat_id.isPeerId()) - { - info.remote_author_id = msg.chat_id.toPeerId().toStdString(); - info.remote_author_name = mRsPeers->getPeerName(msg.chat_id.toPeerId()); - } - mChatInfo[msg.chat_id] = info; - } - - Msg m; - m.read = !msg.incoming; - m.incoming = msg.incoming; - m.was_send = msg.online; - m.author_id = author_id; - m.author_name = author_name; - - // remove html tags from chat message - // extract links form href - getPlainText(msg.msg, m.msg, m.links); - m.recv_time = msg.recvTime; - m.send_time = msg.sendTime; - - m.id = RSRandom::random_u32(); - - mMsgs[msg.chat_id].push_back(m); - done.push_back(lit); - - changed = true; - } - for(std::vector::iterator>::iterator vit = done.begin(); vit != done.end(); ++vit) - mRawMsgs.erase(*vit); - - // send changes - - if(changed) - { - mStateTokenServer->replaceToken(mMsgStateToken); - mStateTokenServer->replaceToken(mUnreadMsgsStateToken); - } - - for(std::vector::iterator vit = peers_changed.begin(); vit != peers_changed.end(); ++vit) - { - const std::list& msgs = mMsgs[ChatId(*vit)]; - uint32_t count = 0; - for(std::list::const_iterator lit = msgs.begin(); lit != msgs.end(); ++lit) - if(!lit->read) - count++; - if(mUnreadMsgNotify) - mUnreadMsgNotify->notifyUnreadMsgCountChanged(*vit, count); - } - - std::sort(lobbies.begin(), lobbies.end(), &compare_lobby_id); - if(lobby_unread_count_changed || mLobbies != lobbies) - { - mStateTokenServer->replaceToken(mLobbiesStateToken); - mLobbies = lobbies; - } -} - -static void writeUTF8 ( std::ostream & Out, unsigned int Ch ) -/* writes Ch in UTF-8 encoding to Out. Note this version only deals - with characters up to 16 bits. - From: http://www.codecodex.com/wiki/Unescape_HTML_special_characters_from_a_String*/ -{ - if (Ch >= 0x800) - { - Out.put(0xE0 | ((Ch >> 12) & 0x0F)); - Out.put(0x80 | ((Ch >> 6) & 0x3F)); - Out.put(0x80 | ((Ch ) & 0x3F)); - } - else if (Ch >= 0x80) - { - Out.put(0xC0 | ((Ch >> 6) & 0x1F)); - Out.put(0x80 | ((Ch ) & 0x3F)); - } - else - { - Out.put(Ch); - } -} - -static unsigned int stringToDecUInt ( std::string str) -{ - unsigned int out = 0; - unsigned int max = std::numeric_limits::max() / 10; - int lenght = str.length(); - for (int curs = 0; curs < lenght; ++curs) { - char c = str[curs]; - if ( (c >= '0') - && (c <= '9') - && (out < max) - ) { - out *= 10; - out += (int)( c - '0'); - } else return 0; - } - return out; -} - -void ChatHandler::getPlainText(const std::string& in, std::string &out, std::vector &links) -{ - if (in.size() == 0) - return; - - if (in[0] != '<' || in[in.size() - 1] != '>') - { - // It's a plain text message without HTML - out = in; - return; - } - bool ignore = false; - - bool keep_link = false; - std::string last_six_chars; - unsigned int tag_start_index = 0; - Triple current_link; - bool onEscapeChar = false; - unsigned int escapeCharIndexStart = -1; - - for(unsigned int i = 0; i < in.size(); ++i) - { - if(keep_link && in[i] == '"') - { - keep_link = false; - current_link.second = out.size(); - } - if(last_six_chars == "href=\"") - { - keep_link = true; - current_link.first = out.size(); - } - - // "rising edge" sets mode to ignore - if(in[i] == '<') - { - tag_start_index = i; - ignore = true; - } - if(!ignore || keep_link) - out += in[i]; - // "falling edge" resets mode to keep - if(in[i] == '>' && ignore) { - // leave ignore mode on, if it's a style tag - if (tag_start_index == 0 || tag_start_index + 6 > i || in.substr(tag_start_index, 6) != " 6) - last_six_chars = last_six_chars.substr(1); - std::string a = ""; - if( current_link.first != -1 - && last_six_chars.size() >= a.size() - && last_six_chars.substr(last_six_chars.size()-a.size()) == a) - { - // only allow these protocols - // we don't want for example javascript:alert(0) - std::string http = "http://"; - std::string https = "https://"; - std::string retroshare = "retroshare://"; - if( out.substr(current_link.first, http.size()) == http - || out.substr(current_link.first, https.size()) == https - || out.substr(current_link.first, retroshare.size()) == retroshare) - { - current_link.third = out.size(); - links.push_back(current_link); - } - current_link = Triple(); - } - std::string br = "
"; - if(last_six_chars.size() >= br.size() - && last_six_chars.substr(last_six_chars.size()-br.size()) == br) - { - out += "\n"; - } - if (in[i] == '&') { - onEscapeChar = true; - escapeCharIndexStart = out.length(); - } - if (ignore || keep_link) { - onEscapeChar = false; - escapeCharIndexStart = -1; - } - if ((in[i] == ';') && onEscapeChar) { - onEscapeChar = false; - bool escapeFound = true; - std::string escapeReplace = ""; - //Keep only escape value to replace it - std::string escapeCharValue = out.substr(escapeCharIndexStart, - out.length() - escapeCharIndexStart - 1); - if (escapeCharValue[0] == '#') { - int escapedCharUTF8 = stringToDecUInt(escapeCharValue.substr(1)); - std::ostringstream escapedSStream; - writeUTF8( escapedSStream, escapedCharUTF8); - escapeReplace = escapedSStream.str(); - } else if (escapeCharValue == "euro") { - escapeReplace = "€"; - } else if (escapeCharValue == "nbsp") { - escapeReplace = " "; - } else if (escapeCharValue == "quot") { - escapeReplace = "\""; - } else if (escapeCharValue == "amp") { - escapeReplace = "&"; - } else if (escapeCharValue == "lt") { - escapeReplace = "<"; - } else if (escapeCharValue == "gt") { - escapeReplace = ">"; - } else if (escapeCharValue == "iexcl") { - escapeReplace = "¡"; - } else if (escapeCharValue == "cent") { - escapeReplace = "¢"; - } else if (escapeCharValue == "pound") { - escapeReplace = "£"; - } else if (escapeCharValue == "curren") { - escapeReplace = "¤"; - } else if (escapeCharValue == "yen") { - escapeReplace = "¥"; - } else if (escapeCharValue == "brvbar") { - escapeReplace = "¦"; - } else if (escapeCharValue == "sect") { - escapeReplace = "§"; - } else if (escapeCharValue == "uml") { - escapeReplace = "¨"; - } else if (escapeCharValue == "copy") { - escapeReplace = "©"; - } else if (escapeCharValue == "ordf") { - escapeReplace = "ª"; - } else if (escapeCharValue == "not") { - escapeReplace = "¬"; - } else if (escapeCharValue == "shy") { - escapeReplace = " ";//? - } else if (escapeCharValue == "reg") { - escapeReplace = "®"; - } else if (escapeCharValue == "macr") { - escapeReplace = "¯"; - } else if (escapeCharValue == "deg") { - escapeReplace = "°"; - } else if (escapeCharValue == "plusmn") { - escapeReplace = "±"; - } else if (escapeCharValue == "sup2") { - escapeReplace = "²"; - } else if (escapeCharValue == "sup3") { - escapeReplace = "³"; - } else if (escapeCharValue == "acute") { - escapeReplace = "´"; - } else if (escapeCharValue == "micro") { - escapeReplace = "µ"; - } else if (escapeCharValue == "para") { - escapeReplace = "¶"; - } else if (escapeCharValue == "middot") { - escapeReplace = "·"; - } else if (escapeCharValue == "cedil") { - escapeReplace = "¸"; - } else if (escapeCharValue == "sup1") { - escapeReplace = "¹"; - } else if (escapeCharValue == "ordm") { - escapeReplace = "º"; - } else if (escapeCharValue == "raquo") { - escapeReplace = "»"; - } else if (escapeCharValue == "frac14") { - escapeReplace = "¼"; - } else if (escapeCharValue == "frac12") { - escapeReplace = "½"; - } else if (escapeCharValue == "frac34") { - escapeReplace = "¾"; - } else if (escapeCharValue == "iquest") { - escapeReplace = "¿"; - } else if (escapeCharValue == "Agrave") { - escapeReplace = "À"; - } else if (escapeCharValue == "Aacute") { - escapeReplace = "Á"; - } else if (escapeCharValue == "Acirc") { - escapeReplace = "Â"; - } else if (escapeCharValue == "Atilde") { - escapeReplace = "Ã"; - } else if (escapeCharValue == "Auml") { - escapeReplace = "Ä"; - } else if (escapeCharValue == "Aring") { - escapeReplace = "Å"; - } else if (escapeCharValue == "AElig") { - escapeReplace = "Æ"; - } else if (escapeCharValue == "Ccedil") { - escapeReplace = "Ç"; - } else if (escapeCharValue == "Egrave") { - escapeReplace = "È"; - } else if (escapeCharValue == "Eacute") { - escapeReplace = "É"; - } else if (escapeCharValue == "Ecirc") { - escapeReplace = "Ê"; - } else if (escapeCharValue == "Euml") { - escapeReplace = "Ë"; - } else if (escapeCharValue == "Igrave") { - escapeReplace = "Ì"; - } else if (escapeCharValue == "Iacute") { - escapeReplace = "Í"; - } else if (escapeCharValue == "Icirc") { - escapeReplace = "Î"; - } else if (escapeCharValue == "Iuml") { - escapeReplace = "Ï"; - } else if (escapeCharValue == "ETH") { - escapeReplace = "Ð"; - } else if (escapeCharValue == "Ntilde") { - escapeReplace = "Ñ"; - } else if (escapeCharValue == "Ograve") { - escapeReplace = "Ò"; - } else if (escapeCharValue == "Oacute") { - escapeReplace = "Ó"; - } else if (escapeCharValue == "Ocirc") { - escapeReplace = "Ô"; - } else if (escapeCharValue == "Otilde") { - escapeReplace = "Õ"; - } else if (escapeCharValue == "Ouml") { - escapeReplace = "Ö"; - } else if (escapeCharValue == "times") { - escapeReplace = "×"; - } else if (escapeCharValue == "Oslash") { - escapeReplace = "Ø"; - } else if (escapeCharValue == "Ugrave") { - escapeReplace = "Ù"; - } else if (escapeCharValue == "Uacute") { - escapeReplace = "Ú"; - } else if (escapeCharValue == "Ucirc") { - escapeReplace = "Û"; - } else if (escapeCharValue == "Uuml") { - escapeReplace = "Ü"; - } else if (escapeCharValue == "Yacute") { - escapeReplace = "Ý"; - } else if (escapeCharValue == "THORN") { - escapeReplace = "Þ"; - } else if (escapeCharValue == "szlig") { - escapeReplace = "ß"; - } else if (escapeCharValue == "agrave") { - escapeReplace = "à"; - } else if (escapeCharValue == "aacute") { - escapeReplace = "á"; - } else if (escapeCharValue == "acirc") { - escapeReplace = "â"; - } else if (escapeCharValue == "atilde") { - escapeReplace = "ã"; - } else if (escapeCharValue == "auml") { - escapeReplace = "ä"; - } else if (escapeCharValue == "aring") { - escapeReplace = "å"; - } else if (escapeCharValue == "aelig") { - escapeReplace = "æ"; - } else if (escapeCharValue == "ccedil") { - escapeReplace = "ç"; - } else if (escapeCharValue == "egrave") { - escapeReplace = "è"; - } else if (escapeCharValue == "eacute") { - escapeReplace = "é"; - } else if (escapeCharValue == "ecirc") { - escapeReplace = "ê"; - } else if (escapeCharValue == "euml") { - escapeReplace = "ë"; - } else if (escapeCharValue == "igrave") { - escapeReplace = "ì"; - } else if (escapeCharValue == "iacute") { - escapeReplace = "í"; - } else if (escapeCharValue == "icirc") { - escapeReplace = "î"; - } else if (escapeCharValue == "iuml") { - escapeReplace = "ï"; - } else if (escapeCharValue == "eth") { - escapeReplace = "ð"; - } else if (escapeCharValue == "ntilde") { - escapeReplace = "ñ"; - } else if (escapeCharValue == "ograve") { - escapeReplace = "ò"; - } else if (escapeCharValue == "oacute") { - escapeReplace = "ó"; - } else if (escapeCharValue == "ocirc") { - escapeReplace = "ô"; - } else if (escapeCharValue == "otilde") { - escapeReplace = "õ"; - } else if (escapeCharValue == "ouml") { - escapeReplace = "ö"; - } else if (escapeCharValue == "divide") { - escapeReplace = "÷"; - } else if (escapeCharValue == "oslash") { - escapeReplace = "ø"; - } else if (escapeCharValue == "ugrave") { - escapeReplace = "ù"; - } else if (escapeCharValue == "uacute") { - escapeReplace = "ú"; - } else if (escapeCharValue == "ucirc") { - escapeReplace = "û"; - } else if (escapeCharValue == "uuml") { - escapeReplace = "ü"; - } else if (escapeCharValue == "yacute") { - escapeReplace = "ý"; - } else if (escapeCharValue == "thorn") { - escapeReplace = "þ"; - } else { - escapeFound = false; - } - if (escapeFound) { - out = out.substr(0, escapeCharIndexStart-1); - out += escapeReplace; - } - } - } -} - -void ChatHandler::locked_storeTypingInfo(const ChatId &chat_id, std::string status, RsGxsId lobby_gxs_id) -{ - TypingLabelInfo& info = mTypingLabelInfo[chat_id]; - info.timestamp = time(0); - info.status = status; - mStateTokenServer->replaceToken(info.state_token); - info.author_id = lobby_gxs_id; -} - -void ChatHandler::handleWildcard(Request &/*req*/, Response &resp) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - resp.mDataStream.getStreamToMember(); - for(std::map >::iterator mit = mMsgs.begin(); mit != mMsgs.end(); ++mit) - { - resp.mDataStream.getStreamToMember() << makeValue(mit->first.toStdString()); - } - resp.setOk(); -} - -void ChatHandler::handleLobbies(Request &/*req*/, Response &resp) -{ - tick(); - - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - resp.mDataStream.getStreamToMember(); - for(std::vector::iterator vit = mLobbies.begin(); vit != mLobbies.end(); ++vit) - { - uint32_t unread_msgs = 0; - ChatId chat_id(vit->id); - std::map >::iterator mit = mMsgs.find(chat_id); - if(mit != mMsgs.end()) - { - std::list& msgs = mit->second; - for(std::list::iterator lit = msgs.begin(); lit != msgs.end(); ++lit) - if(!lit->read) - unread_msgs++; - } - resp.mDataStream.getStreamToMember() << *vit << makeKeyValueReference("unread_msg_count", unread_msgs); - } - resp.mStateToken = mLobbiesStateToken; - } - resp.setOk(); -} - -void ChatHandler::handleSubscribeLobby(Request &req, Response &resp) -{ - ChatLobbyId id = 0; - RsGxsId gxs_id; - req.mStream << makeKeyValueReference("id", id) << makeKeyValueReference("gxs_id", gxs_id); - - if(id == 0) - { - resp.setFail("Error: id must not be null"); - return; - } - if(gxs_id.isNull()) - { - resp.setFail("Error: gxs_id must not be null"); - return; - } - if(mRsMsgs->joinVisibleChatLobby(id, gxs_id)) - resp.setOk(); - else - resp.setFail("lobby join failed. (See console for more info)"); -} - -void ChatHandler::handleUnsubscribeLobby(Request &req, Response &resp) -{ - ChatLobbyId id = 0; - req.mStream << makeKeyValueReference("id", id); - mRsMsgs->unsubscribeChatLobby(id); - resp.setOk(); -} - -void ChatHandler::handleAutoSubsribeLobby(Request& req, Response& resp) -{ - ChatLobbyId chatId = 0; - bool autosubsribe; - req.mStream << makeKeyValueReference("chatid", chatId) << makeKeyValueReference("autosubsribe", autosubsribe); - mRsMsgs->setLobbyAutoSubscribe(chatId, autosubsribe); - resp.setOk(); -} - -void ChatHandler::handleClearLobby(Request &req, Response &resp) -{ - ChatLobbyId id = 0; - req.mStream << makeKeyValueReference("id", id); - if (id !=0) { - notifyChatCleared(ChatId(id)); - } else { - //Is BroadCast - notifyChatCleared(ChatId("B")); - } - resp.setOk(); -} - -void ChatHandler::handleInviteToLobby(Request& req, Response& resp) -{ - std::string chat_id; - std::string pgp_id; - req.mStream << makeKeyValueReference("chat_id", chat_id); - req.mStream << makeKeyValueReference("pgp_id", pgp_id); - - ChatId chatId(chat_id); - RsPgpId pgpId(pgp_id); - - std::list peerIds; - mRsPeers->getAssociatedSSLIds(pgpId, peerIds); - - for(std::list::iterator it = peerIds.begin(); it != peerIds.end(); it++) - mRsMsgs->invitePeerToLobby(chatId.toLobbyId(), (*it)); - - resp.setOk(); -} - -void ChatHandler::handleGetInvitationsToLobby(Request& /*req*/, Response& resp) -{ - std::list invites; - mRsMsgs->getPendingChatLobbyInvites(invites); - - resp.mDataStream.getStreamToMember(); - for(std::list::const_iterator it = invites.begin(); it != invites.end(); ++it) - { - resp.mDataStream.getStreamToMember() - << makeKeyValue("peer_id", (*it).peer_id.toStdString()) - << makeKeyValue("lobby_id", (*it).lobby_id) - << makeKeyValue("lobby_name", (*it).lobby_name) - << makeKeyValue("lobby_topic", (*it).lobby_topic); - } - - resp.mStateToken = mInvitationsStateToken; - resp.setOk(); -} - -void ChatHandler::handleAnswerToInvitation(Request& req, Response& resp) -{ - ChatLobbyId lobbyId = 0; - req.mStream << makeKeyValueReference("lobby_id", lobbyId); - - bool join; - req.mStream << makeKeyValueReference("join", join); - - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - RsGxsId gxsId(gxs_id); - - if(join) - { - if(rsMsgs->acceptLobbyInvite(lobbyId, gxsId)) - resp.setOk(); - else - resp.setFail(); - } - else - { - rsMsgs->denyLobbyInvite(lobbyId); - resp.setOk(); - } -} - -ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - - ChatId id(req.mPath.top()); - if(!id.isLobbyId()) - { - resp.setFail("Path element \""+req.mPath.top()+"\" is not a ChatLobbyId."); - return 0; - } - std::map::const_iterator mit = mLobbyParticipantsInfos.find(id.toLobbyId()); - if(mit == mLobbyParticipantsInfos.end()) - { - resp.setFail("lobby not found"); - return 0; - } - return new SendLobbyParticipantsTask(mRsIdentity, mit->second); -} - -void ChatHandler::handleGetDefaultIdentityForChatLobby(Request& /*req*/, - Response& resp) -{ - RsGxsId gxsId; - mRsMsgs->getDefaultIdentityForChatLobby(gxsId); - resp.mDataStream << makeKeyValue("gxs_id", gxsId.toStdString()); - resp.setOk(); -} - -void ChatHandler::handleSetDefaultIdentityForChatLobby(Request& req, Response& resp) -{ - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - RsGxsId gxsId(gxs_id); - - if(gxsId.isNull()) - { - resp.setFail("Error: gxs_id must not be null"); - return; - } - - if(mRsMsgs->setDefaultIdentityForChatLobby(gxsId)) - resp.setOk(); - else - resp.setFail("Failure to change default identity for chat lobby"); -} - -void ChatHandler::handleGetIdentityForChatLobby(Request& req, Response& resp) -{ - RsGxsId gxsId; - std::string chat_id; - req.mStream << makeKeyValueReference("chat_id", chat_id); - ChatId chatId(chat_id); - - if(chatId.isNotSet()) - { - resp.setFail("Error: chat_id must not be null"); - return; - } - - if(mRsMsgs->getIdentityForChatLobby(chatId.toLobbyId(), gxsId)) - { - resp.mDataStream << makeKeyValue("gxs_id", gxsId.toStdString()); - resp.setOk(); - } - else - resp.setFail(); -} - -void ChatHandler::handleSetIdentityForChatLobby(Request& req, Response& resp) -{ - std::string chat_id; - req.mStream << makeKeyValueReference("chat_id", chat_id); - ChatId chatId(chat_id); - - if(chatId.isNotSet()) - { - resp.setFail("Error: chat_id must not be null"); - return; - } - - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - RsGxsId gxsId(gxs_id); - - if(gxsId.isNull()) - { - resp.setFail("Error: gxs_id must not be null"); - return; - } - - if(mRsMsgs->setIdentityForChatLobby(chatId.toLobbyId(), gxsId)) - resp.setOk(); - else - resp.setFail(); -} - -void ChatHandler::handleMessages(Request &req, Response &resp) -{ - /* G10h4ck: Whithout this the request processing won't happen, copied from - * ChatHandler::handleLobbies, is this a work around or is the right way of - * doing it? */ - tick(); - - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - ChatId id(req.mPath.top()); - - // make response a list - resp.mDataStream.getStreamToMember(); - if(id.isNotSet()) - { - resp.setFail("\""+req.mPath.top()+"\" is not a valid chat id"); - return; - } - std::map >::iterator mit = mMsgs.find(id); - if(mit == mMsgs.end()) - { - /* set state token, even if not found yet, maybe later messages arrive - * and then the chat id will be found */ - resp.mStateToken = mMsgStateToken; - resp.setFail("chat with id=\""+req.mPath.top()+"\" not found"); - return; - } - resp.mStateToken = mMsgStateToken; - handlePaginationRequest(req, resp, mit->second); - } -} - -void ChatHandler::handleSendMessage(Request &req, Response &resp) -{ - std::string chat_id; - std::string msg; - req.mStream << makeKeyValueReference("chat_id", chat_id) - << makeKeyValueReference("msg", msg); - ChatId id(chat_id); - if(id.isNotSet()) - { - resp.setFail("chat_id is invalid"); - return; - } - if(mRsMsgs->sendChat(id, msg)) - resp.setOk(); - else - resp.setFail("failed to send message"); -} - -void ChatHandler::handleMarkMessageAsRead(Request &req, Response &resp) -{ - std::string chat_id_string; - std::string msg_id; - req.mStream << makeKeyValueReference("chat_id", chat_id_string) - << makeKeyValueReference("msg_id", msg_id); - - ChatId chatId(chat_id_string); - if(chatId.isNotSet()) - { - resp.setFail(chat_id_string + " is not a valid chat id"); - return; - } - - std::map >::iterator mit = mMsgs.find(chatId); - if(mit == mMsgs.end()) - { - resp.setFail("chat not found. Maybe this chat does not have messages yet?"); - return; - } - - std::list& msgs = mit->second; - for(std::list::iterator lit = msgs.begin(); lit != msgs.end(); ++lit) - { - if(id((*lit)) == msg_id) - (*lit).read = true; - } - - // lobby list contains unread msgs, so update it - if(chatId.isLobbyId()) - mStateTokenServer->replaceToken(mLobbiesStateToken); - if(chatId.isPeerId() && mUnreadMsgNotify) - mUnreadMsgNotify->notifyUnreadMsgCountChanged(chatId.toPeerId(), 0); - - mStateTokenServer->replaceToken(mMsgStateToken); - mStateTokenServer->replaceToken(mUnreadMsgsStateToken); -} - -void ChatHandler::handleMarkChatAsRead(Request &req, Response &resp) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - ChatId id(req.mPath.top()); - - if(id.isNotSet()) - { - resp.setFail("\""+req.mPath.top()+"\" is not a valid chat id"); - return; - } - std::map >::iterator mit = mMsgs.find(id); - if(mit == mMsgs.end()) - { - resp.setFail("chat not found. Maybe this chat does not have messages yet?"); - return; - } - std::list& msgs = mit->second; - for(std::list::iterator lit = msgs.begin(); lit != msgs.end(); ++lit) - { - lit->read = true; - } - // lobby list contains unread msgs, so update it - if(id.isLobbyId()) - mStateTokenServer->replaceToken(mLobbiesStateToken); - if(id.isPeerId() && mUnreadMsgNotify) - mUnreadMsgNotify->notifyUnreadMsgCountChanged(id.toPeerId(), 0); - - mStateTokenServer->replaceToken(mMsgStateToken); - mStateTokenServer->replaceToken(mUnreadMsgsStateToken); -} - -void ChatHandler::handleInfo(Request &req, Response &resp) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - ChatId id(req.mPath.top()); - if(id.isNotSet()) - { - resp.setFail("\""+req.mPath.top()+"\" is not a valid chat id"); - return; - } - std::map::iterator mit = mChatInfo.find(id); - if(mit == mChatInfo.end()) - { - resp.setFail("chat not found."); - return; - } - resp.mDataStream << mit->second; - resp.setOk(); -} - -class SendTypingLabelInfo: public GxsResponseTask -{ -public: - SendTypingLabelInfo(RsIdentity* identity, RsPeers* peers, ChatId id, const ChatHandler::TypingLabelInfo& info): - GxsResponseTask(identity), mState(BEGIN), mPeers(peers),mId(id), mInfo(info) {} -private: - enum State {BEGIN, WAITING_ID}; - State mState; - RsPeers* mPeers; - ChatId mId; - ChatHandler::TypingLabelInfo mInfo; -protected: - void gxsDoWork(Request& /*req*/, Response& resp) - { - if(mState == BEGIN) - { - // lobby and distant require to fetch a gxs_id - if(mId.isLobbyId()) - { - if(!mInfo.author_id.isNull()) - requestGxsId(mInfo.author_id); - } - else if(mId.isDistantChatId()) - { - DistantChatPeerInfo dcpinfo ; - rsMsgs->getDistantChatStatus(mId.toDistantChatId(), dcpinfo); - requestGxsId(dcpinfo.to_id); - } - mState = WAITING_ID; - } - else - { - std::string name = "BUG: case not handled in SendTypingLabelInfo"; - RsGxsId author_id = mInfo.author_id; - if(mId.isPeerId()) - { - name = mPeers->getPeerName(mId.toPeerId()); - } - else if(mId.isDistantChatId()) - { - DistantChatPeerInfo dcpinfo ; - rsMsgs->getDistantChatStatus(mId.toDistantChatId(), dcpinfo); - name = getName(dcpinfo.to_id); - author_id = dcpinfo.to_id; - } - else if(mId.isLobbyId()) - { - name = getName(mInfo.author_id); - } - else if(mId.isBroadcast()) - { - name = mPeers->getPeerName(mId.broadcast_status_peer_id); - } - uint32_t ts = mInfo.timestamp; - resp.mDataStream << makeKeyValueReference("author_name", name) - << makeKeyValue("author_id", author_id.toStdString()) - << makeKeyValueReference("timestamp", ts) - << makeKeyValueReference("status_string", mInfo.status); - resp.mStateToken = mInfo.state_token; - resp.setOk(); - done(); - } - } -}; - -ResponseTask* ChatHandler::handleReceiveStatus(Request &req, Response &resp) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - ChatId id(req.mPath.top()); - if(id.isNotSet()) - { - resp.setFail("\""+req.mPath.top()+"\" is not a valid chat id"); - return 0; - } - std::map::iterator mit = mTypingLabelInfo.find(id); - if(mit == mTypingLabelInfo.end()) - { - locked_storeTypingInfo(id, ""); - mit = mTypingLabelInfo.find(id); - } - - return new SendTypingLabelInfo(mRsIdentity, mRsPeers, id, mit->second); -} - -void ChatHandler::handleSendStatus(Request &req, Response &resp) -{ - std::string chat_id; - std::string status; - req.mStream << makeKeyValueReference("chat_id", chat_id) - << makeKeyValueReference("status", status); - ChatId id(chat_id); - if(id.isNotSet()) - { - resp.setFail("chat_id is invalid"); - return; - } - mRsMsgs->sendStatusString(id, status); - resp.setOk(); -} - -void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - - resp.mDataStream.getStreamToMember(); - for( std::map >::const_iterator mit = mMsgs.begin(); - mit != mMsgs.end(); ++mit ) - { - uint32_t count = 0; - for( std::list::const_iterator lit = mit->second.begin(); - lit != mit->second.end(); ++lit ) if(!lit->read) ++count; - std::map::iterator mit2 = mChatInfo.find(mit->first); - if(mit2 == mChatInfo.end()) - std::cerr << "Error in ChatHandler::handleUnreadMsgs(): ChatInfo not found. It is weird if this happens. Normally it should not happen." << std::endl; - if(count && (mit2 != mChatInfo.end())) - { - resp.mDataStream.getStreamToMember() -#warning Gioacchino Mazzurco 2017-03-24: @deprecated using "id" as key can cause problems in some JS based \ - languages like Qml @see chat_id instead - << makeKeyValue("id", mit->first.toStdString()) - << makeKeyValue("chat_id", mit->first.toStdString()) - << makeKeyValueReference("unread_count", count) - << mit2->second; - } - } - resp.mStateToken = mUnreadMsgsStateToken; - resp.setOk(); -} - -void ChatHandler::handleInitiateDistantChatConnexion(Request& req, Response& resp) -{ - std::string own_gxs_hex, remote_gxs_hex; - - req.mStream << makeKeyValueReference("own_gxs_hex", own_gxs_hex) - << makeKeyValueReference("remote_gxs_hex", remote_gxs_hex); - - RsGxsId sender_id(own_gxs_hex); - if(sender_id.isNull()) - { - resp.setFail("own_gxs_hex is invalid"); - return; - } - - RsGxsId receiver_id(remote_gxs_hex); - if(receiver_id.isNull()) - { - resp.setFail("remote_gxs_hex is invalid"); - return; - } - - DistantChatPeerId distant_chat_id; - uint32_t error_code; - - if(mRsMsgs->initiateDistantChatConnexion( receiver_id, sender_id, - distant_chat_id, error_code, - false )) resp.setOk(); - else resp.setFail("Failed to initiate distant chat"); - - ChatId chat_id(distant_chat_id); - resp.mDataStream << makeKeyValue("chat_id", chat_id.toStdString()) - << makeKeyValueReference("error_code", error_code); -} - -void ChatHandler::handleDistantChatStatus(Request& req, Response& resp) -{ - std::string distant_chat_hex; - req.mStream << makeKeyValueReference("chat_id", distant_chat_hex); - - ChatId id(distant_chat_hex); - DistantChatPeerInfo info; - if(mRsMsgs->getDistantChatStatus(id.toDistantChatId(), info)) resp.setOk(); - else resp.setFail("Failed to get status for distant chat"); - - resp.mDataStream << makeKeyValue("own_gxs_hex", info.own_id.toStdString()) - << makeKeyValue("remote_gxs_hex", info.to_id.toStdString()) - << makeKeyValue("chat_id", info.peer_id.toStdString()) - << makeKeyValue("status", info.status); -} - -void ChatHandler::handleCloseDistantChatConnexion(Request& req, Response& resp) -{ - std::string distant_chat_hex; - req.mStream << makeKeyValueReference("distant_chat_hex", distant_chat_hex); - ChatId chatId(distant_chat_hex); - - if (mRsMsgs->closeDistantChatConnexion(chatId.toDistantChatId())) - resp.setOk(); - else - resp.setFail("Failed to close distant chat"); -} - -void ChatHandler::handleCreateLobby(Request& req, Response& resp) -{ - std::set invited_identites; - std::string lobby_name; - std::string lobby_topic; - std::string gxs_id; - - req.mStream << makeKeyValueReference("lobby_name", lobby_name); - req.mStream << makeKeyValueReference("lobby_topic", lobby_topic); - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - - RsGxsId gxsId(gxs_id); - - bool lobby_public; - bool pgp_signed; - - req.mStream << makeKeyValueReference("lobby_public", lobby_public); - req.mStream << makeKeyValueReference("pgp_signed", pgp_signed); - - ChatLobbyFlags lobby_flags; - - if(lobby_public) - lobby_flags |= RS_CHAT_LOBBY_FLAGS_PUBLIC; - - if(pgp_signed) - lobby_flags |= RS_CHAT_LOBBY_FLAGS_PGP_SIGNED; - - mRsMsgs->createChatLobby(lobby_name, gxsId, lobby_topic, invited_identites, lobby_flags); - - tick(); - resp.setOk(); -} - -} // namespace resource_api diff --git a/libresapi/src/api/ChatHandler.h b/libresapi/src/api/ChatHandler.h deleted file mode 100644 index 8294c8e22..000000000 --- a/libresapi/src/api/ChatHandler.h +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * libresapi/api/ChatHandler.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2015 by electron128 * - * Copyright 2017 by Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include "ResourceRouter.h" -#include "StateTokenServer.h" -#include -#include -#include "util/rstime.h" - -class RsPeers; -struct RsIdentity; - -namespace resource_api -{ - -class UnreadMsgNotify -{ -public: - virtual void notifyUnreadMsgCountChanged(const RsPeerId& peer, uint32_t count) = 0; -}; - -class ChatHandler: public ResourceRouter, NotifyClient, Tickable -{ -public: - ChatHandler(StateTokenServer* sts, RsNotify* notify, RsMsgs* msgs, RsPeers* peers, RsIdentity *identity, UnreadMsgNotify* unread); - virtual ~ChatHandler(); - - // from NotifyClient - // note: this may get called from the own and from foreign threads - virtual void notifyChatMessage(const ChatMessage& msg); - virtual void notifyChatCleared(const ChatId& chat_id); - - // typing label for peer, broadcast and distant chat - virtual void notifyChatStatus (const ChatId& /* chat_id */, const std::string& /* status_string */); - - //typing label for lobby chat, peer join and leave messages - virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ , - const RsGxsId& /* nickname */,const std::string& /* any string */); - - virtual void notifyListChange(int list, int type); - - // from tickable - virtual void tick(); - -public: - class Triple - { - public: - Triple(): first(-1), second(-1), third(-1){} - double first; - double second; - double third; - }; - - class Msg{ - public: - bool read; - bool incoming; - bool was_send; - //std::string chat_type; - std::string author_id; // peer or gxs id or "system" for system messages - std::string author_name; - std::string msg; // plain text only! - std::vector links; - uint32_t recv_time; - uint32_t send_time; - - uint32_t id; - }; - - class Lobby{ - public: - Lobby(): id(0), subscribed(false), auto_subscribe(false), is_private(false), is_broadcast(false){} - ChatLobbyId id; - std::string name; - std::string topic; - bool subscribed; - bool auto_subscribe; - bool is_private; - bool is_broadcast; - - RsGxsId gxs_id;// for subscribed lobbies: the id we use to write messages - - bool operator==(const Lobby& l) const - { - return id == l.id - && name == l.name - && topic == l.topic - && subscribed == l.subscribed - && auto_subscribe == l.auto_subscribe - && is_private == l.is_private - && is_broadcast == l.is_broadcast - && gxs_id == l.gxs_id; - } - }; - - class LobbyParticipantsInfo{ - public: - StateToken state_token; - std::map participants; - }; - - class ChatInfo{ - public: - bool is_broadcast; - bool is_distant_chat_id; - bool is_lobby; - bool is_peer; - std::string own_author_id; - std::string own_author_name; - std::string remote_author_id; - std::string remote_author_name; - }; - - class TypingLabelInfo{ - public: - time_t timestamp; - std::string status; - StateToken state_token; - // only for lobbies - RsGxsId author_id; - }; - -private: - void handleWildcard(Request& req, Response& resp); - void handleLobbies(Request& req, Response& resp); - void handleCreateLobby(Request& req, Response& resp); - void handleSubscribeLobby(Request& req, Response& resp); - void handleUnsubscribeLobby(Request& req, Response& resp); - void handleAutoSubsribeLobby(Request& req, Response& resp); - void handleInviteToLobby(Request& req, Response& resp); - void handleGetInvitationsToLobby(Request& req, Response& resp); - void handleAnswerToInvitation(Request& req, Response& resp); - void handleClearLobby(Request& req, Response& resp); - ResponseTask* handleLobbyParticipants(Request& req, Response& resp); - void handleGetDefaultIdentityForChatLobby(Request& req, Response& resp); - void handleSetDefaultIdentityForChatLobby(Request& req, Response& resp); - void handleGetIdentityForChatLobby(Request& req, Response& resp); - void handleSetIdentityForChatLobby(Request& req, Response& resp); - void handleMessages(Request& req, Response& resp); - void handleSendMessage(Request& req, Response& resp); - void handleMarkMessageAsRead(Request& req, Response& resp); - void handleMarkChatAsRead(Request& req, Response& resp); - void handleInfo(Request& req, Response& resp); - ResponseTask *handleReceiveStatus(Request& req, Response& resp); - void handleSendStatus(Request& req, Response& resp); - void handleUnreadMsgs(Request& req, Response& resp); - void handleInitiateDistantChatConnexion(Request& req, Response& resp); - void handleDistantChatStatus(Request& req, Response& resp); - void handleCloseDistantChatConnexion(Request& req, Response& resp); - - void getPlainText(const std::string& in, std::string &out, std::vector &links); - // last parameter is only used for lobbies! - void locked_storeTypingInfo(const ChatId& chat_id, std::string status, RsGxsId lobby_gxs_id = RsGxsId()); - - StateTokenServer* mStateTokenServer; - RsNotify* mNotify; - RsMsgs* mRsMsgs; - RsPeers* mRsPeers; - RsIdentity* mRsIdentity; - UnreadMsgNotify* mUnreadMsgNotify; - - RsMutex mMtx; - - StateToken mMsgStateToken; - std::list mRawMsgs; - std::map > mMsgs; - - std::map mChatInfo; - - std::map mTypingLabelInfo; - - StateToken mLobbiesStateToken; - std::vector mLobbies; - - std::map mLobbyParticipantsInfos; - - StateToken mUnreadMsgsStateToken; - StateToken mInvitationsStateToken; - -}; -} // namespace resource_api diff --git a/libresapi/src/api/FileSearchHandler.cpp b/libresapi/src/api/FileSearchHandler.cpp deleted file mode 100644 index ceb3765c9..000000000 --- a/libresapi/src/api/FileSearchHandler.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************* - * libresapi/api/FileSearchHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include - -#include "FileSearchHandler.h" - -#include -#include -#include - -#include "Operators.h" - -namespace resource_api -{ - -FileSearchHandler::FileSearchHandler(StateTokenServer *sts, RsNotify *notify, RsTurtle */*turtle*/, RsFiles *files): - mStateTokenServer(sts), mNotify(notify)/*, mTurtle(turtle)*/, mRsFiles(files), - mMtx("FileSearchHandler") -{ - mNotify->registerNotifyClient(this); - addResourceHandler("*", this, &FileSearchHandler::handleWildcard); - addResourceHandler("create_search", this, &FileSearchHandler::handleCreateSearch); - addResourceHandler("get_search_result", this, &FileSearchHandler::handleGetSearchResult); - - mSearchesStateToken = mStateTokenServer->getNewToken(); -} - -FileSearchHandler::~FileSearchHandler() -{ - mNotify->unregisterNotifyClient(this); - mStateTokenServer->discardToken(mSearchesStateToken); -} - -void FileSearchHandler::notifyTurtleSearchResult(const RsPeerId& /*pid*/,uint32_t search_id, const std::list& files) -{ - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - std::map::iterator mit = mSearches.find(search_id); - if(mit == mSearches.end()) - return; - - Search& search = mit->second; - // set to a limit of 100 for now, can have more when we have pagination - std::list::const_iterator lit = files.begin(); - bool changed = false; - while(search.mResults.size() < 100 && lit != files.end()) - { - if(search.mHashes.find(lit->hash) == search.mHashes.end()) - { - changed = true; - FileDetail det ; - det.rank = 0 ; - det.age = 0 ; - det.name = (*lit).name; - det.hash = (*lit).hash; - det.size = (*lit).size; - det.id.clear(); - search.mResults.push_back(det); - search.mHashes.insert(lit->hash); - } - lit++; - } - if(changed) - { - mStateTokenServer->discardToken(search.mStateToken); - search.mStateToken = mStateTokenServer->getNewToken(); - } -} - -// TODO: delete searches -void FileSearchHandler::handleWildcard(Request &req, Response &resp) -{ - if(!req.mPath.empty()) - { - std::string str = req.mPath.top(); - req.mPath.pop(); - - if(str.size() != 8) - { - resp.setFail("Error: id has wrong size, should be 8 characters"); - return; - } - uint32_t id = 0; - // TODO fix this - for(uint8_t i = 0; i < 8; i++) - { - id += (uint32_t(str[i]-'A')) << (i*4); - } - - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - std::map::iterator mit = mSearches.find(id); - if(mit == mSearches.end()) - { - resp.setFail("Error: search id invalid"); - return; - } - - Search& search = mit->second; - resp.mStateToken = search.mStateToken; - resp.mDataStream.getStreamToMember(); - for(std::list::iterator lit = search.mResults.begin(); lit != search.mResults.end(); ++lit) - { - FileDetail& fd = *lit; - double size = fd.size; - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("id", fd.hash) - << makeKeyValueReference("name", fd.name) - << makeKeyValueReference("hash", fd.hash) - << makeKeyValueReference("path", fd.path) - << makeKeyValue("peer_id", fd.id.toStdString()) - << makeKeyValueReference("size", size) - << makeKeyValueReference("rank", fd.rank) - << makeKeyValueReference("age", fd.age); - } - } - } - else - { - // list searches - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - resp.mDataStream.getStreamToMember(); - for(std::map::iterator mit = mSearches.begin(); mit != mSearches.end(); ++mit) - { - uint32_t id = mit->first; - std::string idstr; - // how many times do i have to write int to string conversation? - // a library should do this - for(uint8_t i = 0; i < 8; i++) - { - char c = ((id>>(i*4))&0xF)+'A'; - idstr += c; - } - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("id", idstr) - << makeKeyValueReference("search_string", mit->second.mSearchString); - } - resp.mStateToken = mSearchesStateToken; - resp.setOk(); - } -} - -static bool dirDetailToFileDetail(const DirDetails& dir, FileDetail& fd) -{ - if (dir.type == DIR_TYPE_FILE) - { - fd.id = dir.id; - fd.name = dir.name; - fd.hash = dir.hash; - fd.path = dir.path; - fd.size = dir.count; - fd.age = time(NULL) - dir.mtime; - fd.rank = 0; - return true; - } - else - return false; -} - -// see retroshare-gui/src/gui/Searchdialog.cpp -void FileSearchHandler::handleCreateSearch(Request &req, Response &resp) -{ - bool distant = false;// distant involves sending data, so have it off by default for privacy - bool local = true; - bool remote = true; - std::string search_string; - req.mStream << makeKeyValueReference("distant", distant) - << makeKeyValueReference("local", local) - << makeKeyValueReference("remote", remote) - << makeKeyValueReference("search_string", search_string); - - std::istringstream iss(search_string); - std::list words; - std::string s; - while (std::getline(iss, s, ' ')) { - std::cout << s << std::endl; - words.push_back(s); - } - - if(words.empty()) - { - resp.setFail("Error: no search string given"); - return; - } - - RsRegularExpression::NameExpression exprs(RsRegularExpression::ContainsAllStrings,words,true) ; - RsRegularExpression::LinearizedExpression lin_exp ; - exprs.linearize(lin_exp) ; - - uint32_t search_id = RSRandom::random_u32(); - if(distant) - { - // i have no idea what the reasons for two different search modes are - // rs-gui does it, so do we - if(words.size() == 1) - search_id = rsFiles->turtleSearch(words.front()); - else - search_id = rsFiles->turtleSearch(lin_exp); - } - - std::list results; - if(local) - { - std::list local_results; - mRsFiles->SearchBoolExp(&exprs, local_results, RS_FILE_HINTS_LOCAL); - - for(std::list::iterator lit = local_results.begin(); lit != local_results.end(); ++lit) - { - FileDetail fd; - if(dirDetailToFileDetail(*lit, fd)) - results.push_back(fd); - } - } - if(remote) - { - std::list remote_results; - mRsFiles->SearchBoolExp(&exprs, remote_results, RS_FILE_HINTS_REMOTE); - for(std::list::iterator lit = remote_results.begin(); lit != remote_results.end(); ++lit) - { - FileDetail fd; - if(dirDetailToFileDetail(*lit, fd)) - results.push_back(fd); - } - } - - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - - Search& search = mSearches[search_id]; - search.mStateToken = mStateTokenServer->getNewToken(); - search.mSearchString = search_string; - search.mResults.swap(results); - - mStateTokenServer->discardToken(mSearchesStateToken); - mSearchesStateToken = mStateTokenServer->getNewToken(); - } - - std::string idstr; - // how many times do i have to write int to string conversation? - // a library should do this - for(uint8_t i = 0; i < 8; i++) - { - char c = ((search_id>>(i*4))&0xF)+'A'; - idstr += c; - } - resp.mDataStream << makeKeyValueReference("search_id", idstr); - resp.setOk(); -} - -void FileSearchHandler::handleGetSearchResult(Request& req, Response& resp) -{ - std::string search_id; - req.mStream << makeKeyValueReference("search_id", search_id); - - if(search_id.size() != 8) - { - resp.setFail("Error: id has wrong size, should be 8 characters"); - return; - } - - uint32_t id = 0; - for(uint8_t i = 0; i < 8; i++) - { - id += (uint32_t(search_id[i]-'A')) << (i*4); - } - - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - std::map::iterator mit = mSearches.find(id); - if(mit == mSearches.end()) - { - resp.setFail("Error: search id invalid"); - return; - } - - Search& search = mit->second; - resp.mStateToken = search.mStateToken; - resp.mDataStream.getStreamToMember(); - - RsPgpId ownId = rsPeers->getGPGOwnId(); - for(std::list::iterator lit = search.mResults.begin(); lit != search.mResults.end(); ++lit) - { - FileDetail& fd = *lit; - bool isFriend = rsPeers->isFriend(fd.id); - bool isOwn = false; - if(ownId == rsPeers->getGPGId(fd.id)) - isOwn = true; - - double size = fd.size; - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("id", fd.hash) - << makeKeyValueReference("name", fd.name) - << makeKeyValueReference("hash", fd.hash) - << makeKeyValueReference("path", fd.path) - << makeKeyValue("peer_id", fd.id.toStdString()) - << makeKeyValueReference("is_friends", isFriend) - << makeKeyValueReference("is_own", isOwn) - << makeKeyValueReference("size", size) - << makeKeyValueReference("rank", fd.rank) - << makeKeyValueReference("age", fd.age); - } - } - resp.setOk(); -} - -} // namespace resource_api diff --git a/libresapi/src/api/FileSearchHandler.h b/libresapi/src/api/FileSearchHandler.h deleted file mode 100644 index ec1585eef..000000000 --- a/libresapi/src/api/FileSearchHandler.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * libresapi/api/FileSearchHandler.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once -#include "ResourceRouter.h" -#include "StateTokenServer.h" - -#include -#include -#include - -namespace resource_api -{ - -class FileSearchHandler: public ResourceRouter, NotifyClient -{ -public: - FileSearchHandler(StateTokenServer* sts, RsNotify* notify, RsTurtle* turtle, RsFiles* files); - virtual ~FileSearchHandler(); - - // from NotifyClient - virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list& files); -private: - void handleWildcard(Request& req, Response& resp); - void handleCreateSearch(Request& req, Response& resp); - void handleGetSearchResult(Request& req, Response& resp); - - StateTokenServer* mStateTokenServer; - RsNotify* mNotify; - //RsTurtle* mTurtle; - RsFiles* mRsFiles; - - class Search{ - public: - StateToken mStateToken; - std::string mSearchString; // extra service: store the search string - std::list mResults; - // a set for fast deduplication lookup - std::set mHashes; - }; - - RsMutex mMtx; - StateToken mSearchesStateToken; - std::map mSearches; // mutex protected -}; - -} // namespace resource_api diff --git a/libresapi/src/api/FileSharingHandler.cpp b/libresapi/src/api/FileSharingHandler.cpp deleted file mode 100644 index 5ad9b4601..000000000 --- a/libresapi/src/api/FileSharingHandler.cpp +++ /dev/null @@ -1,573 +0,0 @@ -/******************************************************************************* - * libresapi/api/FileSharingHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright (C) 2017, Konrad Dębiec * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "FileSharingHandler.h" - -namespace resource_api -{ - -FileSharingHandler::FileSharingHandler(StateTokenServer *sts, RsFiles *files, - RsNotify& notify): - mStateTokenServer(sts), mMtx("FileSharingHandler Mtx"), mRsFiles(files), - mNotify(notify) -{ - addResourceHandler("*", this, &FileSharingHandler::handleWildcard); - addResourceHandler("force_check", this, &FileSharingHandler::handleForceCheck); - - addResourceHandler("get_shared_dirs", this, &FileSharingHandler::handleGetSharedDir); - addResourceHandler("set_shared_dir", this, &FileSharingHandler::handleSetSharedDir); - addResourceHandler("update_shared_dir", this, &FileSharingHandler::handleUpdateSharedDir); - addResourceHandler("remove_shared_dir", this, &FileSharingHandler::handleRemoveSharedDir); - - addResourceHandler("get_dir_parent", this, &FileSharingHandler::handleGetDirectoryParent); - addResourceHandler("get_dir_childs", this, &FileSharingHandler::handleGetDirectoryChilds); - - addResourceHandler( "get_download_directory", this, - &FileSharingHandler::handleGetDownloadDirectory ); - addResourceHandler( "set_download_directory", this, - &FileSharingHandler::handleSetDownloadDirectory ); - - addResourceHandler( "get_partials_directory", this, - &FileSharingHandler::handleGetPartialsDirectory ); - addResourceHandler( "set_partials_directory", this, - &FileSharingHandler::handleSetPartialsDirectory ); - - addResourceHandler("is_dl_dir_shared", this, &FileSharingHandler::handleIsDownloadDirShared); - addResourceHandler("share_dl_dir", this, &FileSharingHandler::handleShareDownloadDirectory); - - addResourceHandler("download", this, &FileSharingHandler::handleDownload); - - mLocalDirStateToken = mStateTokenServer->getNewToken(); - mRemoteDirStateToken = mStateTokenServer->getNewToken(); - mNotify.registerNotifyClient(this); -} - -FileSharingHandler::~FileSharingHandler() -{ - mNotify.unregisterNotifyClient(this); -} - -void FileSharingHandler::notifyListChange(int list, int /* type */) -{ - if(list == NOTIFY_LIST_DIRLIST_LOCAL) - { - RS_STACK_MUTEX(mMtx); - mStateTokenServer->discardToken(mLocalDirStateToken); - mLocalDirStateToken = mStateTokenServer->getNewToken(); - } - else if(list == NOTIFY_LIST_DIRLIST_FRIENDS) - { - RS_STACK_MUTEX(mMtx); - mStateTokenServer->discardToken(mRemoteDirStateToken); - mRemoteDirStateToken = mStateTokenServer->getNewToken(); - } -} - -void FileSharingHandler::handleWildcard(Request & /*req*/, Response & /*resp*/) -{ - -} - -void FileSharingHandler::handleForceCheck(Request&, Response& resp) -{ - mRsFiles->ForceDirectoryCheck(); - resp.setOk(); -} - -void FileSharingHandler::handleGetSharedDir(Request& /*req*/, Response& resp) -{ - DirDetails dirDetails; - mRsFiles->RequestDirDetails(NULL, dirDetails, RS_FILE_HINTS_LOCAL); - - resp.mDataStream << makeKeyValue("parent_reference", *reinterpret_cast(&dirDetails.ref)); - resp.mDataStream << makeKeyValue("path", dirDetails.path); - StreamBase &childsStream = resp.mDataStream.getStreamToMember("childs"); - - for(std::vector::iterator it = dirDetails.children.begin(); it != dirDetails.children.end(); ++it) - { - DirDetails dirDetails; - mRsFiles->RequestDirDetails((*it).ref, dirDetails, RS_FILE_HINTS_LOCAL); - - for(std::vector::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit) - { - DirDetails dirDetails; - mRsFiles->RequestDirDetails((*vit).ref, dirDetails, RS_FILE_HINTS_LOCAL); - - std::string type; - switch(dirDetails.type) - { - case DIR_TYPE_PERSON: - type = "person"; - break; - case DIR_TYPE_DIR: - type = "folder"; - break; - case DIR_TYPE_FILE: - type = "file"; - break; - } - - bool browsable = false; - bool anon_dl = false; - bool anon_search = false; - - if(dirDetails.flags & DIR_FLAGS_BROWSABLE) - browsable = true; - - if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) - anon_dl = true; - - if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_SEARCH) - anon_search = true; - - StreamBase &streamBase = childsStream.getStreamToMember() - << makeKeyValue("name", dirDetails.name) - << makeKeyValue("path", dirDetails.path) - << makeKeyValue("hash", dirDetails.hash.toStdString()) - << makeKeyValue("peer_id", dirDetails.id.toStdString()) - << makeKeyValue("parent_reference", *reinterpret_cast(&dirDetails.parent)) - << makeKeyValue("reference", *reinterpret_cast(&dirDetails.ref)) - << makeKeyValue("count", static_cast(dirDetails.count)) - << makeKeyValueReference("type", type) - << makeKeyValueReference("browsable", browsable) - << makeKeyValueReference("anon_dl", anon_dl) - << makeKeyValueReference("anon_search", anon_search); - - - int contain_files = 0; - int contain_folders = 0; - - if(dirDetails.count != 0) - { - for(std::vector::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit) - { - DirDetails dirDetails; - mRsFiles->RequestDirDetails((*vit).ref, dirDetails, RS_FILE_HINTS_LOCAL); - - switch(dirDetails.type) - { - case DIR_TYPE_DIR: - contain_folders++; - break; - case DIR_TYPE_FILE: - contain_files++; - break; - } - } - } - - streamBase - << makeKeyValueReference("contain_files", contain_files) - << makeKeyValueReference("contain_folders", contain_folders); - } - } - - resp.mStateToken = mLocalDirStateToken; -} - -void FileSharingHandler::handleSetSharedDir(Request& req, Response& resp) -{ - std::string dir; - bool browsable = false; - bool anon_dl = false; - bool anon_search = false; - req.mStream << makeKeyValueReference("directory", dir); - req.mStream << makeKeyValueReference("browsable", browsable); - req.mStream << makeKeyValueReference("anon_dl", anon_dl); - req.mStream << makeKeyValueReference("anon_search", anon_search); - - SharedDirInfo sDI; - sDI.filename = dir; - sDI.virtualname.clear(); - sDI.shareflags.clear(); - - if(browsable) - sDI.shareflags |= DIR_FLAGS_BROWSABLE; - - if(anon_dl) - sDI.shareflags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD; - - if(anon_search) - sDI.shareflags |= DIR_FLAGS_ANONYMOUS_SEARCH; - - if(mRsFiles->addSharedDirectory(sDI)) - resp.setOk(); - else - resp.setFail("Couldn't share folder"); -} - -void FileSharingHandler::handleUpdateSharedDir(Request& req, Response& resp) -{ - std::string dir; - std::string virtualname; - bool browsable = false; - bool anon_dl = false; - bool anon_search = false; - req.mStream << makeKeyValueReference("directory", dir); - req.mStream << makeKeyValueReference("virtualname", virtualname); - req.mStream << makeKeyValueReference("browsable", browsable); - req.mStream << makeKeyValueReference("anon_dl", anon_dl); - req.mStream << makeKeyValueReference("anon_search", anon_search); - - SharedDirInfo sDI; - sDI.filename = dir; - sDI.virtualname = virtualname; - sDI.shareflags.clear(); - - if(browsable) - sDI.shareflags |= DIR_FLAGS_BROWSABLE; - - if(anon_dl) - sDI.shareflags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD; - - if(anon_search) - sDI.shareflags |= DIR_FLAGS_ANONYMOUS_SEARCH; - - if(mRsFiles->updateShareFlags(sDI)) - resp.setOk(); - else - resp.setFail("Couldn't update shared folder's flags"); -} - -void FileSharingHandler::handleRemoveSharedDir(Request& req, Response& resp) -{ - std::string dir; - req.mStream << makeKeyValueReference("directory", dir); - - if(mRsFiles->removeSharedDirectory(dir)) - resp.setOk(); - else - resp.setFail("Couldn't remove shared directory."); -} - -void FileSharingHandler::handleGetDirectoryParent(Request& req, Response& resp) -{ - int reference; - bool remote = false; - bool local = true; - - req.mStream << makeKeyValueReference("reference", reference); - req.mStream << makeKeyValueReference("remote", remote); - req.mStream << makeKeyValueReference("local", local); - - void *ref = reinterpret_cast(reference); - - FileSearchFlags flags; - if(remote) - { - flags |= RS_FILE_HINTS_REMOTE; - resp.mStateToken = mRemoteDirStateToken; - } - - if(local) - { - flags |= RS_FILE_HINTS_LOCAL; - resp.mStateToken = mLocalDirStateToken; - } - - DirDetails dirDetails; - mRsFiles->RequestDirDetails(ref, dirDetails, flags); - mRsFiles->RequestDirDetails(dirDetails.parent, dirDetails, flags); - - resp.mDataStream << makeKeyValue("parent_reference", *reinterpret_cast(&dirDetails.ref)); - resp.mDataStream << makeKeyValue("path", dirDetails.path); - StreamBase &childsStream = resp.mDataStream.getStreamToMember("childs"); - - if(dirDetails.count != 0) - { - for(std::vector::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit) - { - DirDetails dirDetails; - mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags); - - std::string type; - switch(dirDetails.type) - { - case DIR_TYPE_PERSON: - type = "person"; - break; - case DIR_TYPE_DIR: - type = "folder"; - break; - case DIR_TYPE_FILE: - type = "file"; - break; - } - - bool browsable = false; - bool anon_dl = false; - bool anon_search = false; - - if(dirDetails.flags & DIR_FLAGS_BROWSABLE) - browsable = true; - - if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) - anon_dl = true; - - if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_SEARCH) - anon_search = true; - - StreamBase &streamBase = childsStream.getStreamToMember() - << makeKeyValue("name", dirDetails.name) - << makeKeyValue("path", dirDetails.path) - << makeKeyValue("hash", dirDetails.hash.toStdString()) - << makeKeyValue("peer_id", dirDetails.id.toStdString()) - << makeKeyValue("parent_reference", *reinterpret_cast(&dirDetails.parent)) - << makeKeyValue("reference", *reinterpret_cast(&dirDetails.ref)) - << makeKeyValue("count", static_cast(dirDetails.count)) - << makeKeyValueReference("type", type) - << makeKeyValueReference("browsable", browsable) - << makeKeyValueReference("anon_dl", anon_dl) - << makeKeyValueReference("anon_search", anon_search); - - - int contain_files = 0; - int contain_folders = 0; - - if(dirDetails.count != 0) - { - for(std::vector::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit) - { - DirDetails dirDetails; - mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags); - - switch(dirDetails.type) - { - case DIR_TYPE_DIR: - contain_folders++; - break; - case DIR_TYPE_FILE: - contain_files++; - break; - } - } - } - - streamBase - << makeKeyValueReference("contain_files", contain_files) - << makeKeyValueReference("contain_folders", contain_folders); - } - } -} - -void FileSharingHandler::handleGetDirectoryChilds(Request& req, Response& resp) -{ - int reference = 0; - bool remote = false; - bool local = true; - - req.mStream << makeKeyValueReference("reference", reference); - req.mStream << makeKeyValueReference("remote", remote); - req.mStream << makeKeyValueReference("local", local); - - void *ref = reinterpret_cast(reference); - - FileSearchFlags flags; - if(remote) - { - flags |= RS_FILE_HINTS_REMOTE; - resp.mStateToken = mRemoteDirStateToken; - } - - if(local) - { - flags |= RS_FILE_HINTS_LOCAL; - resp.mStateToken = mLocalDirStateToken; - } - - DirDetails dirDetails; - mRsFiles->RequestDirDetails(ref, dirDetails, flags); - - resp.mDataStream << makeKeyValue("parent_reference", *reinterpret_cast(&dirDetails.ref)); - resp.mDataStream << makeKeyValue("path", dirDetails.path); - resp.mDataStream << makeKeyValue("hash", dirDetails.hash.toStdString()); - StreamBase &childsStream = resp.mDataStream.getStreamToMember("childs"); - - if(dirDetails.count != 0) - { - for(std::vector::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit) - { - DirDetails dirDetails; - mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags); - - std::string type; - switch(dirDetails.type) - { - case DIR_TYPE_PERSON: - type = "person"; - break; - case DIR_TYPE_DIR: - type = "folder"; - break; - case DIR_TYPE_FILE: - type = "file"; - break; - } - - bool browsable = false; - bool anon_dl = false; - bool anon_search = false; - - if(dirDetails.flags & DIR_FLAGS_BROWSABLE) - browsable = true; - - if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) - anon_dl = true; - - if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_SEARCH) - anon_search = true; - - StreamBase &streamBase = childsStream.getStreamToMember() - << makeKeyValue("name", dirDetails.name) - << makeKeyValue("path", dirDetails.path) - << makeKeyValue("hash", dirDetails.hash.toStdString()) - << makeKeyValue("peer_id", dirDetails.id.toStdString()) - << makeKeyValue("parent_reference", *reinterpret_cast(&dirDetails.parent)) - << makeKeyValue("reference", *reinterpret_cast(&dirDetails.ref)) - << makeKeyValue("count", static_cast(dirDetails.count)) - << makeKeyValueReference("type", type) - << makeKeyValueReference("browsable", browsable) - << makeKeyValueReference("anon_dl", anon_dl) - << makeKeyValueReference("anon_search", anon_search); - - - int contain_files = 0; - int contain_folders = 0; - - if(dirDetails.count != 0) - { - for(std::vector::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit) - { - DirDetails dirDetails; - mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags); - - switch(dirDetails.type) - { - case DIR_TYPE_DIR: - contain_folders++; - break; - case DIR_TYPE_FILE: - contain_files++; - break; - } - } - } - - streamBase - << makeKeyValueReference("contain_files", contain_files) - << makeKeyValueReference("contain_folders", contain_folders); - } - } -} - -void FileSharingHandler::handleIsDownloadDirShared(Request&, Response& resp) -{ - bool shared = mRsFiles->getShareDownloadDirectory(); - - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("shared", shared); - - resp.setOk(); -} - -void FileSharingHandler::handleShareDownloadDirectory(Request& req, Response& resp) -{ - bool share; - req.mStream << makeKeyValueReference("share", share); - - if(mRsFiles->shareDownloadDirectory(share)) - resp.setOk(); - else - resp.setFail("Couldn't share/unshare download directory."); -} - -void FileSharingHandler::handleDownload(Request& req, Response& resp) -{ - int size; - std::string hashString; - std::string name; - req.mStream << makeKeyValueReference("hash", hashString); - req.mStream << makeKeyValueReference("name", name); - req.mStream << makeKeyValueReference("size", size); - - std::list srcIds; - RsFileHash hash(hashString); - FileInfo finfo; - mRsFiles->FileDetails(hash, RS_FILE_HINTS_REMOTE, finfo); - - for(std::vector::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it) - srcIds.push_back((*it).peerId); - - if(!mRsFiles->FileRequest(name, hash, static_cast(size), "", - RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) - { - resp.setOk(); - return; - } - - resp.setFail("Couldn't download file"); -} - -void FileSharingHandler::handleGetDownloadDirectory( Request& /*req*/, - Response& resp ) -{ - std::string dlDir = mRsFiles->getDownloadDirectory(); - resp.mDataStream << makeKeyValueReference("download_directory", dlDir); - resp.setOk(); -} - -void FileSharingHandler::handleSetDownloadDirectory( Request& req, - Response& resp ) -{ - std::string dlDir; - req.mStream << makeKeyValueReference("download_directory", dlDir); - - if(dlDir.empty()) resp.setFail("missing download_directory"); - else - { - mRsFiles->setDownloadDirectory(dlDir); - resp.setOk(); - } -} - -void FileSharingHandler::handleGetPartialsDirectory( Request& /*req*/, - Response& resp ) -{ - std::string partialsDir = mRsFiles->getPartialsDirectory(); - resp.mDataStream << makeKeyValueReference("partials_directory", partialsDir); - resp.setOk(); -} - -void FileSharingHandler::handleSetPartialsDirectory( Request& req, - Response& resp ) -{ - std::string partialsDir; - req.mStream << makeKeyValueReference("partials_directory", partialsDir); - - if(partialsDir.empty()) resp.setFail("missing partials_directory"); - else - { - mRsFiles->setPartialsDirectory(partialsDir); - resp.setOk(); - } -} - -} // namespace resource_api diff --git a/libresapi/src/api/FileSharingHandler.h b/libresapi/src/api/FileSharingHandler.h deleted file mode 100644 index 887d4b9d3..000000000 --- a/libresapi/src/api/FileSharingHandler.h +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * libresapi/api/FileSharingHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright (C) 2017, Konrad Dębiec * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include "ResourceRouter.h" -#include "StateTokenServer.h" - -#include -#include -#include - -namespace resource_api -{ - -class FileSharingHandler: public ResourceRouter, NotifyClient -{ -public: - FileSharingHandler(StateTokenServer* sts, RsFiles* files, RsNotify& notify); - ~FileSharingHandler(); - - /** - Derived from NotifyClient - This function may be called from foreign thread - */ - virtual void notifyListChange(int list, int type); - -private: - void handleWildcard(Request& req, Response& resp); - void handleForceCheck(Request& req, Response& resp); - - void handleGetSharedDir(Request& req, Response& resp); - void handleSetSharedDir(Request& req, Response& resp); - void handleUpdateSharedDir(Request& req, Response& resp); - void handleRemoveSharedDir(Request& req, Response& resp); - - void handleGetDirectoryParent(Request& req, Response& resp); - void handleGetDirectoryChilds(Request& req, Response& resp); - - void handleIsDownloadDirShared(Request& req, Response& resp); - void handleShareDownloadDirectory(Request& req, Response& resp); - - void handleDownload(Request& req, Response& resp); - - void handleGetDownloadDirectory(Request& req, Response& resp); - void handleSetDownloadDirectory(Request& req, Response& resp); - - void handleGetPartialsDirectory(Request& req, Response& resp); - void handleSetPartialsDirectory(Request& req, Response& resp); - - /// Token indicating change in local shared files - StateToken mLocalDirStateToken; - - /// Token indicating change in remote (friends') shared files - StateToken mRemoteDirStateToken; - - StateTokenServer* mStateTokenServer; - - /** - Protects mLocalDirStateToken and mRemoteDirStateToken that may be changed in foreign thread - @see FileSharingHandler::notifyListChange(...) - */ - RsMutex mMtx; - - RsFiles* mRsFiles; - RsNotify& mNotify; -}; - -} // namespace resource_api diff --git a/libresapi/src/api/ForumHandler.cpp b/libresapi/src/api/ForumHandler.cpp deleted file mode 100644 index c6b6566b9..000000000 --- a/libresapi/src/api/ForumHandler.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * libresapi/api/ForumHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "ForumHandler.h" - -#include -#include - -#include "Operators.h" -#include "ApiTypes.h" -#include "GxsResponseTask.h" -#ifndef WINDOWS_SYS -#include "unistd.h" -#endif - -namespace resource_api -{ -ForumHandler::ForumHandler(RsGxsForums* forums): - mRsGxsForums(forums) -{ - addResourceHandler("*", this, &ForumHandler::handleWildcard); -} - -void ForumHandler::handleWildcard(Request &req, Response &resp) -{ - bool ok = true; - if(!req.mPath.empty()) - { - std::string str = req.mPath.top(); - req.mPath.pop(); - if(str != "") - { - //assume we have a groupID - RsGxsGroupId grpId(str); - std::list groupIds; - groupIds.push_back(grpId); - - uint32_t token; - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; - mRsGxsForums->getTokenService()->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds); - - time_t start = time(NULL); - while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) - &&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10))) - ) - { - #ifdef WINDOWS_SYS - Sleep(500); - #else - usleep(500*1000) ; - #endif - } - - if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE) - { - std::vector grps; - ok &= mRsGxsForums->getMsgData(token, grps); - for(std::vector::iterator vit = grps.begin(); vit != grps.end(); vit++) - { - RsGxsForumMsg& grp = *vit; - KeyValueReference group_id("group_id", grp.mMeta.mGroupId); - resp.mDataStream.getStreamToMember() - << group_id - << makeKeyValueReference("name", grp.mMeta.mMsgName) - << makeKeyValueReference("id", grp.mMeta.mMsgId) - << makeKeyValueReference("parent_id", grp.mMeta.mParentId) - << makeKeyValueReference("author_id", grp.mMeta.mAuthorId) - << makeKeyValueReference("orig_msg_id", grp.mMeta.mOrigMsgId) - << makeKeyValueReference("thread_id", grp.mMeta.mThreadId) - << makeKeyValueReference("message", grp.mMsg); - } - } - else - { - ok = false; - } - - } - - } - else - { - // no more path element - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - uint32_t token; - mRsGxsForums->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts); - - time_t start = time(NULL); - while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) - &&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10))) - ) - { - #ifdef WINDOWS_SYS - Sleep(500); - #else - usleep(500*1000) ; - #endif - } - if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE) - { - std::vector grps; - ok &= mRsGxsForums->getGroupData(token, grps); - for(std::vector::iterator vit = grps.begin(); vit != grps.end(); vit++) - { - RsGxsForumGroup& grp = *vit; - KeyValueReference id("id", grp.mMeta.mGroupId); - KeyValueReference vis_msg("visible_msg_count", grp.mMeta.mVisibleMsgCount); - //KeyValueReference pgp_id("pgp_id",grp.mPgpId ); - // not very happy about this, i think the flags should stay hidden in rsidentities - bool own = (grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN); - bool pgp_linked = (grp.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility); - bool subscribed = IS_GROUP_SUBSCRIBED(grp.mMeta.mSubscribeFlags); - resp.mDataStream.getStreamToMember() - << id - //<< pgp_id - << makeKeyValueReference("name", grp.mMeta.mGroupName) - //<< makeKeyValueReference("last_post", grp.mMeta.mLastPost) - << makeKeyValueReference("pop", grp.mMeta.mPop) - //<< makeKeyValueReference("publish_ts", grp.mMeta.mPublishTs) - << vis_msg - << makeKeyValueReference("group_status", grp.mMeta.mGroupStatus) - << makeKeyValueReference("author_id", grp.mMeta.mAuthorId) - << makeKeyValueReference("parent_grp_id", grp.mMeta.mParentGrpId) - << makeKeyValueReference("description", grp.mDescription) - << makeKeyValueReference("own", own) - << makeKeyValueReference("subscribed", subscribed) - << makeKeyValueReference("pgp_linked", pgp_linked); - } - } - else - { - ok = false; - } - } - - - if(ok) - { - resp.setOk(); - } - else - { - resp.setFail(); - } -} - -} // namespace resource_api diff --git a/libresapi/src/api/ForumHandler.h b/libresapi/src/api/ForumHandler.h deleted file mode 100644 index e5225bb22..000000000 --- a/libresapi/src/api/ForumHandler.h +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * libresapi/api/ForumHandler.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#ifndef FORUMHANDLER_H -#define FORUMHANDLER_H - -#include "ResourceRouter.h" - -class RsGxsForums; - -namespace resource_api -{ - -class ForumHandler : public ResourceRouter -{ -public: - ForumHandler(RsGxsForums* forums); -private: - RsGxsForums* mRsGxsForums; - void handleWildcard(Request& req, Response& resp); -}; -} // namespace resource_api -#endif // FORUMHANDLER_H diff --git a/libresapi/src/api/GetPluginInterfaces.cpp b/libresapi/src/api/GetPluginInterfaces.cpp deleted file mode 100644 index 5375d0eea..000000000 --- a/libresapi/src/api/GetPluginInterfaces.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * libresapi/api/GetPluginInterfaces.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "GetPluginInterfaces.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace resource_api{ - -bool getPluginInterfaces(RsPlugInInterfaces& interfaces) -{ - // when rsPlugins is null, then rs was not started - if(rsPlugins == 0) - return false; - - interfaces.mFiles = rsFiles; - interfaces.mPeers = rsPeers; - interfaces.mMsgs = rsMsgs; - interfaces.mTurtle = rsTurtle; - interfaces.mDisc = rsDisc; - interfaces.mDht = rsDht; - interfaces.mNotify = rsNotify; - interfaces.mServiceControl = rsServiceControl; - interfaces.mPluginHandler = rsPlugins; - - // gxs - interfaces.mGxsDir = ""; - interfaces.mIdentity = rsIdentity; - // not exposed with global variable, can't get it - interfaces.mRsNxsNetMgr = 0; - // same as identity service, but different interface - interfaces.mGxsIdService = 0; - // - interfaces.mGxsCirlces = 0; - // not exposed with global variable - interfaces.mPgpAuxUtils = 0; - interfaces.mGxsForums = rsGxsForums; - interfaces.mGxsChannels = rsGxsChannels; - return true; -} - -} // namespace resource_api diff --git a/libresapi/src/api/GetPluginInterfaces.h b/libresapi/src/api/GetPluginInterfaces.h deleted file mode 100644 index 9434da3aa..000000000 --- a/libresapi/src/api/GetPluginInterfaces.h +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * libresapi/api/GetPluginInterfaces.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -class RsPlugInInterfaces; - -namespace resource_api{ - -// populates the given RsPlugInInterfaces object with pointers from gloabl variables like rsPeers, rsMsgs, rsFiles... -bool getPluginInterfaces(RsPlugInInterfaces& interfaces); - -} // namespace resource_api diff --git a/libresapi/src/api/GxsMetaOperators.h b/libresapi/src/api/GxsMetaOperators.h deleted file mode 100644 index ec6a98b9b..000000000 --- a/libresapi/src/api/GxsMetaOperators.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include - -// operators for rsgxsgrpmeta and rsgxsmsgmeta -// diff --git a/libresapi/src/api/GxsResponseTask.cpp b/libresapi/src/api/GxsResponseTask.cpp deleted file mode 100644 index 2a35c979d..000000000 --- a/libresapi/src/api/GxsResponseTask.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * libresapi/api/GxsResponseTask.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "GxsResponseTask.h" - -#include "Operators.h" - -namespace resource_api -{ - -GxsResponseTask::GxsResponseTask(RsIdentity *id_service, RsTokenService *token_service): - mIdService(id_service), mTokenService(token_service), - mDone(false) -{ - -} - -bool GxsResponseTask::doWork(Request &req, Response &resp) -{ - bool ready = true; - // check if gxs requests are ready - if(mTokenService && !mWaitingTokens.empty()) - { - for(std::vector::iterator vit = mWaitingTokens.begin(); vit != mWaitingTokens.end(); ++vit) - { - uint8_t status = mTokenService->requestStatus(*vit); - if(status != RsTokenService::COMPLETE) - { - ready = false; - } - if(status == RsTokenService::FAILED) - { - std::cerr << "GxsResponseTask::doWork() Error: token failed. aborting." << std::endl; - resp.setFail("GxsResponseTask::doWork() Error: token failed."); - return false; // don't continue - } - } - } - - if(mIdService == 0) - { - std::cerr << "GxsResponseTask::doWork() ERROR: constucted with idservice = 0. Fix your code or report this bug." << std::endl; - resp.setFail("GxsResponseTask::doWork() ERROR: constucted with idservice = 0. Fix your code or report this bug."); - return false; // don't continue - } - - // check if we have identities to fetch - bool more = true; - while(!mIdentitiesToFetch.empty() && more) - { - // there are two methods to fetch identity data: - // - request gxs group, get token, get group - // - the direct way where we may have to wait, but identities will cache the result - // if we need to get many identuties, then we may flush the cache - // but if we reaquest the groups, no caching is done on the rs side (OS will cache the identities file) - // it has to be measured what is better - RsGxsId id = mIdentitiesToFetch.back(); - RsIdentityDetails details; - if(mIdService->getIdDetails(id, details)) - { - mIdentitiesToFetch.pop_back(); - mIdentityDetails.push_back(details); - } - else - { - more = false; // pause when an id failed, to give the service time tim fetch the data - ready = false; - // TODO: remove identities which failed many times from list, to avoid blocking when ids fail - } - } - if(!ready) - return true; // want to continue later - - mWaitingTokens.clear(); - mIdentitiesToFetch.clear(); - gxsDoWork(req, resp); - - if(mDone) return false; - else return true; -} - -void GxsResponseTask::addWaitingToken(uint32_t token) -{ - if(mTokenService) - mWaitingTokens.push_back(token); - else - std::cerr << "GxsResponseTask::addWaitingToken() ERROR: constructed with tokenservice=0. Unable to handle token processing. Fix your code or report this bug." << std::endl; -} - -void GxsResponseTask::done() -{ - mDone = true; -} - -void GxsResponseTask::requestGxsId(RsGxsId id) -{ - mIdentitiesToFetch.push_back(id); -} - -void GxsResponseTask::streamGxsId(RsGxsId id, StreamBase &stream) -{ - // will see if this works or if we have to use an index - for(std::vector::iterator vit = mIdentityDetails.begin(); - vit != mIdentityDetails.end(); ++vit) - { - if(vit->mId == id) - { - stream << makeKeyValueReference("id", id) - << makeKeyValueReference("gxs_id", id) - << makeKeyValueReference("flags", vit->mFlags) - << makeKeyValueReference("name", vit->mNickname); - return; - } - } -} - -std::string GxsResponseTask::getName(RsGxsId id) -{ - for(std::vector::iterator vit = mIdentityDetails.begin(); - vit != mIdentityDetails.end(); ++vit) - { - if(vit->mId == id) - return vit->mNickname; - } - std::cerr << "Warning: identity not found in GxsResponseTask::getName(). This is probably a bug. You must call GxsResponseTask::requestGxsId() before you can get the name." << std::endl; - return ""; -} - - -} // namespace resource_api diff --git a/libresapi/src/api/GxsResponseTask.h b/libresapi/src/api/GxsResponseTask.h deleted file mode 100644 index 30c30bc40..000000000 --- a/libresapi/src/api/GxsResponseTask.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * libresapi/api/GxsResponseTask.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include "ApiTypes.h" -#include - -namespace resource_api -{ -// parent class for all responses that use the gxs backend -// this class implements the polling for gxs-tokens -// child classes pass gxs tokens to this class - -// question: should this class be able to handle tokens from different services? -// then we would have to store a pointer to the token service for ever token -class GxsResponseTask: public ResponseTask -{ -public: - // token service is allowed to be null if no token functions are wanted - GxsResponseTask(RsIdentity* id_service, RsTokenService* token_service = 0); - virtual bool doWork(Request &req, Response& resp); - -protected: - // this method gets called when all the pending tokens have either status ok or fail - // (= when the requests for these tokens are processed) - // how will the child class find out if a request failed? - // idea: don't call gxsDoWork() when a request failed, instead set the api response to fail - // con: then the child class has no way to tell the outside world which request failed - // pro: child class gets simpler, because no special error handling is required - // implement this in a child class - virtual void gxsDoWork(Request& req, Response& resp) = 0; - - // call this to wait for tokens before the next call to gxsDoWork() - void addWaitingToken(uint32_t token); - // call this to end the task - void done(); - // request name for gxs id - void requestGxsId(RsGxsId id); - // call stream function in the next cycle, then the names are available - void streamGxsId(RsGxsId id, StreamBase& stream); - std::string getName(RsGxsId id); -private: - RsIdentity* mIdService; - RsTokenService* mTokenService; - - std::vector mWaitingTokens; - bool mDone; - - std::vector mIdentitiesToFetch; - std::vector mIdentityDetails; -}; - -} // namespace resource_api diff --git a/libresapi/src/api/IdentityHandler.cpp b/libresapi/src/api/IdentityHandler.cpp deleted file mode 100644 index e82b857a0..000000000 --- a/libresapi/src/api/IdentityHandler.cpp +++ /dev/null @@ -1,722 +0,0 @@ -/******************************************************************************* - * libresapi/api/IdentityHandler.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright (C) 2015 electron128 * - * Copyright (C) 2017 Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ - -#include "IdentityHandler.h" - -#include -#include -#include -#include - -#include "Operators.h" -#include "ApiTypes.h" -#include "GxsResponseTask.h" -#ifndef WINDOWS_SYS -#include "unistd.h" -#endif - -namespace resource_api -{ - -class SendIdentitiesListTask: public GxsResponseTask -{ -public: - SendIdentitiesListTask(RsIdentity* idservice, std::list ids, StateToken state): - GxsResponseTask(idservice, 0), mStateToken(state) - { - for(std::list::iterator vit = ids.begin(); vit != ids.end(); ++vit) - { - requestGxsId(*vit); - mIds.push_back(*vit);// convert from list to vector - } - } -private: - std::vector mIds; - StateToken mStateToken; -protected: - virtual void gxsDoWork(Request& /*req*/, Response &resp) - { - resp.mDataStream.getStreamToMember(); - for(std::vector::iterator vit = mIds.begin(); vit != mIds.end(); ++vit) - { - streamGxsId(*vit, resp.mDataStream.getStreamToMember()); - } - resp.mStateToken = mStateToken; - resp.setOk(); - done(); - } - -}; - -class CreateIdentityTask: public GxsResponseTask -{ -public: - CreateIdentityTask(RsIdentity* idservice): - GxsResponseTask(idservice, idservice->getTokenService()), mState(BEGIN), mToken(0), mRsIdentity(idservice){} -private: - enum State {BEGIN, WAIT_ACKN, WAIT_ID}; - State mState; - uint32_t mToken; - RsIdentity* mRsIdentity; - RsGxsId mId; -protected: - virtual void gxsDoWork(Request &req, Response &resp) - { - switch(mState) - { - case BEGIN:{ - RsIdentityParameters params; - req.mStream - << makeKeyValueReference("name", params.nickname) - << makeKeyValueReference("pgp_linked", params.isPgpLinked); - - std::string avatar; - req.mStream << makeKeyValueReference("avatar", avatar); - - std::vector avatar_data = Radix64::decode(avatar); - uint8_t *p_avatar_data = &avatar_data[0]; - uint32_t size = avatar_data.size(); - params.mImage.clear(); - params.mImage.copy(p_avatar_data, size); - - if(params.nickname == "") - { - resp.setFail("name can't be empty"); - done(); - return; - } - mRsIdentity->createIdentity(mToken, params); - addWaitingToken(mToken); - mState = WAIT_ACKN; - break; - } - case WAIT_ACKN:{ - RsGxsGroupId grpId; - if(!mRsIdentity->acknowledgeGrp(mToken, grpId)) - { - resp.setFail("acknowledge of group id failed"); - done(); - return; - } - mId = RsGxsId(grpId); - requestGxsId(mId); - mState = WAIT_ID; - break; - } - case WAIT_ID: - streamGxsId(mId, resp.mDataStream); - resp.setOk(); - done(); - } - } -}; - -class DeleteIdentityTask : public GxsResponseTask -{ -public: - DeleteIdentityTask(RsIdentity* idservice) : - GxsResponseTask(idservice, idservice->getTokenService()), - mToken(0), - mRsIdentity(idservice) - {} - -protected: - virtual void gxsDoWork(Request &req, Response & /* resp */) - { - RsGxsIdGroup group; - std::string gxs_id; - - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - group.mMeta.mGroupId = RsGxsGroupId(gxs_id); - - mRsIdentity->deleteIdentity(mToken, group); - addWaitingToken(mToken); - - done(); - return; - } - -private: - uint32_t mToken; - RsIdentity* mRsIdentity; - RsGxsId mId; -}; - -IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, - RsIdentity *identity) : - mStateTokenServer(sts), mNotify(notify), mRsIdentity(identity), - mMtx("IdentityHandler Mtx"), mStateToken(sts->getNewToken()) -{ - mNotify->registerNotifyClient(this); - - addResourceHandler("*", this, &IdentityHandler::handleWildcard); - addResourceHandler("own", this, &IdentityHandler::handleOwn); - - addResourceHandler("own_ids", this, &IdentityHandler::handleOwnIdsRequest); - addResourceHandler("notown_ids", this, - &IdentityHandler::handleNotOwnIdsRequest); - - addResourceHandler("export_key", this, &IdentityHandler::handleExportKey); - addResourceHandler("import_key", this, &IdentityHandler::handleImportKey); - - addResourceHandler("add_contact", this, &IdentityHandler::handleAddContact); - addResourceHandler("remove_contact", this, &IdentityHandler::handleRemoveContact); - - addResourceHandler("create_identity", this, &IdentityHandler::handleCreateIdentity); - addResourceHandler("delete_identity", this, &IdentityHandler::handleDeleteIdentity); - - addResourceHandler("get_identity_details", this, &IdentityHandler::handleGetIdentityDetails); - - addResourceHandler("get_avatar", this, &IdentityHandler::handleGetAvatar); - addResourceHandler("set_avatar", this, &IdentityHandler::handleSetAvatar); - - addResourceHandler("set_ban_node", this, &IdentityHandler::handleSetBanNode); - addResourceHandler("set_opinion", this, &IdentityHandler::handleSetOpinion); -} - -IdentityHandler::~IdentityHandler() -{ - mNotify->unregisterNotifyClient(this); -} - -void IdentityHandler::notifyGxsChange(const RsGxsChanges &changes) -{ - RS_STACK_MUTEX(mMtx); - // if changes come from identity service, invalidate own state token - if(changes.mService == mRsIdentity->getTokenService()) - mStateTokenServer->replaceToken(mStateToken); -} - -void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp) -{ - bool ok = true; - - { - RS_STACK_MUTEX(mMtx); - resp.mStateToken = mStateToken; - } - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - uint32_t token; - mRsIdentity->getTokenService()->requestGroupInfo( - token, RS_TOKREQ_ANSTYPE_DATA, opts); - - time_t timeout = time(NULL)+10; - uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token); - while( rStatus != RsTokenService::COMPLETE && - rStatus != RsTokenService::FAILED && - time(NULL) < timeout ) - { - usleep(50*1000); - rStatus = mRsIdentity->getTokenService()->requestStatus(token); - } - - if(rStatus == RsTokenService::COMPLETE) - { - std::vector grps; - ok &= mRsIdentity->getGroupData(token, grps); - for( std::vector::iterator vit = grps.begin(); - vit != grps.end(); ++vit ) - { - RsGxsIdGroup& grp = *vit; - /* electron: not very happy about this, i think the flags should - * stay hidden in rsidentities */ - bool own = (grp.mMeta.mSubscribeFlags & - GXS_SERV::GROUP_SUBSCRIBE_ADMIN); - bool pgp_linked = (grp.mMeta.mGroupFlags & - RSGXSID_GROUPFLAG_REALID_kept_for_compatibility); - resp.mDataStream.getStreamToMember() -#warning Gioacchino Mazzurco 2017-03-24: @deprecated using "id" as key can cause problems in some JS based \ - languages like Qml @see gxs_id instead - << makeKeyValueReference("id", grp.mMeta.mGroupId) - << makeKeyValueReference("gxs_id", grp.mMeta.mGroupId) - << makeKeyValueReference("pgp_id",grp.mPgpId ) - << makeKeyValueReference("name", grp.mMeta.mGroupName) - << makeKeyValueReference("contact", grp.mIsAContact) - << makeKeyValueReference("own", own) - << makeKeyValueReference("pgp_linked", pgp_linked) - << makeKeyValueReference("is_contact", grp.mIsAContact); - } - } - else ok = false; - - if(ok) resp.setOk(); - else resp.setFail(); -} - -void IdentityHandler::handleNotOwnIdsRequest(Request & /*req*/, Response &resp) -{ - bool ok = true; - - { - RS_STACK_MUTEX(mMtx); - resp.mStateToken = mStateToken; - } - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - uint32_t token; - mRsIdentity->getTokenService()->requestGroupInfo( - token, RS_TOKREQ_ANSTYPE_DATA, opts); - - time_t timeout = time(NULL)+10; - uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token); - while( rStatus != RsTokenService::COMPLETE && - rStatus != RsTokenService::FAILED && - time(NULL) < timeout ) - { - usleep(50*1000); - rStatus = mRsIdentity->getTokenService()->requestStatus(token); - } - - if(rStatus == RsTokenService::COMPLETE) - { - std::vector grps; - ok &= mRsIdentity->getGroupData(token, grps); - for(std::vector::iterator vit = grps.begin(); - vit != grps.end(); vit++) - { - RsGxsIdGroup& grp = *vit; - if(!(grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)) - { - bool pgp_linked = ( - grp.mMeta.mGroupFlags & - RSGXSID_GROUPFLAG_REALID_kept_for_compatibility ); - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("gxs_id", grp.mMeta.mGroupId) - << makeKeyValueReference("pgp_id",grp.mPgpId ) - << makeKeyValueReference("name", grp.mMeta.mGroupName) - << makeKeyValueReference("pgp_linked", pgp_linked) - << makeKeyValueReference("is_contact", grp.mIsAContact); - } - } - } - else ok = false; - - if(ok) resp.setOk(); - else resp.setFail(); -} - -void IdentityHandler::handleOwnIdsRequest(Request & /*req*/, Response &resp) -{ - bool ok = true; - - { - RS_STACK_MUTEX(mMtx); - resp.mStateToken = mStateToken; - } - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - uint32_t token; - mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts); - - time_t start = time(NULL); - while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) - &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10))) - ) - { -#ifdef WINDOWS_SYS - Sleep(500); -#else - usleep(500*1000); -#endif - } - - if(mRsIdentity->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE) - { - std::vector grps; - ok &= mRsIdentity->getGroupData(token, grps); - for(std::vector::iterator vit = grps.begin(); vit != grps.end(); vit++) - { - RsGxsIdGroup& grp = *vit; - //electron: not very happy about this, i think the flags should stay hidden in rsidentities - if(vit->mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) - { - bool pgp_linked = (grp.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility ) ; - resp.mDataStream.getStreamToMember() - << makeKeyValueReference("own_gxs_id", grp.mMeta.mGroupId) - << makeKeyValueReference("pgp_id",grp.mPgpId ) - << makeKeyValueReference("name", grp.mMeta.mGroupName) - << makeKeyValueReference("pgp_linked", pgp_linked); - } - } - - } - else - ok = false; - - if(ok) resp.setOk(); - else resp.setFail(); -} - -void IdentityHandler::handleAddContact(Request& req, Response& resp) -{ - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - - mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), true); - - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - mStateTokenServer->replaceToken(mStateToken); - } - - resp.setOk(); -} - -void IdentityHandler::handleRemoveContact(Request& req, Response& resp) -{ - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - - mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), false); - - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - mStateTokenServer->replaceToken(mStateToken); - } - - resp.setOk(); -} - -void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp) -{ - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - uint32_t token; - - std::list groupIds; - groupIds.push_back(RsGxsGroupId(gxs_id)); - mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds); - - time_t start = time(NULL); - while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) - &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10))) - ) - { -#ifdef WINDOWS_SYS - Sleep(500); -#else - usleep(500*1000); -#endif - } - - RsGxsIdGroup data; - std::vector datavector; - if (!mRsIdentity->getGroupData(token, datavector)) - { - resp.setFail(); - return; - } - - if(datavector.empty()) - { - resp.setFail(); - return; - } - - data = datavector[0]; - - resp.mDataStream << makeKeyValue("gxs_name", data.mMeta.mGroupName); - resp.mDataStream << makeKeyValue("gxs_id", data.mMeta.mGroupId.toStdString()); - - resp.mDataStream << makeKeyValue("pgp_id_known", data.mPgpKnown); - resp.mDataStream << makeKeyValue("pgp_id", data.mPgpId.toStdString()); - - std::string pgp_name; - if (data.mPgpKnown) - { - RsPeerDetails details; - rsPeers->getGPGDetails(data.mPgpId, details); - pgp_name = details.name; - } - else - { - if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility) - pgp_name = "[Unknown node]"; - else - pgp_name = "Anonymous Id"; - } - resp.mDataStream << makeKeyValue("pgp_name", pgp_name); - - resp.mDataStream << makeKeyValue("last_usage", (uint32_t)data.mLastUsageTS); - - bool isAnonymous = false; - if(!data.mPgpKnown) - { - if (!(data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility)) - isAnonymous = true; - } - resp.mDataStream << makeKeyValue("anonymous", isAnonymous); - - - bool isOwnId = (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN); - resp.mDataStream << makeKeyValue("own", isOwnId); - - std::string type; - if(isOwnId) - { - if (data.mPgpKnown && !data.mPgpId.isNull()) - type = "Identity owned by you, linked to your Retroshare node"; - else - type = "Anonymous identity, owned by you"; - } - else if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility) - { - if (data.mPgpKnown) - { - if (rsPeers->isGPGAccepted(data.mPgpId)) - type = "Linked to a friend Retroshare node"; - else - type = "Linked to a known Retroshare node"; - } - else - type = "Linked to unknown Retroshare node"; - } - else - type = "Anonymous identity"; - - resp.mDataStream << makeKeyValue("type", type); - - resp.mDataStream << makeKeyValue("bannned_node", rsReputations->isNodeBanned(data.mPgpId)); - - RsReputationInfo info; - rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId), data.mPgpId, info); - resp.mDataStream << makeKeyValue("friends_positive_votes", info.mFriendsPositiveVotes); - resp.mDataStream << makeKeyValue("friends_negative_votes", info.mFriendsNegativeVotes); - resp.mDataStream << makeKeyValue("overall_reputation_level", (int)info.mOverallReputationLevel); - resp.mDataStream << makeKeyValue("own_opinion", (int)info.mOwnOpinion); - - RsIdentityDetails details; - mRsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId), details); - - std::string base64Avatar; - Radix64::encode(details.mAvatar.mData, details.mAvatar.mSize, base64Avatar); - resp.mDataStream << makeKeyValue("avatar", base64Avatar); - - StreamBase& usagesStream = resp.mDataStream.getStreamToMember("usages"); - usagesStream.getStreamToMember(); - - for(auto it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it) - { - usagesStream.getStreamToMember() - << makeKeyValue("usage_time", (uint32_t)data.mLastUsageTS) - << makeKeyValue("usage_service", (int)(it->first.mServiceId)) - << makeKeyValue("usage_case", (int)(it->first.mUsageCode)); - } - - resp.setOk(); -} - -void IdentityHandler::handleSetAvatar(Request& req, Response& resp) -{ - std::string gxs_id; - std::string avatar; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - req.mStream << makeKeyValueReference("avatar", avatar); - - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - uint32_t token; - - std::list groupIds; - groupIds.push_back(RsGxsGroupId(gxs_id)); - mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds); - - time_t start = time(NULL); - while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) - &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED) - &&((time(NULL) < (start+10))) - ) - { -#ifdef WINDOWS_SYS - Sleep(500); -#else - usleep(500*1000); -#endif - } - - RsGxsIdGroup data; - std::vector datavector; - if (!mRsIdentity->getGroupData(token, datavector)) - { - resp.setFail(); - return; - } - - if(datavector.empty()) - { - resp.setFail(); - return; - } - - data = datavector[0]; - - if(!avatar.empty()) - { - std::vector avatar_data = Radix64::decode(avatar); - uint8_t *p_avatar_data = &avatar_data[0]; - uint32_t size = avatar_data.size(); - data.mImage.clear(); - data.mImage.copy(p_avatar_data, size); - - std::string base64Avatar; - Radix64::encode(data.mImage.mData, data.mImage.mSize, base64Avatar); - resp.mDataStream << makeKeyValue("avatar", base64Avatar); - } - else - data.mImage.clear(); - - uint32_t dummyToken = 0; - mRsIdentity->updateIdentity(dummyToken, data); - - resp.setOk(); -} - -void IdentityHandler::handleGetAvatar(Request& req, Response& resp) -{ - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - - RsIdentityDetails details; - bool got = mRsIdentity->getIdDetails(RsGxsId(gxs_id), details); - - std::string base64Avatar; - Radix64::encode(details.mAvatar.mData, details.mAvatar.mSize, base64Avatar); - resp.mDataStream << makeKeyValue("avatar", base64Avatar); - - if(got) - resp.setOk(); - else - resp.setFail(); -} - -void IdentityHandler::handleSetBanNode(Request& req, Response& resp) -{ - std::string pgp_id; - req.mStream << makeKeyValueReference("pgp_id", pgp_id); - RsPgpId pgpId(pgp_id); - - bool banned_node; - req.mStream << makeKeyValueReference("banned_node", banned_node); - rsReputations->banNode(pgpId, banned_node); - - resp.setOk(); -} - -void IdentityHandler::handleSetOpinion(Request& req, Response& resp) -{ - std::string gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - RsGxsId gxsId(gxs_id); - - int own_opinion; - req.mStream << makeKeyValueReference("own_opinion", own_opinion); - - RsOpinion opinion; - switch(own_opinion) - { - case 0: opinion = RsOpinion::NEGATIVE; break; - case 1: opinion = RsOpinion::NEUTRAL; break; - case 2: opinion = RsOpinion::POSITIVE; break; - default: - resp.setFail(); - return; - } - rsReputations->setOwnOpinion(gxsId, opinion); - - resp.setOk(); -} - -ResponseTask* IdentityHandler::handleOwn(Request & /* req */, Response &resp) -{ - StateToken state; - { - RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** - state = mStateToken; - } - std::list ids; - if(mRsIdentity->getOwnIds(ids)) - return new SendIdentitiesListTask(mRsIdentity, ids, state); - resp.mDataStream.getStreamToMember(); - resp.setWarning("identities not loaded yet"); - return 0; -} - -ResponseTask* IdentityHandler::handleCreateIdentity(Request & /* req */, Response & /* resp */) -{ - return new CreateIdentityTask(mRsIdentity); -} - -void IdentityHandler::handleExportKey(Request& req, Response& resp) -{ - RsGxsId gxs_id; - req.mStream << makeKeyValueReference("gxs_id", gxs_id); - - std::string radix; - time_t timeout = time(NULL)+2; - bool found = mRsIdentity->serialiseIdentityToMemory(gxs_id, radix); - while(!found && time(nullptr) < timeout) - { - usleep(5000); - found = mRsIdentity->serialiseIdentityToMemory(gxs_id, radix); - } - - if(found) - { - resp.mDataStream << makeKeyValueReference("gxs_id", gxs_id) - << makeKeyValueReference("radix", radix); - - resp.setOk(); - return; - } - - resp.setFail(); -} - -void IdentityHandler::handleImportKey(Request& req, Response& resp) -{ - std::string radix; - req.mStream << makeKeyValueReference("radix", radix); - - RsGxsId gxs_id; - if(mRsIdentity->deserialiseIdentityFromMemory(radix, &gxs_id)) - { - resp.mDataStream << makeKeyValueReference("gxs_id", gxs_id) - << makeKeyValueReference("radix", radix); - resp.setOk(); - return; - } - - resp.setFail(); -} - -ResponseTask* IdentityHandler::handleDeleteIdentity(Request& /*req*/, - Response& /*resp*/) -{ return new DeleteIdentityTask(mRsIdentity); } - -} // namespace resource_api diff --git a/libresapi/src/api/IdentityHandler.h b/libresapi/src/api/IdentityHandler.h deleted file mode 100644 index 84b39878f..000000000 --- a/libresapi/src/api/IdentityHandler.h +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * libresapi/api/IdentityHandler.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright (C) 2015 electron128 * - * Copyright (C) 2017 Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include -#include - -#include "ResourceRouter.h" -#include "StateTokenServer.h" - -struct RsIdentity; - -namespace resource_api -{ - -class IdentityHandler: public ResourceRouter, NotifyClient -{ -public: - IdentityHandler(StateTokenServer* sts, RsNotify* notify, RsIdentity* identity); - virtual ~IdentityHandler(); - - // from NotifyClient - // note: this may get called from foreign threads - virtual void notifyGxsChange(const RsGxsChanges &changes); - -private: - void handleWildcard(Request& req, Response& resp); - void handleNotOwnIdsRequest(Request& req, Response& resp); - void handleOwnIdsRequest(Request& req, Response& resp); - - void handleExportKey(Request& req, Response& resp); - void handleImportKey(Request& req, Response& resp); - - void handleAddContact(Request& req, Response& resp); - void handleRemoveContact(Request& req, Response& resp); - - void handleGetIdentityDetails(Request& req, Response& resp); - - void handleGetAvatar(Request& req, Response& resp); - void handleSetAvatar(Request& req, Response& resp); - - void handleSetBanNode(Request& req, Response& resp); - void handleSetOpinion(Request& req, Response& resp); - - ResponseTask *handleOwn(Request& req, Response& resp); - ResponseTask *handleCreateIdentity(Request& req, Response& resp); - ResponseTask *handleDeleteIdentity(Request& req, Response& resp); - - StateTokenServer* mStateTokenServer; - RsNotify* mNotify; - RsIdentity* mRsIdentity; - - RsMutex mMtx; - StateToken mStateToken; // mutex protected -}; -} // namespace resource_api diff --git a/libresapi/src/api/JsonStream.cpp b/libresapi/src/api/JsonStream.cpp deleted file mode 100644 index 4e6cffb6c..000000000 --- a/libresapi/src/api/JsonStream.cpp +++ /dev/null @@ -1,545 +0,0 @@ -/******************************************************************************* - * libresapi/api/jsonStream.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "JsonStream.h" -#include - -namespace resource_api -{ - -JsonStream::JsonStream(): - mSerialise(true), mDataType(TYPE_UNDEFINED), mArrayNextRead(0), mIsOk(true), mChild(NULL) -{ - -} - -JsonStream::~JsonStream() -{ - deleteCurrentChild(); -} - -void JsonStream::setJsonString(std::string jsonStr) -{ - mRawString = jsonStr; - // have to delay the deserialisation, because this stream can also be a raw data stream without json - // can find this out when others atucally call the operators - mSerialise = false; -} - -std::string JsonStream::getJsonString() -{ - deleteCurrentChild(); - if(mIsOk) - { - switch(mDataType) - { - case TYPE_UNDEFINED: - return ""; - case TYPE_ARRAY: - return json::Serialize(mArray); - case TYPE_OBJECT: - return json::Serialize(mObject); - case TYPE_RAW: - return mRawString; - default: - return ""; - } - } - std::cerr << "JsonStream::getJsonString() Warning: stream not ok, will return empty string." << std::endl; - return ""; -} - -void JsonStream::switchToDeserialisation() -{ - deleteCurrentChild(); - mSerialise = false; -} - - -//----------Stream Interface --------------- - -//----------Array--------------- -StreamBase& JsonStream::operator<<(ValueReference value) -{ - if(serialise()) - { - setType(TYPE_ARRAY); - mArray.push_back(value.value); - } - else - { - if(checkDeserialisation() && arrayBoundsOk()) - { - valueToBool(mArray[mArrayNextRead], value.value); - mArrayNextRead++; - } - } - return *this; -} - -StreamBase& JsonStream::operator<<(ValueReference value) -{ - if(serialise()) - { - setType(TYPE_ARRAY); - mArray.push_back(value.value); - } - else - { - if(checkDeserialisation() && arrayBoundsOk()) - { - valueToInt(mArray[mArrayNextRead], value.value); - mArrayNextRead++; - } - } - return *this; -} - -StreamBase& JsonStream::operator<<(ValueReference value) -{ - if(serialise()) - { - setType(TYPE_ARRAY); - mArray.push_back(value.value); - } - else - { - if(checkDeserialisation() && arrayBoundsOk()) - { - valueToDouble(mArray[mArrayNextRead], value.value); - mArrayNextRead++; - } - } - return *this; -} - -StreamBase& JsonStream::operator<<(ValueReference value) -{ - if(serialise()) - { - setType(TYPE_ARRAY); - mArray.push_back(value.value); - } - else - { - if(checkDeserialisation() && arrayBoundsOk()) - { - valueToString(mArray[mArrayNextRead], value.value); - mArrayNextRead++; - } - } - return *this; -} - -StreamBase& JsonStream::getStreamToMember() -{ - setType(TYPE_ARRAY); - deleteCurrentChild(); - mChild = new JsonStream(); - if(!serialise()) - { - if(checkDeserialisation() && arrayBoundsOk()) - { - mChild->mValue = mArray[mArrayNextRead]; - mChild->mSerialise = false; - mArrayNextRead++; - } - } - return *mChild; -} - -//----------Object--------------- -StreamBase& JsonStream::operator<<(KeyValueReference keyValue) -{ - if(serialise()) - { - setType(TYPE_OBJECT); - mObject[keyValue.key] = keyValue.value; - } - else - { - if(checkDeserialisation() && checkObjectMember(keyValue.key)) - { - valueToBool(mObject[keyValue.key], keyValue.value); - } - } - return *this; -} - -StreamBase& JsonStream::operator<<(KeyValueReference keyValue) -{ - if(serialise()) - { - setType(TYPE_OBJECT); - mObject[keyValue.key] = keyValue.value; - } - else - { - if(checkDeserialisation() && checkObjectMember(keyValue.key)) - { - valueToInt(mObject[keyValue.key], keyValue.value); - } - } - return *this; -} - -StreamBase& JsonStream::operator<<(KeyValueReference keyValue) -{ - if(serialise()) - { - setType(TYPE_OBJECT); - mObject[keyValue.key] = keyValue.value; - } - else - { - if(checkDeserialisation() && checkObjectMember(keyValue.key)) - { - valueToDouble(mObject[keyValue.key], keyValue.value); - } - } - return *this; -} - -StreamBase& JsonStream::operator<<(KeyValueReference keyValue) -{ - if(serialise()) - { - setType(TYPE_OBJECT); - mObject[keyValue.key] = keyValue.value; - } - else - { - if(checkDeserialisation() && checkObjectMember(keyValue.key)) - { - valueToString(mObject[keyValue.key], keyValue.value); - } - } - return *this; -} - -// usefull if the new object member should be an array or object -// the reference should be at least valid until another method of this class gets called -StreamBase& JsonStream::getStreamToMember(std::string name) -{ - setType(TYPE_OBJECT); - deleteCurrentChild(); - mChildKey = name; - mChild = new JsonStream(); - if(!serialise()) - { - mChild->mSerialise = false; - if(checkDeserialisation() && checkObjectMember(name)) - { - mChild->mValue = mObject[name]; - } - } - return *mChild; -} - -// make a binay data object (not a real object, just binary data) -StreamBase& JsonStream::operator<<(std::vector& data) -{ - if(serialise()) - { - if((mDataType == TYPE_UNDEFINED)||(mDataType == TYPE_RAW)) - { - mDataType = TYPE_RAW; - mRawString = std::string(data.begin(), data.end()); - } - else - { - mErrorLog += "Error: trying to set raw data while the type of this object is already another type\n"; - mIsOk = false; - } - } - else - { - if((mDataType == TYPE_UNDEFINED)||(mDataType == TYPE_RAW)) - { - mDataType = TYPE_RAW; - data = std::vector(mRawString.begin(), mRawString.end()); - } - else - { - mErrorLog += "Error: trying to read raw data while the type of this object is already another type\n"; - mIsOk = false; - } - } - return *this; -} - -// return true if there are more members in this object/array -// useful for array reading -bool JsonStream::hasMore() -{ - return arrayBoundsOk(); -} - -bool JsonStream::serialise() -{ - return mSerialise; -} - -bool JsonStream::isOK() -{ - return mIsOk; -} - -void JsonStream::setError() -{ - mIsOk = false; -} - -/* -void JsonStream::addLogMsg(std::string msg) -{} -*/ - -void JsonStream::addErrorMsg(std::string msg) -{ - mErrorLog += msg; -} - -std::string JsonStream::getLog() -{ - return "not implemented yet"; -} - -std::string JsonStream::getErrorLog() -{ - return mErrorLog; -} - -bool JsonStream::isRawData() -{ - return mDataType == TYPE_RAW; -} - -std::string JsonStream::getRawData() -{ - return mRawString; -} - -void JsonStream::setType(DataType type) -{ - if((mDataType == TYPE_UNDEFINED)||(mDataType == type)) - { - mDataType = type; - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::setType() Error: type alread set to another type\n"; - } -} - -bool JsonStream::checkObjectMember(std::string key) -{ - if(mDataType == TYPE_OBJECT) - { - if(mObject.HasKey(key)) - { - return true; - } - else - { - mErrorLog += "JsonStream::checkObjectMember() Warning: missing key \""+key+"\"\n"; - return false; - } - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::checkObjectMember() Error: type is not TYPE_OBJECT\n"; - return false; - } -} - -bool JsonStream::arrayBoundsOk() -{ - if(checkDeserialisation()) - { - if(mDataType == TYPE_ARRAY) - { - if(mArrayNextRead < mArray.size()) - { - return true; - } - else - { - return false; - } - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::arrayBoundsOk() Error: type is not TYPE_ARRAY\n"; - return false; - } - } - return false; -} - -bool JsonStream::checkDeserialisation() -{ - if(mDataType != TYPE_RAW) - { - if(mDataType == TYPE_UNDEFINED) - { - if((mValue.GetType() == json::NULLVal) && mRawString != "") - { - mValue = json::Deserialize(mRawString); - } - if(mValue.GetType() == json::ObjectVal) - { - mDataType = TYPE_OBJECT; - mObject = mValue; - return true; - } - else if(mValue.GetType() == json::ArrayVal) - { - mDataType = TYPE_ARRAY; - mArray = mValue; - return true; - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::checkDeserialisation() Error: deserialisation did not end with an object or array\n"; - return false; - } - } - else - { - // already deserialised - return true; - } - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::checkDeserialisation() Error: type is TYPE_RAW\n"; - return false; - } -} - -void JsonStream::valueToBool(json::Value &value, bool &boolean) -{ - if(value.GetType() == json::BoolVal) - { - boolean = value; - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::valueToBool() Error: wrong type\n"; - } -} - -void JsonStream::valueToInt(json::Value &value, int &integer) -{ - if(value.GetType() == json::IntVal) - { - integer = value; - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::valueToInt() Error: wrong type\n"; - } -} - -void JsonStream::valueToDouble(json::Value &value, double &doubleVal) -{ - if(value.IsNumeric()) - { - doubleVal = value; - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::valueToDouble() Error: wrong type\n"; - } -} - -void JsonStream::valueToString(json::Value &value, std::string& str) -{ - if(value.GetType() == json::StringVal) - { - str = value.ToString(); - } - else - { - mIsOk = false; - mErrorLog += "JsonStream::valueToString() Error: wrong type\n"; - } -} - -void JsonStream::deleteCurrentChild() -{ - if(mChild) - { - if(serialise()) - { - if(mDataType == TYPE_ARRAY) - { - // don't add empty value - if(mChild->getJsonValue().GetType() != json::NULLVal) - mArray.push_back(mChild->getJsonValue()); - } - else if(mDataType == TYPE_OBJECT) - { - mObject[mChildKey] = mChild->getJsonValue(); - } - else - { - mErrorLog += "JsonStream::deleteCurrentChild() Error: cannot add child because own type is wrong\n"; - } - } - else - { - // don't have to do anything for deserialisation - } - delete mChild; - mChild = NULL; - } -} - -json::Value JsonStream::getJsonValue() -{ - // remove the child and add it to own data - deleteCurrentChild(); - switch(mDataType) - { - case TYPE_UNDEFINED: - return json::Value(); - case TYPE_ARRAY: - return mArray; - case TYPE_OBJECT: - return mObject; - case TYPE_RAW: - return mRawString; - default: - return json::Value(); - } -} - -} // namespace resource_api diff --git a/libresapi/src/api/JsonStream.h b/libresapi/src/api/JsonStream.h deleted file mode 100644 index a6e3528ad..000000000 --- a/libresapi/src/api/JsonStream.h +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * libresapi/api/jsonStream.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include "ApiTypes.h" -#include "json.h" - -namespace resource_api -{ - -class JsonStream: public StreamBase -{ -public: - JsonStream(); - virtual ~JsonStream(); - - void setJsonString(std::string jsonStr); - std::string getJsonString(); - - // it is possible to use this class as buffer - // first use as serialiser and fill with values - // then call this method to deserialise the values - void switchToDeserialisation(); - - - //----------Stream Interface --------------- - - // make an array - virtual StreamBase& operator<<(ValueReference value); - virtual StreamBase& operator<<(ValueReference value); - virtual StreamBase& operator<<(ValueReference value); - virtual StreamBase& operator<<(ValueReference value); - // usefull if the new array member should be an array or object - // the reference should be at least valid until another method of this class gets called - virtual StreamBase& getStreamToMember(); - - // make an object - virtual StreamBase& operator<<(KeyValueReference keyValue); - virtual StreamBase& operator<<(KeyValueReference keyValue); - virtual StreamBase& operator<<(KeyValueReference keyValue); - virtual StreamBase& operator<<(KeyValueReference keyValue); - // usefull if the new object member should be an array or object - // the reference should be at least valid until another method of this class gets called - virtual StreamBase& getStreamToMember(std::string name); - - // make a binay data object (not a real object, just binary data) - // idea: can use vector.swap() to allow passing larger data items without copying - virtual StreamBase& operator<<(std::vector& data); - - // return true if there are more members in this object/array - // useful for array reading - virtual bool hasMore(); - - virtual bool serialise(); // let external operators find out they should serialise or deserialise - // return true if no serialisation/deserialisation error occoured - virtual bool isOK(); - virtual void setError(); // let external operators set the failed bit - //virtual void addLogMsg(std::string msg); // mayb remove? (put log messages to error log einstead) - virtual void addErrorMsg(std::string msg); - virtual std::string getLog(); - virtual std::string getErrorLog(); - - virtual bool isRawData(); - virtual std::string getRawData(); -private: - bool mSerialise; - enum DataType{ TYPE_UNDEFINED, TYPE_ARRAY, TYPE_OBJECT, TYPE_RAW }; - // check if the current type is undefined - // if not check if the new type matches the old type - // if not set the error bit - void setType(DataType type); - DataType mDataType; - - json::Value mValue; - - json::Object mObject; - // check if we are and object - // check if this key exists - bool checkObjectMember(std::string key); - json::Array mArray; - size_t mArrayNextRead; - // check if we are an array - // check if next read is valid - // if not set error bit - bool arrayBoundsOk(); - std::string mRawString; - - bool mIsOk; - std::string mErrorLog; - - // try serialisation and set error bit on error - bool checkDeserialisation(); - - // check if value has correct type - // if yes return the extracted value - // if not then set the error bit - void valueToBool(json::Value& value, bool& boolean); - void valueToInt(json::Value& value, int& integer); - void valueToDouble(json::Value& value, double& doubleVal); - void valueToString(json::Value& value, std::string& str); - - void deleteCurrentChild(); - json::Value getJsonValue(); - JsonStream* mChild; - std::string mChildKey; -}; - -} // namespace resource_api diff --git a/libresapi/src/api/LivereloadHandler.cpp b/libresapi/src/api/LivereloadHandler.cpp deleted file mode 100644 index c57c86331..000000000 --- a/libresapi/src/api/LivereloadHandler.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * libresapi/api/LivereloadHarder.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "LivereloadHandler.h" - -namespace resource_api -{ -LivereloadHandler::LivereloadHandler(StateTokenServer *sts): - mStateTokenServer(sts), mStateToken(sts->getNewToken()) -{ - addResourceHandler("*", this, &LivereloadHandler::handleWildcard); - addResourceHandler("trigger", this, &LivereloadHandler::handleTrigger); -} - -void LivereloadHandler::handleWildcard(Request &/*req*/, Response &resp) -{ - resp.mStateToken = mStateToken; - resp.setOk(); -} - -void LivereloadHandler::handleTrigger(Request &/*req*/, Response &resp) -{ - mStateTokenServer->replaceToken(mStateToken); - resp.mStateToken = mStateToken; - resp.setOk(); -} - -} // namespace resource_api diff --git a/libresapi/src/api/LivereloadHandler.h b/libresapi/src/api/LivereloadHandler.h deleted file mode 100644 index 5f77259c3..000000000 --- a/libresapi/src/api/LivereloadHandler.h +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * libresapi/api/LivereloadHarder.h * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#pragma once - -#include "ResourceRouter.h" -#include "StateTokenServer.h" - -namespace resource_api -{ - -// very simple livereload system, integrated into the existing state token system -// the response to / is only a statetoken -// if /trigger is called, then the state token is invalidaten and replaced wiht a new one -class LivereloadHandler: public ResourceRouter -{ -public: - LivereloadHandler(StateTokenServer* sts); - -private: - void handleWildcard(Request& req, Response& resp); - void handleTrigger(Request& req, Response& resp); - StateTokenServer* mStateTokenServer; - StateToken mStateToken; -}; -} // namespace resource_api diff --git a/libresapi/src/api/Operators.cpp b/libresapi/src/api/Operators.cpp deleted file mode 100644 index d0a27765e..000000000 --- a/libresapi/src/api/Operators.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * libresapi/api/Operators.cpp * - * * - * LibResAPI: API for local socket server * - * * - * Copyright 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ -#include "Operators.h" - -namespace resource_api -{ - -StreamBase& operator <<(StreamBase& left, KeyValueReference ref) -{ - if(left.serialise()) - { - uint32_t num = ref.value; - uint8_t digit; - std::string str; - while(num >= 10) - { - digit = num % 10; - num = num / 10; - str = (char)(digit + '0') + str; - } - str = (char)(num + '0') + str; - left << makeKeyValueReference(ref.key, str); - } - else - { - std::string str; - left << makeKeyValueReference(ref.key, str); - uint32_t num = 0; - for(std::string::iterator sit = str.begin(); sit != str.end(); sit++) - { - uint32_t numbefore = num; - num = num * 10; - if(num < numbefore) - { - left.addErrorMsg("operator for uint32_t to std::string: oveflow"); - left.setError(); - } - else if((*sit)<'0' || (*sit)>'9') - { - left.addErrorMsg("operator for uint32_t to std::string: invalid characters"); - left.setError(); - } - else - { - // everything ok, can add value - num += (*sit) - '0'; - } - } - } - return left; -} - - - - -/* -template -StreamBase& operator <<(StreamBase& left, t_RsGenericIdType& id) -{ - if(left.serialise()) - { - left << id.toStdString(); - } - else - { - std::string str; - left << str; - } - return left; -} -*/ - -template -StreamBase& operator <<(StreamBase& left, ValueReference& ref) -{ - if(left.serialise()) - { - left << makeValueReference(ref.value.toStdString()); - } - else - { - std::string str; - left << makeValueReference(str); - T_ID id(str); - if(id.isNull) - { - left.setError(); - left.addErrorMsg("operator for retroshare id value: id is null\n"); - } - ref.value = id; - } - return left; -} - -// idea: have external operators which do the translation form different containers to basic operations -// better idea: take input iterators as arguments, will then work with everything which has an iterator -// but what about deserilisation? -template