mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:52:46 +00:00 
			
		
		
		
	 fa69b9fbb7
			
		
	
	
		fa69b9fbb7
		
	
	
	
	
		
			
			This seemed like a perfect fit for LibHTML. We can now style the IRC channels and queries however we like with the power of HTML and CSS. This patch doesn't do much in the way of styling, it just gets the basic mechanism into place.
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			855 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			855 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/RefCounted.h>
 | |
| #include <AK/RefPtr.h>
 | |
| #include <AK/String.h>
 | |
| #include <LibDraw/Color.h>
 | |
| #include <LibHTML/DOM/Document.h>
 | |
| 
 | |
| class IRCLogBuffer : public RefCounted<IRCLogBuffer> {
 | |
| public:
 | |
|     static NonnullRefPtr<IRCLogBuffer> create();
 | |
|     ~IRCLogBuffer();
 | |
| 
 | |
|     struct Message {
 | |
|         time_t timestamp { 0 };
 | |
|         char prefix { 0 };
 | |
|         String sender;
 | |
|         String text;
 | |
|         Color color { Color::Black };
 | |
|     };
 | |
| 
 | |
|     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;
 | |
| 
 | |
|     const Document& document() const { return *m_document; }
 | |
|     Document& document() { return *m_document; }
 | |
| 
 | |
| private:
 | |
|     IRCLogBuffer();
 | |
|     RefPtr<Document> m_document;
 | |
|     RefPtr<Element> m_container_element;
 | |
| };
 |