Skip to content

Commit cdeed3a

Browse files
committed
implemented ctcp
1 parent 798de42 commit cdeed3a

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/GrumpyIRC/mainwindow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ MainWindow::MainWindow(bool fork, MainWindow *parent)
146146
// Try to restore geometry
147147
this->restoreGeometry(GCFG->GetValue("mainwindow_geometry").toByteArray());
148148
this->restoreState(GCFG->GetValue("mainwindow_state").toByteArray());
149+
this->ui->actionFavorites->setVisible(false);
149150
}
150151

151152
MainWindow::~MainWindow()

src/libcore/ircsession.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,22 @@ void IRCSession::OnCTCP(libircclient::Parser *px, QString ctcp, QString pars)
729729
this->processME(px, pars);
730730
return;
731731
}
732-
if (target != this->GetNetwork()->GetNick())
732+
QString final_text = ctcp;
733+
if (!pars.isEmpty())
734+
final_text += " " + pars;
735+
if (target != this->GetNetwork()->GetNick())
736+
{
737+
// this is most likely a channel CTCP
738+
Scrollback *sc = this->GetScrollbackForChannel(target);
739+
if (!sc)
740+
{
741+
this->systemWindow->InsertText("Incoming CTCP for unknown target (" + target + ") from " + px->GetSourceInfo() + ": " + final_text);
742+
} else
743+
{
744+
sc->InsertText(ScrollbackItem(final_text, ScrollbackItemType_Notice, libircclient::User(px->GetSourceUserInfo())));
745+
}
733746
return;
747+
}
734748
if (ctcp == "VERSION")
735749
{
736750
if (!px->GetSourceUserInfo())
@@ -742,10 +756,7 @@ void IRCSession::OnCTCP(libircclient::Parser *px, QString ctcp, QString pars)
742756
return;
743757
this->GetNetwork()->SendNotice("TIME " + QDateTime::currentDateTime().toString(), px->GetSourceUserInfo()->GetNick());
744758
}
745-
if (pars.isEmpty())
746-
this->systemWindow->InsertText("Incoming CTCP from " + px->GetSourceInfo() + ": " + ctcp);
747-
else
748-
this->systemWindow->InsertText("Incoming CTCP from " + px->GetSourceInfo() + ": " + ctcp + " " + pars);
759+
this->systemWindow->InsertText("Incoming CTCP from " + px->GetSourceInfo() + ": " + final_text);
749760
}
750761

751762
void IRCSession::OnMOTD(libircclient::Parser *px)

0 commit comments

Comments
 (0)