22 #include "packets/CorporationPkts.h"
45 m_strBoundObjectName =
"AllianceBound";
80 _log(ALLY__CALL,
"AllianceBound::Handle_GetAlliance() size=%u", call.
tuple->
size());
81 call.
Dump(ALLY__CALL_DUMP);
91 _log(ALLY__CALL,
"AllianceBound::Handle_GetMembers() size=%u", call.
tuple->
size());
92 call.
Dump(ALLY__CALL_DUMP);
102 _log(ALLY__CALL,
"AllianceBound::Handle_DeclareExecutorSupport() size=%u", call.
tuple->
size());
103 call.
Dump(ALLY__CALL_DUMP);
105 Call_SingleIntegerArg
args;
106 if (!args.Decode(&call.
tuple))
108 _log(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
120 _log(ALLY__CALL,
"AllianceBound::Handle_DeleteMember() size=%u", call.
tuple->
size());
121 call.
Dump(ALLY__CALL_DUMP);
123 Call_SingleIntegerArg
args;
124 if (!args.Decode(&call.
tuple))
126 _log(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
139 _log(ALLY__CALL,
"AllianceBound::Handle_GetApplications() size=%u", call.
tuple->
size());
140 call.
Dump(ALLY__CALL_DUMP);
150 _log(ALLY__CALL,
"AllianceBound::Handle_UpdateApplication() size=%u", call.
tuple->
size());
151 call.
Dump(ALLY__CALL_DUMP);
153 Call_UpdateAllianceApplication
args;
154 if (!args.Decode(&call.
tuple))
156 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
159 args.Dump(ALLY__TRACE);
172 _log(SERVICE__ERROR,
"%s: Failed to query application for corp %u alliance %u", call.
client->
GetName(), args.corporationID,
m_allyID);
178 newInfo.
valid =
true;
179 newInfo.
state = args.applicationStatus;
182 _log(SERVICE__ERROR,
"%s: Failed to update application for corp %u alliance %u", call.
client->
GetName(), args.corporationID,
m_allyID);
186 OnAllianceApplicationChanged oaac;
187 oaac.allianceID = newInfo.
allyID;
188 oaac.corpID = newInfo.
corpID;
192 std::vector<Client *> list;
198 OnAllianceMemberChange oamc;
199 oamc.allyID = newInfo.
allyID;
200 oamc.corpID = newInfo.
corpID;
208 for (
auto cur : list)
212 cur->SendNotification(
"OnAllianceMemberChanged",
"clientID", oamc.Encode(),
false);
213 _log(ALLY__TRACE,
"OnAllianceMemberChanged sent to %s (%u)", cur->GetName(), cur->GetCharID());
219 for (
auto cur : list)
223 cur->SendNotification(
"OnAllianceMemberChanged",
"clientID", oamc.Encode(),
false);
224 _log(ALLY__TRACE,
"OnAllianceMemberChanged sent to %s (%u)", cur->GetName(), cur->GetCharID());
236 codelog(SERVICE__ERROR,
"Alliance join failed.");
243 codelog(SERVICE__ERROR,
"Add corp employment failed.");
248 std::string subject =
"Application to alliance accepted";
249 std::string message =
"Your alliance application has been accepted.";
251 std::vector<int32> recipients;
256 OnAllianceChanged ac;
260 codelog(SERVICE__ERROR,
"Failed to create OnAllianceChanged notification stream.");
267 sEntityList.GetCorpClients(list, args.corporationID);
268 for (
auto cur : list)
272 cur->SendNotification(
"OnAllianceChanged",
"clientID", ac.Encode(),
false);
273 _log(ALLY__TRACE,
"OnAllianceChanged sent to %s (%u)", cur->GetName(), cur->GetCharID());
280 _log(ALLY__TRACE,
"Application of %u:%u has been rejected, sending notification...",
m_allyID, args.corporationID);
285 _log(SERVICE__ERROR,
"%s: Sent unhandled status %u ", call.
client->
GetName(), args.applicationStatus);
293 for (
auto cur : list)
297 cur->SendNotification(
"OnAllianceApplicationChanged",
"clientID", oaac.Encode(),
false);
298 _log(ALLY__TRACE,
"OnAllianceApplicationChanged sent to %s (%u)", cur->GetName(), cur->GetCharID());
304 for (
auto cur : list)
308 cur->SendNotification(
"OnAllianceApplicationChanged",
"clientID", oaac.Encode(),
false);
309 _log(ALLY__TRACE,
"OnAllianceApplicationChanged sent to %s (%u)", cur->GetName(), cur->GetCharID());
328 OAAC.deletedOld =
new PyBool(
true);
341 OAAC.deletedNew =
new PyBool(
true);
366 _log(ALLY__CALL,
"AllianceBound::Handle_AddToVoiceChat() size=%u", call.
tuple->
size());
367 call.
Dump(ALLY__CALL_DUMP);
374 _log(ALLY__CALL,
"AllianceBound::Handle_PayBill() size=%u", call.
tuple->
size());
375 call.
Dump(ALLY__CALL_DUMP);
383 _log(ALLY__CALL,
"AllianceBound::Handle_GetBillBalance() size=%u", call.
tuple->
size());
384 call.
Dump(ALLY__CALL_DUMP);
392 _log(ALLY__CALL,
"AllianceBound::Handle_GetBills() size=%u", call.
tuple->
size());
393 call.
Dump(ALLY__CALL_DUMP);
401 _log(ALLY__CALL,
"AllianceBound::Handle_GetBillsReceivable() size=%u", call.
tuple->
size());
402 call.
Dump(ALLY__CALL_DUMP);
411 _log(ALLY__CALL,
"AllianceBound::Handle_AddBulletin() size=%u", call.
tuple->
size());
412 call.
Dump(ALLY__CALL_DUMP);
414 Call_AddBulletin
args;
415 if (!args.Decode(&call.
tuple))
417 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
429 _log(ALLY__CALL,
"AllianceBound::Handle_DeleteBulletin() size=%u", call.
tuple->
size());
430 call.
Dump(ALLY__CALL_DUMP);
432 Call_SingleIntegerArg
args;
433 if (!args.Decode(&call.
tuple))
435 _log(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
446 _log(ALLY__CALL,
"AllianceBound::Handle_GetBulletins() size=%u", call.
tuple->
size());
447 call.
Dump(ALLY__CALL_DUMP);
454 _log(ALLY__CALL,
"AllianceBound::Handle_GetAllianceContacts() size=%u", call.
tuple->
size());
455 call.
Dump(ALLY__CALL_DUMP);
463 _log(ALLY__CALL,
"AllianceBound::Handle_AddAllianceContact() size=%u", call.
tuple->
size());
464 call.
Dump(ALLY__CALL_DUMP);
466 Call_CorporateContactData
args;
467 if (!args.Decode(&call.
tuple))
469 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
481 _log(ALLY__CALL,
"AllianceBound::Handle_EditAllianceContact() size=%u", call.
tuple->
size());
482 call.
Dump(ALLY__CALL_DUMP);
484 Call_CorporateContactData
args;
485 if (!args.Decode(&call.
tuple))
487 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
499 _log(ALLY__CALL,
"AllianceBound::Handle_RemoveAllianceContacts() size=%u", call.
tuple->
size());
500 call.
Dump(ALLY__CALL_DUMP);
502 Call_RemoveCorporateContacts
args;
503 if (!args.Decode(&call.
tuple))
505 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
520 _log(ALLY__CALL,
"AllianceBound::Handle_EditContactsRelationshipID() size=%u", call.
tuple->
size());
521 call.
Dump(ALLY__CALL_DUMP);
523 Call_EditCorporateContacts
args;
524 if (!args.Decode(&call.
tuple))
526 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
541 _log(ALLY__CALL,
"AllianceBound::Handle_GetLabels() size=%u", call.
tuple->
size());
542 call.
Dump(ALLY__CALL_DUMP);
549 _log(ALLY__CALL,
"AllianceBound::Handle_CreateLabel() size=%u", call.
tuple->
size());
550 call.
Dump(ALLY__CALL_DUMP);
557 _log(ALLY__CALL,
"AllianceBound::Handle_DeleteLabel() size=%u", call.
tuple->
size());
558 call.
Dump(ALLY__CALL_DUMP);
565 _log(ALLY__CALL,
"AllianceBound::Handle_EditLabel() size=%u", call.
tuple->
size());
566 call.
Dump(ALLY__CALL_DUMP);
573 _log(ALLY__CALL,
"AllianceBound::Handle_AssignLabels() size=%u", call.
tuple->
size());
574 call.
Dump(ALLY__CALL_DUMP);
581 _log(ALLY__CALL,
"AllianceBound::Handle_RemoveLabels() size=%u", call.
tuple->
size());
582 call.
Dump(ALLY__CALL_DUMP);
589 _log(ALLY__CALL,
"AllianceBound::Handle_UpdateAlliance() size=%u", call.
tuple->
size());
590 call.
Dump(ALLY__CALL_DUMP);
592 Call_UpdateAlliance
args;
593 if (!args.Decode(&call.
tuple))
595 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
602 OnAllianceChanged ac;
606 codelog(SERVICE__ERROR,
"Failed to create OnAllianceChanged notification stream.");
Dispatcher *const m_dispatch
static void FillOAMemberChange(OnAllianceMemberChange &OAMC, const Alliance::ApplicationInfo &Old, const Alliance::ApplicationInfo &New)
void UpdateAlliance(uint32 allyID, std::string description, std::string url)
void SendNotification(const PyAddress &dest, EVENotificationStream ¬i, bool seq=true)
void SendErrorMsg(const char *fmt,...)
#define _log(type, fmt,...)
bool CreateAllianceChangePacket(OnAllianceChanged &ac, uint32 oldAllyID, uint32 newAllyID)
void DeleteMember(uint32 allyID, uint32 corpID)
PyRep * GetMembers(uint32 allyID)
void SendMail(uint32 sender, uint32 recipient, const std::string &subject, const std::string &content)
int32 GetCharacterID() const
int32 GetCorporationID() const
storage_type::const_iterator const_iterator
bool AddEmployment(uint32 allyID, uint32 corpID)
static uint32 IntegerValueU32(PyRep *pRep)
int64 GetClientID() const
static uint32 GetCorporationCEO(uint32 corpID)
void DeclareExecutorSupport(uint32 corpID, uint32 chosenExecutor)
static uint32 GetExecutorID(uint32 allyID)
bool UpdateCorpAlliance(uint32 allyID, uint32 corpID)
#define codelog(type, fmt,...)
PyRep * GetBulletins(uint32 allyID)
PyRep * GetAlliance(uint32 allyID)
void UpdateContact(int32 relationshipID, uint32 contactID, uint32 ownerID)
static void DeleteBulletin(uint32 bulletinID)
const char * GetName() const
#define PyCallable_REG_CALL(c, m)
PyRep * GetApplications(uint32 allyID)
void InvalidateCache(const PyRep *objectID)
PyServiceMgr *const m_manager
ObjCacheService * cache_service
void AddBulletin(uint32 allyID, uint32 ownerID, uint32 cCharID, std::string &title, std::string &body)
void Dump(LogType type) const
void RemoveContact(uint32 contactID, uint32 ownerID)
PyRep * GetContacts(uint32 allyID)
static void FillOAApplicationChange(OnAllianceApplicationChanged &OAAC, const Alliance::ApplicationInfo &Old, const Alliance::ApplicationInfo &New)
void AddContact(uint32 ownerID, Call_CorporateContactData contactData)
bool UpdateApplication(const Alliance::ApplicationInfo &aInfo)
static std::string GetCorpName(uint32 corpID)
const char * GetName() const
bool GetCurrentApplicationInfo(uint32 allyID, uint32 corpID, Alliance::ApplicationInfo &aInfo)