mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
0dc9af5f7e
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
70 lines
2 KiB
C++
70 lines
2 KiB
C++
#pragma once
|
|
|
|
#include "IRCLogBuffer.h"
|
|
#include <AK/AKString.h>
|
|
#include <AK/CircularQueue.h>
|
|
#include <AK/RetainPtr.h>
|
|
#include <AK/Retainable.h>
|
|
#include <AK/Vector.h>
|
|
|
|
class IRCClient;
|
|
class IRCChannelMemberListModel;
|
|
class IRCWindow;
|
|
|
|
class IRCChannel : public Retainable<IRCChannel> {
|
|
public:
|
|
static Retained<IRCChannel> create(IRCClient&, const String&);
|
|
~IRCChannel();
|
|
|
|
bool is_open() const { return m_open; }
|
|
void set_open(bool b) { m_open = b; }
|
|
|
|
String name() const { return m_name; }
|
|
|
|
void add_member(const String& name, char prefix);
|
|
void remove_member(const String& name);
|
|
|
|
void add_message(char prefix, const String& name, const String& text, Color = Color::Black);
|
|
void add_message(const String& text, Color = Color::Black);
|
|
|
|
void dump() const;
|
|
|
|
void say(const String&);
|
|
|
|
const IRCLogBuffer& log() const { return *m_log; }
|
|
IRCLogBuffer& log() { return *m_log; }
|
|
|
|
IRCChannelMemberListModel* member_model() { return m_member_model.ptr(); }
|
|
const IRCChannelMemberListModel* member_model() const { return m_member_model.ptr(); }
|
|
|
|
int member_count() const { return m_members.size(); }
|
|
String member_at(int i) { return m_members[i].name; }
|
|
|
|
void handle_join(const String& nick, const String& hostmask);
|
|
void handle_part(const String& nick, const String& hostmask);
|
|
void handle_topic(const String& nick, const String& topic);
|
|
|
|
IRCWindow& window() { return *m_window; }
|
|
const IRCWindow& window() const { return *m_window; }
|
|
|
|
String topic() const { return m_topic; }
|
|
|
|
void notify_nick_changed(const String& old_nick, const String& new_nick);
|
|
|
|
private:
|
|
IRCChannel(IRCClient&, const String&);
|
|
|
|
IRCClient& m_client;
|
|
String m_name;
|
|
String m_topic;
|
|
struct Member {
|
|
String name;
|
|
char prefix { 0 };
|
|
};
|
|
Vector<Member> m_members;
|
|
bool m_open { false };
|
|
|
|
Retained<IRCLogBuffer> m_log;
|
|
Retained<IRCChannelMemberListModel> m_member_model;
|
|
IRCWindow* m_window { nullptr };
|
|
};
|