[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34133 - in gnunet-qt/SecureShare: . core core/gnunet core/
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34133 - in gnunet-qt/SecureShare: . core core/gnunet core/identity core/social models qml |
Date: |
Sun, 10 Aug 2014 00:21:59 +0200 |
Author: bratao
Date: 2014-08-10 00:21:59 +0200 (Sun, 10 Aug 2014)
New Revision: 34133
Added:
gnunet-qt/SecureShare/core/social/place.cpp
gnunet-qt/SecureShare/core/social/place.h
Removed:
gnunet-qt/SecureShare/core/place.cpp
gnunet-qt/SecureShare/core/place.h
Modified:
gnunet-qt/SecureShare/SecureShare.pro
gnunet-qt/SecureShare/core/gnunet/gnunet.cpp
gnunet-qt/SecureShare/core/gnunet/gnunet.h
gnunet-qt/SecureShare/core/gnunet/gnunet_includes.h
gnunet-qt/SecureShare/core/identity/identityService.h
gnunet-qt/SecureShare/core/psyccore.cpp
gnunet-qt/SecureShare/core/psyccore.h
gnunet-qt/SecureShare/core/social/socialservice.cpp
gnunet-qt/SecureShare/core/social/socialservice.h
gnunet-qt/SecureShare/models/PlacesModel.cpp
gnunet-qt/SecureShare/models/PlacesModel.h
gnunet-qt/SecureShare/models/models.cpp
gnunet-qt/SecureShare/qml/main.qml
Log:
Implemented room hosting with social service.
Modified: gnunet-qt/SecureShare/SecureShare.pro
===================================================================
--- gnunet-qt/SecureShare/SecureShare.pro 2014-08-09 19:15:40 UTC (rev
34132)
+++ gnunet-qt/SecureShare/SecureShare.pro 2014-08-09 22:21:59 UTC (rev
34133)
@@ -2,7 +2,7 @@
QT += qml quick widgets
-LIBS += -lgnunetutil -lgnunetcore -lgnunetidentity -lgnunetarm -lgnunetfriends
-lextractor -lqrencode
+LIBS += -lgnunetutil -lgnunetcore -lgnunetidentity -lgnunetarm -lgnunetsocial
-lgnunetfriends -lextractor -lqrencode
#include(3rdParty/qzxing-master/QZXing.pro)
@@ -12,14 +12,14 @@
psyc.cpp \
models/models.cpp \
models/PlacesModel.cpp \
- core/place.cpp \
core/gnunet/gnunet.cpp \
core/identity/identityService.cpp \
core/identity/identity.cpp \
models/IdentityModel.cpp \
utils/helpers.cpp \
utils/qrimageprovider.cpp \
- core/social/socialservice.cpp
+ core/social/socialservice.cpp \
+ core/social/place.cpp
RESOURCES += qml.qrc
@@ -35,7 +35,6 @@
psyc.h \
models/models.h \
models/PlacesModel.h \
- core/place.h \
core/gnunet/gnunet.h \
core/gnunet/gnunet_includes.h \
core/identity/identityService.h \
@@ -43,4 +42,5 @@
models/IdentityModel.h \
utils/helpers.h \
utils/qrimageprovider.h \
- core/social/socialservice.h
+ core/social/socialservice.h \
+ core/social/place.h
Modified: gnunet-qt/SecureShare/core/gnunet/gnunet.cpp
===================================================================
--- gnunet-qt/SecureShare/core/gnunet/gnunet.cpp 2014-08-09 19:15:40 UTC
(rev 34132)
+++ gnunet-qt/SecureShare/core/gnunet/gnunet.cpp 2014-08-09 22:21:59 UTC
(rev 34133)
@@ -24,6 +24,7 @@
#include "core/psyccore.h"
#include "preferences/preferences.h"
#include "core/identity/identityService.h"
+#include "core/social/socialservice.h"
#include <math.h>
#include <QElapsedTimer>
@@ -90,7 +91,7 @@
GNUNet::~GNUNet()
{
- delete m_myPeer;
+ delete m_myPeer;
}
/**
@@ -103,13 +104,14 @@
m_identity = new IdentityService(this);
+ m_social = new SocialService(this);
static struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
- /*
+ /*
QString gnunetConfig = thePrefs->getGNUNetConfig();
QByteArray byteArray = gnunetConfig.toUtf8();
const char* cString = byteArray.constData();
@@ -186,10 +188,16 @@
{
m_identity->start(m_config);
-
emit gnunetStarted();
}
+
+
+void GNUNet::identitySetSlot(){
+ m_social->start(m_config);
+
+}
+
/**
* Process our internal pending messages.
*/
Modified: gnunet-qt/SecureShare/core/gnunet/gnunet.h
===================================================================
--- gnunet-qt/SecureShare/core/gnunet/gnunet.h 2014-08-09 19:15:40 UTC (rev
34132)
+++ gnunet-qt/SecureShare/core/gnunet/gnunet.h 2014-08-09 22:21:59 UTC (rev
34133)
@@ -29,6 +29,7 @@
class IdentityService;
+class SocialService;
class GNUNet : public QObject
{
Q_OBJECT
@@ -108,6 +109,7 @@
public slots:
void start();
+ void identitySetSlot();
private slots:
void startServices();
@@ -119,7 +121,13 @@
IdentityService* m_identity;
+ /**
+ * Pointer to GNUnet Social Service.
+ */
+ SocialService* m_social;
+
+
/**
* @brief m_config
*/
Modified: gnunet-qt/SecureShare/core/gnunet/gnunet_includes.h
===================================================================
--- gnunet-qt/SecureShare/core/gnunet/gnunet_includes.h 2014-08-09 19:15:40 UTC
(rev 34132)
+++ gnunet-qt/SecureShare/core/gnunet/gnunet_includes.h 2014-08-09 22:21:59 UTC
(rev 34133)
@@ -41,5 +41,6 @@
#include <gnunet/gnunet_hello_lib.h>
#include <gnunet/gnunet_identity_service.h>
#include <gnunet/gnunet_friends_lib.h>
+#include <gnunet/gnunet_social_service.h>
#endif // GNUNET_INCLUDES_H
Modified: gnunet-qt/SecureShare/core/identity/identityService.h
===================================================================
--- gnunet-qt/SecureShare/core/identity/identityService.h 2014-08-09
19:15:40 UTC (rev 34132)
+++ gnunet-qt/SecureShare/core/identity/identityService.h 2014-08-09
22:21:59 UTC (rev 34133)
@@ -22,11 +22,11 @@
void createEgoSlot(QString ego);
private:
- struct GNUNET_CONFIGURATION_Handle *m_config;
- /**
+ struct GNUNET_CONFIGURATION_Handle *m_config;
+ /**
* Handle to IDENTITY service.
*/
- struct GNUNET_IDENTITY_Handle *m_identityHandle;
+ struct GNUNET_IDENTITY_Handle *m_identityHandle;
};
Deleted: gnunet-qt/SecureShare/core/place.cpp
===================================================================
--- gnunet-qt/SecureShare/core/place.cpp 2014-08-09 19:15:40 UTC (rev
34132)
+++ gnunet-qt/SecureShare/core/place.cpp 2014-08-09 22:21:59 UTC (rev
34133)
@@ -1,7 +0,0 @@
-#include "place.h"
-
-Place::Place(QString key, QObject *parent) :
- QObject(parent)
-{
- m_key = key;
-}
Deleted: gnunet-qt/SecureShare/core/place.h
===================================================================
--- gnunet-qt/SecureShare/core/place.h 2014-08-09 19:15:40 UTC (rev 34132)
+++ gnunet-qt/SecureShare/core/place.h 2014-08-09 22:21:59 UTC (rev 34133)
@@ -1,44 +0,0 @@
-#ifndef PLACE_H
-#define PLACE_H
-
-#include <QObject>
-
-class Place : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-public:
- explicit Place(QString key, QObject *parent = 0);
-
- //Index
- int getIndex() const
- { return m_index; }
- void setIndex(int index)
- {
- m_index = index;
- }
-
- //Name
- QString name() const
- { return m_name; }
- void setName(QString name)
- {
- m_name = name;
- emit nameChanged(name);
- }
-
-private:
- int m_index;
- QString m_name;
- QString m_key;
-
-signals:
- void modifiedSignal(int index);
- void nameChanged(QString name);
-
-
-public slots:
-
-};
-
-#endif // PLACE_H
Modified: gnunet-qt/SecureShare/core/psyccore.cpp
===================================================================
--- gnunet-qt/SecureShare/core/psyccore.cpp 2014-08-09 19:15:40 UTC (rev
34132)
+++ gnunet-qt/SecureShare/core/psyccore.cpp 2014-08-09 22:21:59 UTC (rev
34133)
@@ -18,17 +18,17 @@
PsycCore::PsycCore(QObject *parent) :
QObject(parent)
{
- theApp = this;
- m_models = new Models(this);
+ theApp = this;
+ m_models = new Models(this);
- m_helpers = new Helpers(this);
+ m_helpers = new Helpers(this);
- m_qrProvider = new QrImageProvider();
+ m_qrProvider = new QrImageProvider();
- m_identity = NULL;
+ m_identity = NULL;
- //Finally start gnunet
- startGNUNet();
+ //Finally start gnunet
+ startGNUNet();
}
@@ -37,57 +37,59 @@
*/
void PsycCore::startGNUNet()
{
- //Create the Gnunet object
- m_gnunet = new GNUNet();
+ //Create the Gnunet object
+ m_gnunet = new GNUNet();
- //New thread where the Gnunet will be run on.
- m_gnunetThread = new QThread();
+ //New thread where the Gnunet will be run on.
+ m_gnunetThread = new QThread();
- m_gnunet->moveToThread(m_gnunetThread);
+ m_gnunet->moveToThread(m_gnunetThread);
- // Call the start function after our thread is ready to run
- connect(m_gnunetThread,
- &QThread::started,
- m_gnunet,
- &GNUNet::start);
+ // Call the start function after our thread is ready to run
+ connect(m_gnunetThread,
+ &QThread::started,
+ m_gnunet,
+ &GNUNet::start);
- m_gnunetThread->start();
+ m_gnunetThread->start();
- connect(m_gnunet, &GNUNet::connectedChanged, this, &PsycCore::setConnected,
Qt::QueuedConnection);
+ connect(m_gnunet, &GNUNet::connectedChanged, this,
&PsycCore::setConnected, Qt::QueuedConnection);
+ connect(this, &PsycCore::setIdentitySignal, m_gnunet,
&GNUNet::identitySetSlot, Qt::QueuedConnection);
+
}
void PsycCore::setupTray()
{
- // create the menu
- m_trayMenu = new QMenu( QCoreApplication::instance()->applicationName() );
- // add a horizontal line to the menu
+ // create the menu
+ m_trayMenu = new QMenu( QCoreApplication::instance()->applicationName() );
+ // add a horizontal line to the menu
- m_trayMenu->addSeparator();
- m_trayCloseAction = m_trayMenu->addAction("Close");
- connect(m_trayCloseAction, &QAction::triggered, this, &PsycCore::close);
+ m_trayMenu->addSeparator();
+ m_trayCloseAction = m_trayMenu->addAction("Close");
+ connect(m_trayCloseAction, &QAction::triggered, this, &PsycCore::close);
- m_tray = new QSystemTrayIcon(QIcon(":/assets/icon.ico"),theWindow); //Same
as above
- m_tray->setContextMenu(m_trayMenu);
- m_tray->setVisible(true);
+ m_tray = new QSystemTrayIcon(QIcon(":/assets/icon.ico"),theWindow); //Same
as above
+ m_tray->setContextMenu(m_trayMenu);
+ m_tray->setVisible(true);
- QObject::connect(m_tray, &QSystemTrayIcon::activated,this,
&PsycCore::trayActivated );
+ QObject::connect(m_tray, &QSystemTrayIcon::activated,this,
&PsycCore::trayActivated );
}
void PsycCore::trayActivated(QSystemTrayIcon::ActivationReason reason)
{
- if(reason == QSystemTrayIcon::DoubleClick){
- if(!theWindow->isVisible()){
+ if(reason == QSystemTrayIcon::DoubleClick){
+ if(!theWindow->isVisible()){
- theWindow->show();
+ theWindow->show();
}else{
- onClose();
+ onClose();
}
}
}
@@ -95,9 +97,9 @@
void PsycCore::setConnected(bool connected)
{
- m_connected = connected;
+ m_connected = connected;
- emit connectedChanged(m_connected);
+ emit connectedChanged(m_connected);
}
@@ -107,7 +109,7 @@
*/
void PsycCore::onClose()
{
- theWindow->hide();
+ theWindow->hide();
}
@@ -116,7 +118,14 @@
* Actually close the applciation
*/
void PsycCore::close(){
- //setAlive(false);
- QApplication::quit();
+ //setAlive(false);
+ QApplication::quit();
}
+
+void PsycCore::setIdentity(Identity* identity)
+{
+ m_identity = identity;
+ emit setIdentitySignal();
+
+}
Modified: gnunet-qt/SecureShare/core/psyccore.h
===================================================================
--- gnunet-qt/SecureShare/core/psyccore.h 2014-08-09 19:15:40 UTC (rev
34132)
+++ gnunet-qt/SecureShare/core/psyccore.h 2014-08-09 22:21:59 UTC (rev
34133)
@@ -40,10 +40,7 @@
Identity* identity() const
{ return m_identity; }
- Q_INVOKABLE void setIdentity(Identity* identity)
- {
- m_identity = identity;
- }
+ Q_INVOKABLE void setIdentity(Identity* identity);
void setupTray();
@@ -79,6 +76,7 @@
void startGNUNet();
signals:
void connectedChanged(bool connected);
+ void setIdentitySignal();
public slots:
void trayActivated(QSystemTrayIcon::ActivationReason reason);
Added: gnunet-qt/SecureShare/core/social/place.cpp
===================================================================
--- gnunet-qt/SecureShare/core/social/place.cpp (rev 0)
+++ gnunet-qt/SecureShare/core/social/place.cpp 2014-08-09 22:21:59 UTC (rev
34133)
@@ -0,0 +1,10 @@
+#include "place.h"
+
+Place::Place(QString key, QObject *parent) :
+ QObject(parent)
+{
+ m_key = key;
+ m_status = "No status";
+ m_name = "No name";
+ m_type = "group";//thread;group;contact
+}
Added: gnunet-qt/SecureShare/core/social/place.h
===================================================================
--- gnunet-qt/SecureShare/core/social/place.h (rev 0)
+++ gnunet-qt/SecureShare/core/social/place.h 2014-08-09 22:21:59 UTC (rev
34133)
@@ -0,0 +1,66 @@
+#ifndef PLACE_H
+#define PLACE_H
+
+#include <QObject>
+
+class Place : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+public:
+ explicit Place(QString key, QObject *parent = 0);
+
+ //Index
+ int getIndex() const
+ { return m_index; }
+ void setIndex(int index)
+ {
+ m_index = index;
+ }
+
+ //Name
+ QString name() const
+ { return m_name; }
+ void setName(QString name)
+ {
+ m_name = name;
+ emit nameChanged(name);
+ }
+
+ //Type
+ QString type() const
+ { return m_type; }
+ void setType(QString type)
+ {
+ m_type = type;
+ emit typeChanged(type);
+ }
+
+ //Status
+ QString status() const
+ { return m_status; }
+ void setStatus(QString status)
+ {
+ m_status = status;
+ emit statusChanged(status);
+ }
+
+private:
+ int m_index;
+ QString m_name;
+ QString m_type;
+ QString m_status;
+ QString m_key;
+
+signals:
+ void modifiedSignal(int index);
+ void nameChanged(QString name);
+ void typeChanged(QString type);
+ void statusChanged(QString status);
+
+
+public slots:
+
+};
+
+#endif // PLACE_H
Modified: gnunet-qt/SecureShare/core/social/socialservice.cpp
===================================================================
--- gnunet-qt/SecureShare/core/social/socialservice.cpp 2014-08-09 19:15:40 UTC
(rev 34132)
+++ gnunet-qt/SecureShare/core/social/socialservice.cpp 2014-08-09 22:21:59 UTC
(rev 34133)
@@ -1,29 +1,218 @@
#include "socialservice.h"
+#include "core/psyccore.h"
+#include "core/identity/identity.h"
+#include "models/models.h"
+#include "models/PlacesModel.h"
+#include "core/social/place.h"
+
SocialService::SocialService(QObject *parent) :
QObject(parent)
{
+
+
+
}
-void SocialService::id_host_ego_cb (void *cls, const struct
GNUNET_IDENTITY_Ego *ego)
+
+
+/**
+ * @brief Identity::start
+ * @param config
+ */
+void SocialService::start(struct GNUNET_CONFIGURATION_Handle *config)
{
- /*
- GNUNET_assert (NULL != ego);
- host_ego = ego;
- host_slicer = GNUNET_SOCIAL_slicer_create ();
- GNUNET_SOCIAL_slicer_add (host_slicer, "",
- &host_recv_method, &host_recv_modifier,
- &host_recv_data, &host_recv_eom, NULL);
+ this->m_config = config;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Entering to place as host.\n");
- hst = GNUNET_SOCIAL_host_enter (cfg, host_ego, place_key,
- GNUNET_PSYC_CHANNEL_PRIVATE, host_slicer,
- &host_entered, &host_answer_door,
- &host_farewell, NULL);
+ //Grab selected identity
+ Identity* iden = theApp->identity();
+ m_hostEgo = iden->ego();
- */
+
+ m_placeKey = GNUNET_CRYPTO_eddsa_key_create ();
+
+ createSlice();
+
+ enterPlaceAsHost();
}
+
+void SocialService::createSlice()
+{
+ m_hostSlicer = GNUNET_SOCIAL_slicer_create ();
+ GNUNET_SOCIAL_slicer_add (m_hostSlicer, "",
+ &hostRecvMethodCallback,
&hostRecvModifierCallback,
+ &hostRecvDataCallback, &hostRecvEomCallback,
NULL);
+}
+
+void SocialService::enterPlaceAsHost()
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Entering to place as host.\n");
+
+
+ GNUNET_CRYPTO_eddsa_key_get_public (m_placeKey, &m_placePubKey);
+
+ char* id = GNUNET_CRYPTO_eddsa_public_key_to_string (&m_placePubKey);
+ QString strId = QString::fromLatin1(id);
+
+
+
+ Place* newPlace = theApp->models()->placesModel()->add(strId);
+
+ newPlace->setName("My Room");
+
+
+
+ m_hst = GNUNET_SOCIAL_host_enter (m_config, m_hostEgo, m_placeKey,
+ GNUNET_PSYC_CHANNEL_PRIVATE,
m_hostSlicer,
+ &hostEnteredCallback,
&hostAnswerDoorCallback,
+ &hostFarewellCallback, newPlace);
+}
+
+
+void
+SocialService::hostRecvMethodCallback (void *cls,
+ const struct GNUNET_PSYC_MessageMethod
*meth,
+ uint64_t message_id,
+ uint32_t flags,
+ const struct GNUNET_SOCIAL_Nym *nym,
+ const char *method_name)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Test #: Host received method for message ID %i:\n"
+ "%s\n",
+ message_id, method_name);
+ /* FIXME: check message */
+}
+
+
+void
+SocialService::hostRecvModifierCallback (void *cls,
+ const struct
GNUNET_PSYC_MessageModifier *mod,
+ uint64_t message_id,
+ enum GNUNET_ENV_Operator oper,
+ const char *name,
+ const void *value,
+ uint16_t value_size)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Test #: Host received modifier for message ID %i:\n"
+ "%c%s: %.*s\n",
+ message_id, oper, name, value_size, value);
+}
+
+
+void
+SocialService::hostRecvDataCallback (void *cls,
+ const struct GNUNET_MessageHeader *msg,
+ uint64_t message_id,
+ uint64_t data_offset,
+ const void *data,
+ uint16_t data_size)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Test #: Host received data for message ID %i:\n"
+ "%.*s\n",
+ message_id, data_size, data);
+}
+
+
+void
+SocialService::hostRecvEomCallback (void *cls,
+ const struct GNUNET_MessageHeader *msg,
+ uint64_t message_id,
+ uint8_t cancelled)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Test #: Host received end of message ID %i, cancelled: %u\n",
+ message_id, cancelled);
+ /*
+ switch (test)
+ {
+ case TEST_HOST_ANNOUNCE:
+ test = TEST_HOST_ANNOUNCE_END;
+ //host_announce2 ();
+ break;
+
+ case TEST_HOST_ANNOUNCE_END:
+ guest_talk ();
+ break;
+
+ case TEST_GUEST_TALK:
+ guest_leave ();
+ break;
+
+ default:
+ GNUNET_assert (0);
+ }*/
+}
+
+
+void
+SocialService::hostAnswerDoorCallback (void *cls,
+ struct GNUNET_SOCIAL_Nym *nym,
+ const char *method_name,
+ struct GNUNET_ENV_Environment *env,
+ size_t data_size,
+ const void *data)
+{
+
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Host received entry request from guest .\n"
+ );
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%s\n%.*s\n",
+ method_name, data_size, data);
+ /*
+ switch (test)
+ {
+ case TEST_HOST_ANSWER_DOOR_REFUSE:
+ test = TEST_GUEST_RECV_ENTRY_DCSN_REFUSE;
+ join_resp = GNUNET_PSYC_message_create ("_refuse_nym", env,
+ DATA2ARG ("Go away!"));
+ GNUNET_SOCIAL_host_entry_decision (hst, nym, GNUNET_NO, join_resp);
+ break;
+
+ case TEST_HOST_ANSWER_DOOR_ADMIT:
+ test = TEST_GUEST_RECV_ENTRY_DCSN_ADMIT;
+ join_resp = GNUNET_PSYC_message_create ("_admit_nym", env,
+ DATA2ARG ("Welcome, nym!"));
+ GNUNET_SOCIAL_host_entry_decision (hst, nym, GNUNET_YES, join_resp);
+ break;
+
+ default:
+ GNUNET_assert (0);
+ }*/
+}
+
+void SocialService::hostEnteredCallback (void *cls, int result,
+ uint64_t max_message_id)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Host entered to place.\n");
+
+ //GNUNET_IDENTITY_create (id, guest_name, &id_guest_created, NULL);
+}
+
+void
+SocialService::hostFarewellCallback (void *cls,
+ struct GNUNET_SOCIAL_Nym *nym,
+ struct GNUNET_ENV_Environment *env,
+ size_t variable_count,
+ struct GNUNET_ENV_Modifier *variables)
+{
+ // FIXME: this function is not called yet
+
+ struct GNUNET_CRYPTO_EcdsaPublicKey *
+ nym_key = GNUNET_SOCIAL_nym_get_key (nym);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Nym %s has left the place.\n",
+ GNUNET_CRYPTO_ecdsa_public_key_to_string (nym_key));
+
+ /*
+ GNUNET_assert (0 == memcmp (&guest_pub_key, nym_key, sizeof (*nym_key)));
+
+ GNUNET_SCHEDULER_add_now (&schedule_host_leave, NULL);*/
+}
Modified: gnunet-qt/SecureShare/core/social/socialservice.h
===================================================================
--- gnunet-qt/SecureShare/core/social/socialservice.h 2014-08-09 19:15:40 UTC
(rev 34132)
+++ gnunet-qt/SecureShare/core/social/socialservice.h 2014-08-09 22:21:59 UTC
(rev 34133)
@@ -10,14 +10,64 @@
public:
explicit SocialService(QObject *parent = 0);
- void id_host_ego_cb(void *cls, const GNUNET_IDENTITY_Ego *ego);
+ static void hostRecvMethodCallback (void *cls,
+ const struct GNUNET_PSYC_MessageMethod *meth,
+ uint64_t message_id,
+ uint32_t flags,
+ const struct GNUNET_SOCIAL_Nym *nym,
+ const char *method_name);
+
+ static void
+ hostRecvModifierCallback (void *cls,
+ const struct GNUNET_PSYC_MessageModifier *mod,
+ uint64_t message_id,
+ enum GNUNET_ENV_Operator oper,
+ const char *name,
+ const void *value,
+ uint16_t value_size);
+
+ static void
+ hostRecvDataCallback (void *cls,
+ const struct GNUNET_MessageHeader *msg,
+ uint64_t message_id,
+ uint64_t data_offset,
+ const void *data,
+ uint16_t data_size);
+ static void
+ hostRecvEomCallback (void *cls,
+ const struct GNUNET_MessageHeader *msg,
+ uint64_t message_id,
+ uint8_t cancelled);
+ static void
+ hostAnswerDoorCallback (void *cls,
+ struct GNUNET_SOCIAL_Nym *nym,
+ const char *method_name,
+ struct GNUNET_ENV_Environment *env,
+ size_t data_size,
+ const void *data);
+ static void hostEnteredCallback (void *cls, int result,
+ uint64_t max_message_id);
+ static void
+ hostFarewellCallback (void *cls,
+ struct GNUNET_SOCIAL_Nym *nym,
+ struct GNUNET_ENV_Environment *env,
+ size_t variable_count,
+ struct GNUNET_ENV_Modifier *variables);
+ void start(GNUNET_CONFIGURATION_Handle *config);
signals:
public slots:
private:
- GNUNET_IDENTITY_Ego *m_hostEgo;
-
+ GNUNET_IDENTITY_Ego* m_hostEgo;
+ GNUNET_SOCIAL_Slicer* m_hostSlicer;
+ GNUNET_SOCIAL_Host *m_hst;
+ GNUNET_CRYPTO_EddsaPrivateKey *m_placeKey;
+ GNUNET_CRYPTO_EddsaPublicKey m_placePubKey;
+ GNUNET_CONFIGURATION_Handle *m_config;
+
+ void createSlice();
+ void enterPlaceAsHost();
};
#endif // SOCIALSERVICE_H
Modified: gnunet-qt/SecureShare/models/PlacesModel.cpp
===================================================================
--- gnunet-qt/SecureShare/models/PlacesModel.cpp 2014-08-09 19:15:40 UTC
(rev 34132)
+++ gnunet-qt/SecureShare/models/PlacesModel.cpp 2014-08-09 22:21:59 UTC
(rev 34133)
@@ -22,7 +22,7 @@
#include <sstream>
#include "models/PlacesModel.h"
-#include "core/place.h"
+#include "core/social/place.h"
#include <QQmlEngine>
@@ -61,6 +61,12 @@
case NAME:
return peer->name();
break;
+ case TYPE:
+ return peer->type();
+ break;
+ case STATUS:
+ return peer->status();
+ break;
default:
return QVariant::Invalid;
}
@@ -72,8 +78,9 @@
QHash<int, QByteArray> PlacesModel::roleNames() const {
QHash<int, QByteArray> roles;
roles[NAME] = "name";
+ roles[TYPE] = "type";
+ roles[STATUS] = "status";
-
return roles;
}
@@ -173,3 +180,4 @@
+
Modified: gnunet-qt/SecureShare/models/PlacesModel.h
===================================================================
--- gnunet-qt/SecureShare/models/PlacesModel.h 2014-08-09 19:15:40 UTC (rev
34132)
+++ gnunet-qt/SecureShare/models/PlacesModel.h 2014-08-09 22:21:59 UTC (rev
34133)
@@ -32,7 +32,7 @@
public:
- enum PlaceRoles { NAME = Qt::UserRole + 1, NB_PLACE_COLUMNS };
+ enum PlaceRoles { NAME = Qt::UserRole + 1, TYPE, STATUS, NB_PLACE_COLUMNS
};
public:
Modified: gnunet-qt/SecureShare/models/models.cpp
===================================================================
--- gnunet-qt/SecureShare/models/models.cpp 2014-08-09 19:15:40 UTC (rev
34132)
+++ gnunet-qt/SecureShare/models/models.cpp 2014-08-09 22:21:59 UTC (rev
34133)
@@ -20,7 +20,7 @@
#include "models.h"
#include "models/PlacesModel.h"
-#include "core/place.h"
+#include "core/social/place.h"
#include "models/IdentityModel.h"
Models::Models(QObject *parent) :
@@ -42,8 +42,8 @@
void Models::test()
{
-
+/*
Place* place = m_places->add("test");
- place->setName("#test");
+ place->setName("#test");*/
}
Modified: gnunet-qt/SecureShare/qml/main.qml
===================================================================
--- gnunet-qt/SecureShare/qml/main.qml 2014-08-09 19:15:40 UTC (rev 34132)
+++ gnunet-qt/SecureShare/qml/main.qml 2014-08-09 22:21:59 UTC (rev 34133)
@@ -72,7 +72,7 @@
-
+/*
ListModel {
id: contactsModel
ListElement {
@@ -91,6 +91,7 @@
status: "I like to move, move !"
}
}
+ */
@@ -220,7 +221,7 @@
ListView {
id:contactList
anchors.fill: parent
- model: contactsModel
+ model: Psyc.models.placesModel
delegate: contactDelegate
focus: true
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34133 - in gnunet-qt/SecureShare: . core core/gnunet core/identity core/social models qml,
gnunet <=