Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IRC RC feed #375

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/huggle_core/hugglefeedproviderirc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <libirc/libircclient/parser.h>
#include <libirc/libircclient/network.h>
#include <libirc/libircclient/channel.h>
#include <libirc/libircclient/priority.h>
#include <random>
#include <chrono>

Expand Down Expand Up @@ -64,11 +65,11 @@ bool HuggleFeedProviderIRC::Start()
int randomNumber = dist(rng);
nick += QString::number(randomNumber);
libirc::ServerAddress server(hcfg->SystemConfig_IRCServer, false, hcfg->SystemConfig_IRCPort, nick);
server.SetSuffix(this->GetSite()->IRCChannel);
this->network = new libircclient::Network(server, "Wikimedia IRC");
this->network->SetDefaultUsername(Configuration::HuggleConfiguration->HuggleVersion);
this->network->SetDefaultIdent("huggle");
connect(this->network, SIGNAL(Event_Connected()), this, SLOT(OnConnected()));
connect(this->network, SIGNAL(Event_Parse(libircclient::Parser*)), this, SLOT(OnParse(libircclient::Parser*)));
//connect(this->Network, SIGNAL(Event_SelfJoin(libircclient::Channel*)), this, SLOT(OnIRCSelfJoin(libircclient::Channel*)));
//connect(this->Network, SIGNAL(Event_SelfPart(libircclient::Parser*,libircclient::Channel*)), this, SLOT(OnIRCSelfPart(libircclient::Parser*,libircclient::Channel*)));
connect(this->network, SIGNAL(Event_PRIVMSG(libircclient::Parser*)), this, SLOT(OnIRCChannelMessage(libircclient::Parser*)));
Expand Down Expand Up @@ -328,6 +329,17 @@ QString HuggleFeedProviderIRC::ToString()
return "IRC";
}

void HuggleFeedProviderIRC::OnParse(libircclient::Parser *px)
{
// Workaround for libirc not performing autojoin with the new IRC RC server
// implementation, which only sends 1 parameter with the MYINFO command --
// libirc doesn't autojoin unless there are 4+ parameters to the MYINFO
// command. Instead of letting libirc autojoin, we handle it instead.
if (px->GetNumeric() == IRC_NUMERIC_MYINFO) {
this->network->RequestJoin(this->GetSite()->IRCChannel, libircclient::Priority_Low);
}
}

void HuggleFeedProviderIRC::OnIRCChannelMessage(libircclient::Parser *px)
{
this->ParseEdit(px->GetText());
Expand Down
1 change: 1 addition & 0 deletions src/huggle_core/hugglefeedproviderirc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace Huggle
private slots:
void OnIRCChannelMessage(libircclient::Parser *px);
void OnConnected();
void OnParse(libircclient::Parser *px);
void OnFailure(QString reason, int code);
void OnDisconnected();
protected:
Expand Down
Loading