summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-11 14:04:00 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-11 14:04:00 +0200
commit0205dd6548f331bf3dc70cfce5c9ed82275d9a35 (patch)
treef32125b4ac6c85582e4ad209827894ef1f7499fd /include
parent020f706bcbf616457bf579712a95a1705d392d4b (diff)
Add foundation for membership ids
Diffstat (limited to 'include')
-rw-r--r--include/membership.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/membership.h b/include/membership.h
index e2c13c7e4..71008e46b 100644
--- a/include/membership.h
+++ b/include/membership.h
@@ -20,6 +20,8 @@
#pragma once
+uint64_t ConvToUInt64(const std::string& in);
+
/**
* Represents a member of a channel.
* A Membership object is created when a user joins a channel, and destroyed when a user leaves
@@ -30,6 +32,10 @@
class CoreExport Membership : public Extensible, public intrusive_list_node<Membership>
{
public:
+ /** Type of the Membership id
+ */
+ typedef uint64_t Id;
+
/** User on the channel
*/
User* const user;
@@ -43,6 +49,20 @@ class CoreExport Membership : public Extensible, public intrusive_list_node<Memb
*/
std::string modes;
+ /** Id of this Membership, set by the protocol module, other components should never read or
+ * write this field.
+ */
+ Id id;
+
+ /** Converts a string to a Membership::Id
+ * @param str The string to convert
+ * @return Raw value of type Membership::Id
+ */
+ static Id IdFromString(const std::string& str)
+ {
+ return ConvToUInt64(str);
+ }
+
/** Constructor, sets the user and chan fields to the parameters, does NOT update any bookkeeping
* information in the User or the Channel.
* Call Channel::JoinUser() or ForceJoin() to make a user join a channel instead of constructing