Planeshift

invitemanager.h

Go to the documentation of this file.
00001 /*
00002  * invitemanager.h
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 
00021 #ifndef __INVITEMANAGER_H__
00022 #define __INVITEMANAGER_H__
00023 
00024 //=============================================================================
00025 // Crystal Space Includes
00026 //=============================================================================
00027 
00028 //=============================================================================
00029 // Project Includes
00030 //=============================================================================
00031 
00032 //=============================================================================
00033 // Local Includes
00034 //=============================================================================
00035 #include "questionmanager.h"
00036 
00037 
00038 #define FIRST_SPAM_FINE 10
00039 #define SECOND_SPAM_FINE 30
00040 static const int INVITESPAMBANTIME[5] = {1, 5, 10, // Ban times in minutes
00041                                         30, 10
00042                                         };  // spamPoints expire based on SP+1's ban time
00043 
00044 
00045 class psInviteGameEvent;
00046 class Client;
00047 
00055 class PendingInvite : public PendingQuestion
00056 {
00057 public:
00058 
00059     int inviterClientNum;
00060 
00062     csString accept, reject;
00063 
00065     csString inviterAcceptance, inviteeAcceptance;
00066 
00068     csString inviterRejection, inviteeRejection;
00069 
00071     csString inviterName, inviteeName;
00072 
00073     bool cannotAccept;  
00074 
00075     PendingInvite(Client* inviter,
00076                   Client* invitee,
00077                   bool penalize,
00078                   const char* question_str,
00079                   const char* accept_button,
00080                   const char* reject_button,
00081                   const char* inviter_explanation,
00082                   const char* invitee_explanation,
00083                   const char* inviter_acceptance,
00084                   const char* invitee_acceptance,
00085                   const char* inviter_rejection,
00086                   const char* invitee_rejection,
00087                   psQuestionMessage::questionType_t invType);
00088 
00089     virtual void HandleAnswer(const csString &answer);
00090     virtual void HandleTimeout();
00091 
00092 
00093 protected:
00094 
00095     bool CheckForSpam(Client* inviter, psQuestionMessage::questionType_t type);
00096     void HandleSpamPoints(bool accepted);
00097 };
00098 
00099 
00100 #endif
00101