mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
IRCClient: Start working on a simple graphical IRC client.
This will be a nice way to exercise both LibGUI and the TCP/IP support. :^)
This commit is contained in:
parent
f87dec1cbf
commit
aa19735c5a
18 changed files with 779 additions and 1 deletions
31
Applications/IRCClient/IRCLogBuffer.h
Normal file
31
Applications/IRCClient/IRCLogBuffer.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/CircularQueue.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
|
||||
class IRCLogBuffer : public Retainable<IRCLogBuffer> {
|
||||
public:
|
||||
static Retained<IRCLogBuffer> create();
|
||||
~IRCLogBuffer();
|
||||
|
||||
struct Message {
|
||||
time_t timestamp { 0 };
|
||||
char prefix { 0 };
|
||||
String sender;
|
||||
String text;
|
||||
};
|
||||
|
||||
int count() const { return m_messages.size(); }
|
||||
const Message& at(int index) const { return m_messages.at(index); }
|
||||
|
||||
void add_message(char prefix, const String& name, const String& text);
|
||||
|
||||
void dump() const;
|
||||
|
||||
private:
|
||||
IRCLogBuffer();
|
||||
|
||||
CircularQueue<Message, 1000> m_messages;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue