~ubuntu-branches/ubuntu/vivid/manaplus/vivid-proposed

« back to all changes in this revision

Viewing changes to src/auctionmanager.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-10-12 12:23:57 UTC
  • mfrom: (1.1.36)
  • Revision ID: package-import@ubuntu.com-20141012122357-7836sgv1j1v02cs2
Tags: 1.4.10.11-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  The ManaPlus Client
3
 
 *  Copyright (C) 2011-2014  The ManaPlus Developers
4
 
 *
5
 
 *  This file is part of The ManaPlus Client.
6
 
 *
7
 
 *  This program is free software; you can redistribute it and/or modify
8
 
 *  it under the terms of the GNU General Public License as published by
9
 
 *  the Free Software Foundation; either version 2 of the License, or
10
 
 *  any later version.
11
 
 *
12
 
 *  This program is distributed in the hope that it will be useful,
13
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 *  GNU General Public License for more details.
16
 
 *
17
 
 *  You should have received a copy of the GNU General Public License
18
 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 
 */
20
 
 
21
 
#include "auctionmanager.h"
22
 
 
23
 
#include "client.h"
24
 
#include "configuration.h"
25
 
 
26
 
#include "net/chathandler.h"
27
 
 
28
 
#include "debug.h"
29
 
 
30
 
AuctionManager *auctionManager = nullptr;
31
 
 
32
 
bool AuctionManager::mEnableAuctionBot = false;
33
 
 
34
 
AuctionManager::AuctionManager()
35
 
{
36
 
}
37
 
 
38
 
AuctionManager::~AuctionManager()
39
 
{
40
 
}
41
 
 
42
 
void AuctionManager::init()
43
 
{
44
 
    if (auctionManager)
45
 
        return;
46
 
 
47
 
    int val = serverConfig.getValue("enableAuctionBot", -1);
48
 
    if (val == -1)
49
 
    {
50
 
        if (client->isTmw())
51
 
            val = 1;
52
 
        else
53
 
            val = 0;
54
 
        serverConfig.setValue("enableAuctionBot", val);
55
 
    }
56
 
    mEnableAuctionBot = (val != 0);
57
 
    if (mEnableAuctionBot)
58
 
        auctionManager = new AuctionManager();
59
 
}
60
 
 
61
 
void AuctionManager::send(const std::string &msg)
62
 
{
63
 
    if (chatHandler)
64
 
        chatHandler->privateMessage("AuctionBot", msg);
65
 
}
66
 
 
67
 
/*
68
 
bool AuctionManager::processAuctionMessage(const std::string &msg)
69
 
{
70
 
    if (msg.size() > 4 && msg[0] == '#' && msg[1] == '#')
71
 
        msg = msg.substr(3);
72
 
    return false;
73
 
}
74
 
*/
75
 
 
76
 
void AuctionManager::clear()
77
 
{
78
 
}
79
 
 
80
 
void AuctionManager::reload()
81
 
{
82
 
}
83
 
 
84
 
void AuctionManager::sendMail(const std::string &mail)
85
 
{
86
 
    if (chatHandler)
87
 
        chatHandler->privateMessage("AuctionBot", "!mail " + mail);
88
 
}