summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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