Prepare to add ability for admin to set MOTD
authorunc0rr
Fri, 27 Mar 2009 14:02:27 +0000
changeset 1924 8f8fe856ce9d
parent 1923 956b6b3529bc
child 1925 ec923e56c444
Prepare to add ability for admin to set MOTD
QTfrontend/hwform.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
gameServer/NetRoutines.hs
--- a/QTfrontend/hwform.cpp	Thu Mar 26 19:28:56 2009 +0000
+++ b/QTfrontend/hwform.cpp	Fri Mar 27 14:02:27 2009 +0000
@@ -593,6 +593,9 @@
 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
 
+// admin stuff
+	connect(hwnet, SIGNAL(serverMessage(const QString&)), ui.pageAdmin, SLOT(serverMessage(const QString &)));
+
 // disconnect
 	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()), Qt::QueuedConnection);
 	
--- a/QTfrontend/pages.cpp	Thu Mar 26 19:28:56 2009 +0000
+++ b/QTfrontend/pages.cpp	Fri Mar 27 14:02:27 2009 +0000
@@ -981,5 +981,25 @@
 {
 	QGridLayout * pageLayout = new QGridLayout(this);
 
+	QLabel * lblSM = new QLabel(this);
+	lblSM->setText(tr("Server message:"));
+	pageLayout->addWidget(lblSM, 0, 0);
+
+	leServerMessage = new QLineEdit(this);
+	pageLayout->addWidget(leServerMessage, 0, 1);
+
+	pbSetSM = addButton(tr("Set message"), pageLayout, 0, 2);
 	BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
+
+	connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged()));
 }
+
+void PageAdmin::smChanged()
+{
+	emit setServerMessage(leServerMessage->text());
+}
+
+void PageAdmin::serverMessage(const QString & str)
+{
+	leServerMessage->setText(str);
+}
--- a/QTfrontend/pages.h	Thu Mar 26 19:28:56 2009 +0000
+++ b/QTfrontend/pages.h	Fri Mar 27 14:02:27 2009 +0000
@@ -446,6 +446,19 @@
 	PageAdmin(QWidget* parent = 0);
 
 	QPushButton * BtnBack;
+
+private:
+	QLineEdit * leServerMessage;
+	QPushButton * pbSetSM;
+
+private slots:
+	void smChanged();
+
+public slots:
+	void serverMessage(const QString & str);
+
+signals:
+	void setServerMessage(const QString & str);
 };
 
 #endif // PAGES_H
--- a/gameServer/NetRoutines.hs	Thu Mar 26 19:28:56 2009 +0000
+++ b/gameServer/NetRoutines.hs	Fri Mar 27 14:02:27 2009 +0000
@@ -55,7 +55,6 @@
 		forkIO $ clientSendLoop cHandle coreChan sendChan nextID
 		return ()
 
-	yield -- hm?
 	acceptLoop servSock coreChan nextID
 	where
 		nextID = clientCounter + 1