MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / BindAdminIdentity

Method BindAdminIdentity

core/logic/AdminCache.cpp:1136–1173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1134}
1135
1136bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
1137{
1138 if (ident[0] == '\0')
1139 {
1140 return false;
1141 }
1142
1143 AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
1144 if (!pUser || pUser->magic != USR_MAGIC_SET)
1145 {
1146 return false;
1147 }
1148
1149 AuthMethod *method;
1150 if (!m_AuthTables.retrieve(auth, &method))
1151 return false;
1152
1153 /* If the auth type is steam, the id could be in a number of formats. Unify it. */
1154 char steamIdent[16];
1155 if (strcmp(auth, "steam") == 0)
1156 {
1157 if (!GetUnifiedSteamIdentity(ident, steamIdent, sizeof(steamIdent)))
1158 return false;
1159
1160 ident = steamIdent;
1161 }
1162
1163 if (method->identities.contains(ident))
1164 return false;
1165
1166 int i_ident = m_pStrings->AddString(ident);
1167
1168 pUser = (AdminUser *)m_pMemory->GetAddress(id);
1169 pUser->auth.identidx = i_ident;
1170 GetMethodIndex(auth, &pUser->auth.index);
1171
1172 return method->identities.insert(ident, id);
1173}
1174
1175AdminId AdminCache::FindAdminByIdentity(const char *auth, const char *identity)
1176{

Callers 1

BindAdminIdentityFunction · 0.80

Calls 5

GetAddressMethod · 0.45
retrieveMethod · 0.45
containsMethod · 0.45
AddStringMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected