Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4 from BtbN/master
Browse files Browse the repository at this point in the history
Add optional autoadd for unknown client identifiers
  • Loading branch information
jpnurmi committed Aug 27, 2015
2 parents 4296a63 + 74f6b38 commit fe0f368
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions clientbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class CClientBufferMod : public CModule
void OnDelClientCommand(const CString& line);
void OnListClientsCommand(const CString& line);

virtual void OnClientLogin();

virtual EModRet OnUserRaw(CString& line) override;
virtual EModRet OnSendToClient(CString& line, CClient& client) override;

Expand Down Expand Up @@ -119,6 +121,15 @@ void CClientBufferMod::OnListClientsCommand(const CString& line)
PutModule(table);
}

void CClientBufferMod::OnClientLogin()
{
const CString& current = GetClient()->GetIdentifier();

if (!HasClient(current) && GetArgs().Token(0).Equals("autoadd", CString::CaseInsensitive)) {
AddClient(current);
}
}

CModule::EModRet CClientBufferMod::OnUserRaw(CString& line)
{
CClient* client = GetClient();
Expand Down Expand Up @@ -292,4 +303,9 @@ void CClientBufferMod::UpdateTimestamp(const CClient* client, const CString& tar
}
}

template<> void TModInfo<CClientBufferMod>(CModInfo& info) {
info.SetWikiPage("Clientbuffer");
info.SetHasArgs(true);
}

NETWORKMODULEDEFS(CClientBufferMod, "Client specific buffer playback")

0 comments on commit fe0f368

Please sign in to comment.