diff options
Diffstat (limited to 'src/gnunet/social/socialapp.h')
-rw-r--r-- | src/gnunet/social/socialapp.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/gnunet/social/socialapp.h b/src/gnunet/social/socialapp.h new file mode 100644 index 0000000..36b4ee4 --- /dev/null +++ b/src/gnunet/social/socialapp.h | |||
@@ -0,0 +1,95 @@ | |||
1 | #ifndef SOCIAL_APP_H | ||
2 | #define SOCIAL_APP_H | ||
3 | |||
4 | #include <QObject> | ||
5 | #include <QDebug> | ||
6 | |||
7 | #include "ego.h" | ||
8 | #include "place.h" | ||
9 | #include "gnunet.h" | ||
10 | |||
11 | class SocialApp : public QObject | ||
12 | { | ||
13 | Q_OBJECT; | ||
14 | |||
15 | public: | ||
16 | |||
17 | explicit SocialApp (GNUNET_CONFIGURATION_Handle * config, | ||
18 | QObject *parent = 0); | ||
19 | ~SocialApp (); | ||
20 | |||
21 | Ego * | ||
22 | findEgo (const QString pubKeyStr); | ||
23 | |||
24 | void | ||
25 | createPlace (GNUNET_SOCIAL_Ego *ego); | ||
26 | |||
27 | void | ||
28 | enterPlace (GNUNET_SOCIAL_Ego *ego, | ||
29 | GNUNET_CRYPTO_EddsaPublicKey *pubKey, | ||
30 | GNUNET_PeerIdentity *peerId); | ||
31 | |||
32 | const QList<Ego *> & | ||
33 | egos () | ||
34 | { | ||
35 | return m_egos; | ||
36 | } | ||
37 | |||
38 | const QList<Place *> & | ||
39 | places () | ||
40 | { | ||
41 | return m_places; | ||
42 | } | ||
43 | |||
44 | signals: | ||
45 | |||
46 | void | ||
47 | egoAdded (Ego *ego); | ||
48 | |||
49 | void | ||
50 | placeAdded (Place *place); | ||
51 | |||
52 | public slots: | ||
53 | |||
54 | void | ||
55 | createPlaceSlot (QString egoPubKeyStr); | ||
56 | |||
57 | void | ||
58 | enterPlaceSlot (QString egoPubKeyStr, QString pubKeyStr, QString peerIdStr); | ||
59 | |||
60 | private: | ||
61 | |||
62 | GNUNET_SOCIAL_App *m_app; | ||
63 | QList<Ego *> m_egos; | ||
64 | QList<Place *> m_places; | ||
65 | GNUNET_CONFIGURATION_Handle *m_config; | ||
66 | |||
67 | static void | ||
68 | egoCallback (void *cls, | ||
69 | struct GNUNET_SOCIAL_Ego *ego, | ||
70 | const struct GNUNET_CRYPTO_EcdsaPublicKey *ego_pub_key, | ||
71 | const char *name); | ||
72 | |||
73 | void | ||
74 | addEgo (Ego *ego); | ||
75 | |||
76 | void | ||
77 | addPlace (Place *place); | ||
78 | |||
79 | static void | ||
80 | hostPlaceCallback (void *cls, | ||
81 | struct GNUNET_SOCIAL_HostConnection *hconn, | ||
82 | struct GNUNET_SOCIAL_Ego *ego, | ||
83 | const struct GNUNET_CRYPTO_EddsaPublicKey *placePubKey, | ||
84 | enum GNUNET_SOCIAL_AppPlaceState placeState); | ||
85 | |||
86 | static void | ||
87 | guestPlaceCallback (void *cls, | ||
88 | struct GNUNET_SOCIAL_GuestConnection *gconn, | ||
89 | struct GNUNET_SOCIAL_Ego *ego, | ||
90 | const struct GNUNET_CRYPTO_EddsaPublicKey *placePubKey, | ||
91 | enum GNUNET_SOCIAL_AppPlaceState placeState); | ||
92 | |||
93 | }; | ||
94 | |||
95 | #endif | ||