-
Notifications
You must be signed in to change notification settings - Fork 4
/
call.h
187 lines (140 loc) · 4.5 KB
/
call.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#ifndef CALL_H
#define CALL_H
/**
* -----------------------------------------------------
* File call.h
* Authors David Ordnung, Impact
* License GPLv3
* Web http://dordnung.de, http://gugyclan.eu
* -----------------------------------------------------
*
* Copyright (C) 2013-2017 David Ordnung, Impact
*
* 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 3 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/>
*/
#pragma once
// Precomp Header
#include <wx/wxprec.h>
// c++ libs
#include <string>
#include <sstream>
// We need WX
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
// Steam Class
#include "opensteam.h"
#include "calladmin-client.h"
// Call Dialog Class
class CallDialog: public wxDialog
{
private:
// We need information about a call ;)
wxString callID;
wxString fullIP;
wxString serverName;
wxString target;
wxString targetID;
wxString client;
wxString clientID;
wxString reason;
wxString boxText;
std::string reportedAt;
// Layout
wxSizer* sizerTop;
// Avatars
wxStaticBitmap* clientAvatar;
wxStaticBitmap* targetAvatar;
wxStaticText* doneText;
// And for the Steam API
CSteamID clientCID;
CSteamID targetCID;
// Item List
int ID;
bool isHandled;
public:
CallDialog(const wxString& title) : wxDialog(NULL, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxMINIMIZE_BOX)
{
// Initialize vars
sizerTop = NULL;
clientAvatar = NULL;
targetAvatar = NULL;
doneText = NULL;
ID = 0;
isHandled = false;
takeover = NULL;
contactTrackers = NULL;
avatarTimer = NULL;
}
// Tracker button
wxButton* contactTrackers;
// take Over Button
wxButton* takeover;
// Privat -> set Methods
void setCallID(const char* ID) {callID = ID;}
void setIP(const char* IP) {fullIP = IP;}
void setName(wxString name) {serverName = name;}
void setTarget(const char* name) {target = name;}
void setTargetID(const char* steamidID) {targetID = steamidID; targetCID = steamIDtoCSteamID((char*)(steamidID));}
void setClient(const char* name) {client = name;}
void setClientID (const char* steamidID) {clientID = steamidID; clientCID = steamIDtoCSteamID((char*)(steamidID));}
void setReason (const char* name) {reason = name;}
void setID(int num) {ID = num;}
void setTime(const char* time) {reportedAt = time;}
void setBoxText(wxString text) {boxText = text;}
void setHandled(bool handled) {isHandled = handled;}
void setFinish() {doneText->SetLabelText("Finished"); doneText->SetForegroundColour(wxColour(34, 139, 34)); sizerTop->Layout();}
// Convert to community ID
static CSteamID steamIDtoCSteamID(char* steamid);
// Return time as a int
inline int getTime() const
{
int timestamp;
std::stringstream timeS(reportedAt);
timeS >> timestamp;
return timestamp;
}
// Timers
AvatarTimer *avatarTimer;
// Methods for Details
wxString getTarget() const {return target;}
wxString getClient() const {return client;}
wxString getID() const {return callID;}
wxString getServer() {return serverName;}
wxString getBoxText() {return boxText;}
CSteamID* getClientCID() {return &clientCID;}
CSteamID* getTargetCID() {return &targetCID;}
bool getHandled() {return isHandled;}
// Start the call
void startCall(bool show);
// Operator overloadings
friend bool operator==(const CallDialog& x, const CallDialog& y) { return (x.getTime() == y.getTime() && (x.getID() == y.getID())); }
friend bool operator!=(const CallDialog& x, const CallDialog& y) { return !(x == y);}
protected:
// Button Events
void OnConnect(wxCommandEvent& event);
void OnCheck(wxCommandEvent& event);
void OnContactClient(wxCommandEvent& event);
void OnContactTarget(wxCommandEvent& event);
void OnContactTrackers(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void OnMinimizeWindow(wxIconizeEvent& event);
DECLARE_EVENT_TABLE()
};
// CURL Callbacks
void onGetTrackers(char* errors, wxString result, int x);
void onChecked(char* error, wxString result, int x);
// Call Dialogs
extern CallDialog *call_dialogs[MAXCALLS];
#endif