summaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-20 21:55:56 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-20 21:55:56 +0300
commit99df456164cbb994e2d789c25b193074476a97a2 (patch)
treed81a08e2896ce891dc1b6cdb011c672ef7aa10c3 /src/listeners
parent5688ea69de4884a464cefd4b47069b15f16b9e36 (diff)
downloadplus-99df456164cbb994e2d789c25b193074476a97a2.tar.gz
plus-99df456164cbb994e2d789c25b193074476a97a2.tar.bz2
plus-99df456164cbb994e2d789c25b193074476a97a2.tar.xz
plus-99df456164cbb994e2d789c25b193074476a97a2.zip
Move requesttradelistener into separate file.
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/requesttradelistener.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/listeners/requesttradelistener.h b/src/listeners/requesttradelistener.h
new file mode 100644
index 000000000..54cbce8de
--- /dev/null
+++ b/src/listeners/requesttradelistener.h
@@ -0,0 +1,51 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "being/playerrelations.h"
+
+#include "gui/windows/confirmdialog.h"
+
+#include "net/tradehandler.h"
+
+#include "listeners/actionlistener.h"
+
+#include <string>
+
+#include "localconsts.h"
+
+extern std::string tradePartnerName;
+extern ConfirmDialog *confirmDlg;
+
+/**
+ * Listener for request trade dialogs
+ */
+struct RequestTradeListener final : public ActionListener
+{
+ void action(const ActionEvent &event)
+ {
+ confirmDlg = nullptr;
+ const std::string &eventId = event.getId();
+ if (eventId == "ignore")
+ player_relations.ignoreTrade(tradePartnerName);
+ Net::getTradeHandler()->respond(eventId == "yes");
+ }
+};