This commit is contained in:
Green Sky 2024-10-24 14:56:26 +02:00
parent 7973c7a320
commit e4eaf91a68
No known key found for this signature in database
4 changed files with 23 additions and 16 deletions

View File

@ -19,19 +19,21 @@ IRCClientContactModel::IRCClientContactModel(
Contact3Registry& cr,
ConfigModelI& conf,
IRCClient1& ircc
) : _cr(cr), _conf(conf), _ircc(ircc) {
_ircc.subscribe(this, IRCClient_Event::CONNECT);
) : _cr(cr), _conf(conf), _ircc(ircc), _ircc_sr(_ircc.newSubRef(this)) {
_ircc_sr
.subscribe(IRCClient_Event::CONNECT)
_ircc.subscribe(this, IRCClient_Event::NUMERIC);
.subscribe(IRCClient_Event::NUMERIC)
_ircc.subscribe(this, IRCClient_Event::JOIN);
_ircc.subscribe(this, IRCClient_Event::PART);
_ircc.subscribe(this, IRCClient_Event::TOPIC);
_ircc.subscribe(this, IRCClient_Event::QUIT);
.subscribe(IRCClient_Event::JOIN)
.subscribe(IRCClient_Event::PART)
.subscribe(IRCClient_Event::TOPIC)
.subscribe(IRCClient_Event::QUIT)
_ircc.subscribe(this, IRCClient_Event::CTCP_REQ);
.subscribe(IRCClient_Event::CTCP_REQ)
_ircc.subscribe(this, IRCClient_Event::DISCONNECT);
.subscribe(IRCClient_Event::DISCONNECT)
;
// dont create server self etc until connect event comes

View File

@ -16,6 +16,7 @@ class IRCClientContactModel : public IRCClientEventI, public ContactModel3I {
Contact3Registry& _cr;
ConfigModelI& _conf;
IRCClient1& _ircc;
IRCClient1::SubscriptionReference _ircc_sr;
// cm needs the connect event to happen
bool _connected {false};

View File

@ -22,14 +22,16 @@ IRCClientMessageManager::IRCClientMessageManager(
ConfigModelI& conf,
IRCClient1& ircc,
IRCClientContactModel& ircccm
) : _rmm(rmm), _cr(cr), _conf(conf), _ircc(ircc), _ircccm(ircccm) {
_ircc.subscribe(this, IRCClient_Event::CHANNEL);
_ircc.subscribe(this, IRCClient_Event::PRIVMSG);
_ircc.subscribe(this, IRCClient_Event::NOTICE);
_ircc.subscribe(this, IRCClient_Event::CHANNELNOTICE);
_ircc.subscribe(this, IRCClient_Event::CTCP_ACTION);
) : _rmm(rmm), _rmm_sr(_rmm.newSubRef(this)), _cr(cr), _conf(conf), _ircc(ircc), _ircc_sr(_ircc.newSubRef(this)), _ircccm(ircccm) {
_ircc_sr
.subscribe(IRCClient_Event::CHANNEL)
.subscribe(IRCClient_Event::PRIVMSG)
.subscribe(IRCClient_Event::NOTICE)
.subscribe(IRCClient_Event::CHANNELNOTICE)
.subscribe(IRCClient_Event::CTCP_ACTION)
;
_rmm.subscribe(this, RegistryMessageModel_Event::send_text);
_rmm_sr.subscribe(RegistryMessageModel_Event::send_text);
}
IRCClientMessageManager::~IRCClientMessageManager(void) {

View File

@ -7,9 +7,11 @@
class IRCClientMessageManager : public IRCClientEventI, public RegistryMessageModelEventI {
protected:
RegistryMessageModelI& _rmm;
RegistryMessageModelI::SubscriptionReference _rmm_sr;
Contact3Registry& _cr;
ConfigModelI& _conf;
IRCClient1& _ircc;
IRCClient1::SubscriptionReference _ircc_sr;
IRCClientContactModel& _ircccm;
public: