45 m_strBoundObjectName =
"CorpRegistryBound";
183 Call_SingleIntegerArg
args;
186 if (args.Decode (call.
tuple) ==
false)
262 PyResult CorpRegistryBound::Handle_GetMemberIDsWithMoreThanAvgShares(
PyCallArgs &call)
269 Call_TwoIntegerArgs
args;
270 if (!args.Decode(&call.
tuple)) {
271 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
280 Call_SingleIntegerArg arg;
281 if (!arg.Decode(&call.
tuple)) {
282 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
292 Call_SingleIntegerArg arg;
293 if (!arg.Decode(&call.
tuple)) {
294 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
304 Call_SingleBoolArg arg;
305 if (!arg.Decode(&call.
tuple)) {
306 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
316 Call_SingleIntegerArg
args;
317 if (!args.Decode(&call.
tuple)) {
318 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
326 Call_GetRecentKillsAndLosses
args;
327 if (!args.Decode(&call.
tuple)) {
328 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
337 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetMember()");
338 Call_SingleIntegerArg
args;
339 if (!args.Decode(&call.
tuple)) {
340 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
347 rep->
Dump(CORP__RSP_DUMP,
"");
354 Call_SingleIntegerArg
args;
355 if (!args.Decode(&call.
tuple)) {
356 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
370 Call_SingleWStringArg
args;
371 if (!args.Decode(&call.
tuple)) {
372 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
377 SuggestedTickerName sTN;
379 uint32 cnLen = args.arg.length();
381 for (
uint32 i=0; i < cnLen; ++i)
382 if (args.arg[i] >=
'A' && args.arg[i] <=
'Z')
383 sTN.tName += args.arg[i];
385 result->
AddItem( sTN.Encode() );
391 Call_SingleWStringArg
args;
392 if (!args.Decode(&call.
tuple)) {
393 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
397 SuggestedShortName sSN;
399 uint32 cnLen = args.arg.length();
401 for (
uint32 i=0; i < cnLen; ++i)
402 if (args.arg[i] >=
'A' && args.arg[i] <=
'Z')
403 sSN.sName += args.arg[i];
405 result->
AddItem( sSN.Encode() );
456 GetMembersSparseRowset ret;
457 ret.boundObject = boundObject;
458 ret.realRowCount = rowCount;
464 Call_UpdateDivisionNames
args;
465 if (!args.Decode(&call.
tuple)) {
466 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
472 notif.data =
new PyDict();
475 codelog(SERVICE__ERROR,
"%s: Failed to update division names for corp %u", call.
client->
GetName(), notif.key);
481 if (notif.data->items.size()) {
485 PyTuple * answer = notif.Encode();
486 sEntityList.Multicast(
"OnCorporationChanged",
"corpid", &answer, mct);
500 Call_SingleIntegerArg arg;
501 if (!arg.Decode(&call.
tuple)) {
502 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
540 list->
Dump(CORP__RSP_DUMP,
"");
547 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetMembersByIds()");
548 call.
Dump(CORP__CALL_DUMP);
550 Call_GetMembersByID
args;
551 if (!args.Decode(&call.
tuple)) {
552 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
561 list->
Dump(CORP__RSP_DUMP,
"");
568 Call_AddCorporation
args;
569 if (!args.Decode(&call.
tuple)) {
570 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
577 throw CustomError (
"Corp Name contains banned words");
582 throw CustomError (
"Corp Name contains invalid characters");
586 for (
const auto cur : badCharsSearch)
588 throw CustomError (
"Corp Ticker contains invalid characters");
592 throw UserError (
"CorpTickerNameInvalidTaken");
594 double corp_cost =
sConfig.rates.corpCost;
596 _log(SERVICE__ERROR,
"%s: Cannot afford corporation startup costs!", pClient->GetName());
610 codelog(SERVICE__ERROR,
"New corporation creation failed.");
617 _log(CORP__ERROR,
"Auto Increment improperly set in DB.");
618 pClient->SendErrorMsg(
"Server Error when creating corp. CorpID invalid.");
626 std::string reason =
"DESC: Creating new corporation: ";
627 reason += args.corpName;
629 reason += args.corpTicker;
632 pClient->GetCharacterID(),
637 pClient->GetStationID(),
647 data.
name = args.corpName;
648 data.
ticker = args.corpTicker;
650 data.
baseID = pClient->GetLocationID();
651 data.
corpHQ = pClient->GetLocationID();
664 pClient->GetChar()->JoinCorporation(data);
667 OnCorporationChanged cc;
670 codelog(SERVICE__ERROR,
"Failed to create OnCorpChanged notification stream.");
672 pClient->SendErrorMsg(
"Unable to notify about corp creation.");
677 pClient->SendNotification(
"OnCorporationChanged",
"clientID", &a1);
687 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateTitle()");
690 Call_UpdateTitleData
args;
691 if (!args.Decode(&call.
tuple)) {
692 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
699 OnTitleChanged change;
701 change.titleID = args.titleID;
702 change.changes = updates;
703 PyTuple* notif = change.Encode();
706 sEntityList.Multicast(
"OnTitleChanged",
"corpid", ¬if, mct);
715 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateTitles()");
721 Call_UpdateTitle arg;
722 if (!arg.Decode(&call.
tuple)) {
723 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
727 if (!arg.object->arguments()->IsDict()) {
728 codelog(CORP__ERROR,
"Object Argument is wrong type: %s. Expected PyDict.", arg.object->arguments()->TypeString());
740 Call_UpdateTitleData
args;
743 if (!(*itr)->IsList()) {
744 codelog(CORP__ERROR,
"itr item is not PyList: %s", (*itr)->TypeString());
761 OnTitleChanged change;
763 change.titleID = args.titleID;
764 change.changes = updates;
765 PyTuple* notif = change.Encode();
768 sEntityList.Multicast(
"OnTitleChanged",
"corpid", ¬if, mct);
776 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateCorporation() size=%u", call.
tuple->
size() );
777 call.
Dump(CORP__CALL_DUMP);
779 Call_UpdateCorporation
args;
780 if (!args.Decode(&call.
tuple)) {
781 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
787 notif.data =
new PyDict();
790 codelog(SERVICE__ERROR,
"%s: Failed to update corporation data for corp %u", call.
client->
GetName(), notif.key);
796 if (notif.data->items.size()) {
800 PyTuple * answer = notif.Encode();
801 sEntityList.Multicast(
"OnCorporationChanged",
"corpid", &answer, mct);
810 Call_UpdateLogo
args;
811 if (!args.Decode(&call.
tuple)) {
812 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
820 double logo_change = 100;
822 _log( SERVICE__ERROR,
"%s: Cannot afford corporation logo change costs", call.
client->
GetName());
823 call.
client->
SendErrorMsg(
"Your corporation doesn't have enough money (%u ISK) to change it's logo.", logo_change);
827 notif.data =
new PyDict();
829 codelog( SERVICE__ERROR,
"Corporation logo change failed..." );
834 std::string reason =
"Change Corporation Logo.";
848 PyTuple *answer = notif.Encode();
849 sEntityList.Multicast(
"OnCorporationChanged",
"corpid", &answer, mct);
857 _log(CORP__CALL,
"CorpRegistryBound::Handle_AddBulletin()");
858 call.
Dump(CORP__CALL_DUMP);
860 Call_AddBulletin
args;
861 if (!args.Decode(&call.
tuple)) {
862 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
867 int64 editDateTime = 0;
868 if (call.
byname.find(
"editDateTime") != call.
byname.end()) {
869 if (call.
byname.find(
"editDateTime")->second->IsLong()) {
873 _log(CORP__ERROR,
"Handle_AddBulletin - editDateTime is of the wrong type: '%s'. Expected PyString or PyWString.", \
874 call.
byname.find(
"editDateTime")->second->TypeString());
878 int64 bulletinID = 0;
879 if (call.
byname.find(
"bulletinID") != call.
byname.end()) {
880 if (call.
byname.find(
"bulletinID")->second->IsInt()) {
884 _log(CORP__ERROR,
"Handle_AddBulletin - bulletinID is of the wrong type: '%s'. Expected PyInt.", \
885 call.
byname.find(
"bulletinID")->second->TypeString());
890 if (bulletinID >= 100000) {
905 _log(CORP__CALL,
"CorpRegistryBound::Handle_DeleteBulletin() size=%u", call.
tuple->
size() );
906 call.
Dump(CORP__CALL_DUMP);
909 if (bulletinID >= 100000) {
919 _log(CORP__CALL,
"CorpRegistryBound::Handle_CreateRecruitmentAd()");
920 call.
Dump(CORP__CALL_DUMP);
936 Call_CreateRecruitmentAd
args;
937 if (!args.Decode(&call.
tuple)) {
938 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
944 case 7: amount = 2250000;
break;
945 case 14: amount = 4000000;
break;
946 case 28: amount = 7500000;
break;
953 std::vector<int32> recruiters;
960 if (recruiters.empty())
970 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateRecruitmentAd() size=%u", call.
tuple->
size() );
971 call.
Dump(CORP__CALL_DUMP);
989 Call_UpdateRecruitmentAd
args;
990 if (!args.Decode(&call.
tuple)) {
991 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
997 if (args.addedDays) {
1000 switch (args.addedDays) {
1001 case 7: amount = 1750000;
break;
1002 case 14: amount = 3500000;
break;
1012 days += args.addedDays;
1018 std::vector<int32> recruiters;
1024 if (recruiters.empty())
1034 _log(CORP__CALL,
"CorpRegistryBound::Handle_MoveCompanyShares()");
1035 call.
Dump(CORP__CALL_DUMP);
1037 Call_MoveShares
args;
1038 if (!args.Decode(&call.
tuple)) {
1039 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1043 if (
IsCorp(args.toShareholderID)) {
1050 if (pClient ==
nullptr) {
1063 _log(CORP__CALL,
"CorpRegistryBound::Handle_MovePrivateShares()");
1064 call.
Dump(CORP__CALL_DUMP);
1066 Call_MoveShares
args;
1067 if (!args.Decode(&call.
tuple)) {
1068 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1074 if (pClient ==
nullptr) {
1093 call.
Dump(CORP__CALL_DUMP);
1094 Call_GetMemberIDsByQuery_Main
args;
1095 if (!args.Decode(&call.
tuple)) {
1096 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1100 if (args.data->empty()) {
1138 std::ostringstream query;
1139 query <<
"SELECT characterID FROM chrCharacters WHERE corporationID = ";
1140 query << m_corpID <<
" AND ";
1147 if (list ==
nullptr)
1149 if (list->
size() == 3) {
1150 Call_GetMemberIDsByQuery_List3 args3;
1151 if (!args3.Decode(&list)) {
1152 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1156 if (args3.queryType.compare(
"roles") == 0) {
1157 query <<
"corpRole";
1159 query << args3.queryType;
1168 }
else if (list->
size() == 4) {
1173 Call_GetMemberIDsByQuery_List4 args4;
1174 if (!args4.Decode(&list)) {
1175 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1179 switch (args4.joinOp) {
1189 _log(CORP__ERROR,
"CorpRegistryBound::Handle_GetMemberIDsByQuery() sent invalid JoinOp %i", args4.joinOp);
1194 if (args4.queryType.compare(
"roles") == 0) {
1195 query <<
"corpRole";
1197 query << args4.queryType;
1207 _log(CORP__ERROR,
"CorpRegistryBound::Handle_GetMemberIDsByQuery() - Invalid data size: %u. Expected 3 or 4.", list->
size());
1214 std::vector<uint32> result;
1220 if (list ==
nullptr) {
1227 for (
auto cur : result)
1231 list->
Dump(CORP__RSP_DUMP,
"");
1243 using namespace Corp;
1300 _log(CORP__ERROR,
"CorpRegistryBound::GetSearchValues() sent invalid searchOp %i", op);
1310 if (queryType.compare(
"roles") == 0) {
1312 }
else if (queryType.compare(
"rolesAtHQ") == 0) {
1314 }
else if (queryType.compare(
"rolesAtBase") == 0) {
1316 }
else if (queryType.compare(
"rolesAtOther") == 0) {
1318 }
else if (queryType.compare(
"grantableRoles") == 0) {
1320 }
else if (queryType.compare(
"grantableRolesAtHQ") == 0) {
1322 }
else if (queryType.compare(
"grantableRolesAtBase") == 0) {
1324 }
else if (queryType.compare(
"grantableRolesAtOther") == 0) {
1326 }
else if (queryType.compare(
"baseID") == 0) {
1328 }
else if (queryType.compare(
"startDateTime") == 0) {
1330 }
else if (queryType.compare(
"characterID") == 0) {
1332 }
else if (queryType.compare(
"titleMask") == 0) {
1336 _log(CORP__ERROR,
"CorpRegistryBound::GetQueryType() - Invalid QueryType: %s", queryType.c_str());
1360 _log(CORP__CALL,
"CorpRegistryBound::Handle_PayoutDividend()");
1361 call.
Dump(CORP__CALL_DUMP);
1363 Call_PayoutDividend
args;
1364 if (!args.Decode(&call.
tuple)) {
1365 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1372 std::vector<uint32> toIDs;
1373 if (args.payShareholders) {
1380 float amount = args.payoutAmount / toIDs.size();
1385 std::string reason =
"Dividend Payment from ";
1387 for (
auto cur : toIDs)
1447 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateMember()");
1448 call.
Dump(CORP__CALL_DUMP);
1450 Call_UpdateMember
args;
1451 if (!args.Decode(&call.
tuple)) {
1452 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1459 bool grantable(
false);
1462 if (pClient ==
nullptr) {
1489 Call_InsertApplication
args;
1490 if (!args.Decode(&call.
tuple)) {
1491 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1516 aInfo.
corpID = args.corpID;
1534 oldInfo.
valid =
false;
1535 OnCorporationApplicationChanged OCAC;
1539 OCAC.corpID = args.corpID;
1540 OCAC.charID = charID;
1543 call.
client->
SendNotification(
"OnCorporationApplicationChanged",
"*corpid&corprole", OCAC.Encode(),
false);
1549 std::string subject =
"New application from ";
1551 std::vector<int32> recipients;
1565 onn.senderID = charID;
1576 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateApplicationOffer() size=%u", call.
tuple->
size() );
1577 call.
Dump(CORP__CALL_DUMP);
1579 Call_UpdateApplicationOffer
args;
1580 if (!args.Decode(&call.
tuple)) {
1581 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1590 oldInfo.
valid =
true;
1591 oldInfo.
appText = args.appText;
1592 oldInfo.
charID = args.charID;
1600 newInfo.
valid =
true;
1602 newInfo.
status = args.newStatus;
1613 OnCorporationApplicationChanged ocac;
1614 ocac.charID = args.charID;
1619 MemberAttributeUpdate change;
1628 OnObjectPublicAttributesUpdated opau;
1631 opau.changePKIndexValue = args.charID;
1632 opau.changes = change.Encode();
1636 OnCorpMemberChange ocmc;
1637 ocmc.charID = args.charID;
1641 ocmc.oldDate = oldInfo.
appTime;
1663 if (recruit !=
nullptr) {
1677 _log(CORP__MESSAGE,
"CorpRegistryBound::Handle_UpdateApplicationOffer() hit AppStatus::RenegotiatedByCorporation by %s ", call.
client->
GetName() );
1679 codelog(SERVICE__ERROR,
"%s: Sent unhandled status %u ", call.
client->
GetName(), args.newStatus);
1685 if (pClient !=
nullptr)
1686 pClient->
SendNotification(
"OnCorporationApplicationChanged",
"clientID", ocac.Encode(),
false);
1694 _log(CORP__CALL,
"CorpRegistryBound::Handle_DeleteApplication() size=%u", call.
tuple->
size() );
1695 call.
Dump(CORP__CALL_DUMP);
1697 Call_TwoIntegerArgs
args;
1698 if (!args.Decode(&call.
tuple)) {
1699 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1703 OnCorporationApplicationChanged ocac;
1704 ocac.corpID = args.arg1;
1705 ocac.charID = args.arg2;
1707 newInfo.
valid =
false;
1709 oldInfo.
valid =
true;
1710 oldInfo.
corpID = args.arg1;
1711 oldInfo.
charID = args.arg2;
1713 codelog(SERVICE__ERROR,
"%s: Failed to query application info for char %u corp %u", call.
client->
GetName(), ocac.charID, ocac.corpID);
1719 codelog(SERVICE__ERROR,
"%s: Failed to delete application info for char %u corp %u", call.
client->
GetName(), ocac.charID, ocac.corpID);
1732 OCAC.applicationIDOld =
new PyInt(Old.
appID);
1742 OCAC.lastCorpUpdaterIDOld =
PyStatic.NewNone();
1747 OCAC.applicationIDOld =
PyStatic.NewNone();
1749 OCAC.applicationTextOld =
PyStatic.NewNone();
1750 OCAC.characterIDOld =
PyStatic.NewNone();
1751 OCAC.corporationIDOld =
PyStatic.NewNone();
1754 OCAC.lastCorpUpdaterIDOld =
PyStatic.NewNone();
1756 OCAC.statusOld =
PyStatic.NewNone();
1760 OCAC.applicationIDNew =
new PyInt(New.
appID);
1770 OCAC.lastCorpUpdaterIDNew =
PyStatic.NewNone();
1775 OCAC.applicationIDNew =
PyStatic.NewNone();
1777 OCAC.applicationTextNew =
PyStatic.NewNone();
1778 OCAC.characterIDNew =
PyStatic.NewNone();
1779 OCAC.corporationIDNew =
PyStatic.NewNone();
1782 OCAC.lastCorpUpdaterIDNew =
PyStatic.NewNone();
1784 OCAC.statusNew =
PyStatic.NewNone();
1791 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetStations() size=%u", call.
tuple->
size() );
1792 call.
Dump(CORP__CALL_DUMP);
1845 obj->
Dump(CORP__RSP_DUMP,
"");
1851 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetOffices() size=%u", call.
tuple->
size() );
1852 call.
Dump(CORP__CALL_DUMP);
1856 _log(SERVICE__ERROR,
"%s: Unable to create bound object for:", call.
client->
GetName());
1862 CorpOfficeSparseRowset rsp;
1873 obj->
Dump(CORP__RSP_DUMP,
"");
1933 _log(CORP__CALL,
"CorpRegistryBound::Handle_InsertVoteCase()");
1934 call.
Dump(CORP__CALL_DUMP);
1992 Call_InsertVoteCase
args;
1993 if (!args.Decode(&call.
tuple)) {
1994 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1998 if (!args.voteCaseOptions->arguments()->IsDict()) {
1999 codelog(CORP__ERROR,
"voteCaseOptions Argument is wrong type: %s. Expected PyDict.", args.voteCaseOptions->arguments()->TypeString());
2111 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetVoteCasesByCorporation()");
2112 call.
Dump(CORP__CALL_DUMP);
2115 Call_GetVoteCases
args;
2116 if (!args.Decode(&call.
tuple)) {
2117 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2132 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetVoteCaseOptions()");
2133 call.
Dump(CORP__CALL_DUMP);
2135 Call_TwoIntegerArgs
args;
2136 if (!args.Decode(&call.
tuple)) {
2137 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2143 rsp->
Dump(CORP__RSP_DUMP,
"");
2150 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetVotes() size=%u", call.
tuple->
size() );
2151 call.
Dump(CORP__CALL_DUMP);
2153 Call_TwoIntegerArgs
args;
2154 if (!args.Decode(&call.
tuple)) {
2155 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2170 rsp->
Dump(CORP__RSP_DUMP,
"");
2234 PyResult CorpRegistryBound::Handle_GetSanctionedActionsByCorporation(
PyCallArgs &call) {
2242 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetSanctionedActionsByCorporation()");
2243 call.
Dump(CORP__CALL_DUMP);
2245 Call_TwoIntegerArgs
args;
2246 if (!args.Decode(&call.
tuple)) {
2247 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2278 _log(CORP__CALL,
"CorpRegistryBound::Handle_CanVote() size=%u", call.
tuple->
size() );
2279 call.
Dump(CORP__CALL_DUMP);
2287 _log(CORP__CALL,
"CorpRegistryBound::Handle_InsertVote() size=%u", call.
tuple->
size() );
2288 call.
Dump(CORP__CALL_DUMP);
2290 Call_InsertVote
args;
2291 if (!args.Decode(&call.
tuple)) {
2292 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2316 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetLockedItemLocations()");
2317 call.
Dump(CORP__CALL_DUMP);
2326 _log(CORP__CALL,
"CorpRegistryBound::Handle_AddCorporateContact()");
2327 call.
Dump(CORP__CALL_DUMP);
2329 Call_CorporateContactData
args;
2330 if (!args.Decode(&call.
tuple)) {
2331 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2342 _log(CORP__CALL,
"CorpRegistryBound::Handle_EditCorporateContact()");
2343 call.
Dump(CORP__CALL_DUMP);
2345 Call_CorporateContactData
args;
2346 if (!args.Decode(&call.
tuple)) {
2347 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2358 _log(CORP__CALL,
"CorpRegistryBound::Handle_EditContactsRelationshipID()");
2359 call.
Dump(CORP__CALL_DUMP);
2361 Call_EditCorporateContacts
args;
2362 if (!args.Decode(&call.
tuple)) {
2363 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2376 _log(CORP__CALL,
"CorpRegistryBound::Handle_RemoveCorporateContacts()");
2377 call.
Dump(CORP__CALL_DUMP);
2379 Call_RemoveCorporateContacts
args;
2380 if (!args.Decode(&call.
tuple)) {
2381 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2397 _log(CORP__CALL,
"CorpRegistryBound::Handle_ExecuteActions() size=%u", call.
tuple->
size() );
2398 call.
Dump(CORP__CALL_DUMP);
2400 Call_ExecuteActions
args;
2401 if (!args.Decode(&call.
tuple)) {
2402 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2405 args.Dump(CORP__TRACE);
2419 _log(CORP__CALL,
"CorpRegistryBound::Handle_CreateLabel() size=%u", call.
tuple->
size() );
2420 call.
Dump(CORP__CALL_DUMP);
2427 _log(CORP__CALL,
"CorpRegistryBound::Handle_DeleteLabel() size=%u", call.
tuple->
size() );
2428 call.
Dump(CORP__CALL_DUMP);
2435 _log(CORP__CALL,
"CorpRegistryBound::Handle_EditLabel() size=%u", call.
tuple->
size() );
2436 call.
Dump(CORP__CALL_DUMP);
2443 _log(CORP__CALL,
"CorpRegistryBound::Handle_AssignLabels() size=%u", call.
tuple->
size() );
2444 call.
Dump(CORP__CALL_DUMP);
2451 _log(CORP__CALL,
"CorpRegistryBound::Handle_RemoveLabels() size=%u", call.
tuple->
size() );
2452 call.
Dump(CORP__CALL_DUMP);
2459 _log(CORP__CALL,
"CorpRegistryBound::Handle_CreateAlliance() size=%u", call.
tuple->
size() );
2460 call.
Dump(CORP__CALL_DUMP);
2465 Call_CreateAlliance
args;
2466 if (!args.Decode(&call.
tuple)) {
2467 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2470 args.Dump(CORP__TRACE);
2473 for (
const auto cur : badWords)
2475 throw CustomError (
"Alliance Name contains banned words");
2478 for (
const auto cur : badCharsSearch)
2480 throw CustomError (
"Alliance Name contains invalid characters");
2483 for (
const auto cur : badCharsSearch)
2485 throw CustomError (
"Alliance short name contains invalid characters");
2489 throw CustomError (
"Alliance short name is taken.");
2491 double ally_cost =
sConfig.rates.allyCost;
2493 _log(SERVICE__ERROR,
"%s: Cannot afford alliance startup costs!", pClient->
GetName());
2496 throw CustomError (
"You must have %f ISK to create an alliance.", ally_cost);
2501 std::string reason =
"DESC: Creating new alliance: ";
2502 reason += args.allianceName;
2504 reason += args.shortName;
2525 codelog(SERVICE__ERROR,
"New alliance creation failed.");
2534 codelog(SERVICE__ERROR,
"Alliance join failed.");
2540 codelog(SERVICE__ERROR,
"Add corp employment failed.");
2552 _log(CORP__CALL,
"CorpRegistryBound::Handle_ApplyToJoinAlliance()");
2553 call.
Dump(CORP__CALL_DUMP);
2557 Call_ApplyToJoinAlliance
args;
2558 if (!args.Decode(&call.
tuple)) {
2559 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2562 args.Dump(CORP__TRACE);
2565 app.
appText = args.applicationText;
2566 app.
allyID = args.allianceID;
2572 codelog(SERVICE__ERROR,
"New alliance application failed.");
2577 oldInfo.
valid =
false;
2579 OnAllianceApplicationChanged oaac;
2581 oaac.allianceID = app.
allyID;
2588 std::vector<Client*> list;
2590 for (
auto cur : list)
2594 cur->SendNotification(
"OnAllianceApplicationChanged",
"clientID", oaac.Encode(),
false);
2595 _log(ALLY__TRACE,
"OnAllianceApplicationChanged sent to %s (%u)", cur->GetName(), cur->GetCharID());
2601 for (
auto cur : list)
2605 cur->SendNotification(
"OnAllianceApplicationChanged",
"clientID", oaac.Encode(),
false);
2606 _log(ALLY__TRACE,
"OnAllianceApplicationChanged sent to %s (%u)", cur->GetName(), cur->GetCharID());
2612 std::string subject =
"New application from ";
2614 std::vector<int32> recipients;
2623 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetAllianceApplications()");
2624 call.
Dump(CORP__CALL_DUMP);
2633 _log(CORP__CALL,
"CorpRegistryBound::Handle_DeleteAllianceApplication()");
2634 call.
Dump(CORP__CALL_DUMP);
2640 Call_SingleIntegerArg
args;
2641 if (!args.Decode(&call.
tuple)) {
2642 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
2645 args.Dump(CORP__TRACE);
2658 newInfo.
valid =
true;
2661 OnAllianceApplicationChanged oaac;
2662 oaac.allianceID = newInfo.
allyID;
2663 oaac.corpID = newInfo.
corpID;
2667 codelog(SERVICE__ERROR,
"Deletion failed.");
2674 std::vector<Client *> list;
2676 for (
auto cur : list)
2678 if (cur->GetChar().get() !=
nullptr)
2680 cur->SendNotification(
"OnAllianceApplicationChanged",
"clientID", oaac.Encode(),
false);
2681 _log(ALLY__TRACE,
"OnAllianceApplicationChanged sent to client %u", cur->GetClientID());
2687 for (
auto cur : list)
2689 if (cur->GetChar().get() !=
nullptr)
2691 cur->SendNotification(
"OnAllianceApplicationChanged",
"clientID", oaac.Encode(),
false);
2692 _log(ALLY__TRACE,
"OnAllianceApplicationChanged sent to client %u", cur->GetClientID());
2701 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetRentalDetailsPlayer()");
2702 call.
Dump(CORP__CALL_DUMP);
2709 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetRentalDetailsCorp()");
2710 call.
Dump(CORP__CALL_DUMP);
2716 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateCorporationAbilities()");
2717 call.
Dump(CORP__CALL_DUMP);
2724 PyResult CorpRegistryBound::Handle_UpdateStationManagementSettings(
PyCallArgs &call) {
2727 _log(CORP__CALL,
"CorpRegistryBound::Handle_UpdateStationManagementSettings()");
2728 call.
Dump(CORP__CALL_DUMP);
2737 _log(CORP__CALL,
"CorpRegistryBound::Handle_GetNumberOfPotentialCEOs()");
2738 call.
Dump(CORP__CALL_DUMP);
#define sConfig
A macro for easier access to the singleton.
void SetAccountKey(int32 accountKey)
uint32 GetStationOwner(uint32 stationID)
Dispatcher *const m_dispatch
void UpdateSessionInt(const char *sessionType, int value)
bool DeleteApplication(const Alliance::ApplicationInfo &aInfo)
PyRep * GetCorporations(uint32 corpID)
void AddContact(uint32 ownerID, Call_CorporateContactData corpData)
void SendNotification(const PyAddress &dest, EVENotificationStream ¬i, bool seq=true)
bool UpdateLogo(uint32 corpID, const Call_UpdateLogo &upd, PyDict *notif)
static std::string StringContent(PyRep *pRep)
uint32 GetLocationID() const
bool UpdateCorporation(uint32 corpID, const Call_UpdateCorporation &upd, PyDict *notif)
std::set< uint32 > corporations
PyRep * GetMemberTrackingInfo(uint32 corpID)
const char * GetText(uint32 index) const
void SendErrorMsg(const char *fmt,...)
#define _log(type, fmt,...)
void AddRecruiters(uint16 adID, int32 corpID, std::vector< int32 > &charVec)
PyRep * GetItem(size_t index) const
Returns Python object.
uint16 GetMemberCount(uint32 corpID)
PyRep * GetCorpRoleGroups()
PyRep * GetItemString(const char *key) const
Obtains database entry based on given key string.
int32 GetInt(uint32 index) const
PyRep * GetShares(uint32 corpID)
int64 GetCorpRole() const
static int32 GetOfficeCount(uint32 corpID)
std::map< std::string, PyRep * > byname
static void EditBulletin(uint32 bulletinID, uint32 eCharID, int64 eDataTime, std::string &title, std::string &body)
void DeleteAdvert(uint16 adID)
void RemoveContact(uint32 contactID, uint32 ownerID)
PyRep * GetLabels(uint32 corpID)
bool CreateMemberAttributeUpdate(uint32 newCorpID, uint32 charID, MemberAttributeUpdate &attrib)
PyRep * GetMyShares(uint32 ownerID)
bool CreateCorporationCreatePacket(OnCorporationChanged &cc, uint32 oldCorpID, uint32 newCorpID)
PyRep * GetRecruiters(int32 corpID, uint16 adID)
void SendMail(uint32 sender, uint32 recipient, const std::string &subject, const std::string &content)
void SendInfoModalMsg(const char *fmt,...)
int32 GetCharacterID() const
bool DeleteApplication(const Corp::ApplicationInfo &aInfo)
const_iterator begin() const
int32 GetCorporationID() const
storage_type::const_iterator const_iterator
bool AddEmployment(uint32 allyID, uint32 corpID)
static uint32 IntegerValueU32(PyRep *pRep)
PyRep * GetKillsAndLosses(uint32 corpID, uint32 number, uint32 offset)
void AddBulletin(uint32 corpID, uint32 ownerID, uint32 cCharID, std::string &title, std::string &body)
void SendNotifyMsg(const char *fmt,...)
void UpdateContact(int32 relationshipID, uint32 contactID, uint32 ownerID)
static uint32 GetCorporationCEO(uint32 corpID)
CharacterRef GetChar() const
Advanced version of UserError that allows to send a full custom message.
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
void CreateTitleData(uint32 corpID)
bool GetSearchValues(int8 op, PyRep *rep, std::ostringstream &query)
PyObject * GetCorporation(uint32 corpID)
PyRep * GetSharesForCorp(uint32 corpID)
void _SetCallDispatcher(CallDispatcher *d)
PyRep * GetItem(size_t index) const
Returns Python object.
static uint32 GetExecutorID(uint32 allyID)
bool GetRow(DBResultRow &into)
bool UpdateTitle(uint32 corpID, Call_UpdateTitleData &args, PyDict *updates)
void EditBulletin(uint32 bulletinID, uint32 eCharID, int64 eDataTime, std::string &title, std::string &body)
PyRep * GetApplications(uint32 corpID)
#define is_log_enabled(type)
uint16 GetCorpMemberCount(uint32 corpID)
PyRep * GetBulletins(uint32 corpID)
static PyRep * GetInfoWindowDataForChar(uint32 charID)
void CreateSystemChannel(int32 channelID)
static const std::array< std::string, 28 > badWords
bool UpdateCorpAlliance(uint32 allyID, uint32 corpID)
bool InsertApplication(Alliance::ApplicationInfo &aInfo)
#define codelog(type, fmt,...)
void SetItem(size_t index, PyRep *object)
Stores Python object.
PyRep * GetAdvert(uint16 adID)
PyRep * GetVotes(uint32 voteCaseID)
bool AddCorporation(Call_AddCorporation &corpInfo, Client *pClient, uint32 &corpID)
PyRep * GetContacts(uint32 corpID)
std::string GetBindStr() const
static void TranserFunds(uint32 fromID, uint32 toID, double amount, std::string reason="", uint8 entryTypeID=Journal::EntryType::Undefined, uint32 referenceID=0, uint16 fromKey=Account::KeyType::Cash, uint16 toKey=Account::KeyType::Cash, Client *pClient=nullptr)
void CastVote(uint32 corpID, uint32 charID, uint32 voteCaseID, uint8 optionID)
PyRep * GetAlliance(uint32 allyID)
PyRep * GetVoteOptions(uint32 voteCaseID)
static void DeleteBulletin(uint32 bulletinID)
const char * GetName() const
static uint32 GetCorpID(uint32 charID)
#define IsPlayerCorp(itemID)
void DeleteTitle(uint32 corpID, uint16 titleID)
PyRep * PyHasShares(uint32 charID, uint32 corpID)
#define IsCharacterID(itemID)
PyRep * GetTitles(uint32 corpID)
Python object "ccp_exceptions.UserError".
#define PyCallable_REG_CALL(c, m)
void GetMembersForQuery(std::ostringstream &query, std::vector< uint32 > &result)
bool GetCurrentApplicationInfo(Corp::ApplicationInfo &aInfo)
void InvalidateCache(const PyRep *objectID)
void AddRoleHistory(uint32 corpID, uint32 charID, uint32 issuerID, int64 oldRoles, int64 newRoles, bool grantable)
uint16 GetCorpMemberLimit(uint32 corpID)
float GetBalance(uint8 type=Account::CreditType::ISK)
PyRep * GetMyApplications(uint32 allyID)
PyObject * GetStations(uint32 corpID)
static int64 GetCorpRole(uint32 charID)
void GetMembersPaged(uint32 corpID, uint8 page, DBQueryResult &res)
PyRep * GetMemberTrackingInfoSimple(uint32 corpID)
PyRep * GetMyApplications(uint32 charID)
PyServiceMgr *const m_manager
PySubStruct * BindObject(Client *pClient, PyBoundObject *pObj, PyDict *dict=nullptr, PyDict *oid=nullptr)
static const std::array< std::string, 16 > badCharsSearch
const_iterator end() const
PyObject * GetEveOwners(uint32 corpID)
bool UpdateApplication(const Corp::ApplicationInfo &aInfo)
void UpdateCorpData(CorpData &data)
ObjCacheService * cache_service
void JoinCorporation(const CorpData &data)
void MoveShares(uint32 ownerID, uint32 corpID, Call_MoveShares &args)
void Dump(LogType type) const
bool IsTickerTaken(std::string ticker)
static void FillOAApplicationChange(OnAllianceApplicationChanged &OAAC, const Alliance::ApplicationInfo &Old, const Alliance::ApplicationInfo &New)
static void AddEmployment(uint32 charID, uint32 corpID, uint32 oldCorpID=0)
void AddItemEvent(uint32 corpID, uint32 charID, uint16 eTypeID)
void UpdateAdvert(uint16 adID, uint32 corpID, int64 typeMask, int8 days, uint16 members, std::string description, uint32 channelID, std::string title)
void DeleteBulletin(uint32 bulletinID)
int32 GetStationID() const
PyRep * GetAdRegistryData(int64 typeMask=0, bool inAlliance=false, int16 minMembers=0, uint16 maxMembers=12602)
static int64 IntegerValue(PyRep *pRep)
PyRep * GetMember(uint32 charID)
static void FillOCApplicationChange(OnCorporationApplicationChanged &OCAC, const Corp::ApplicationInfo &Old, const Corp::ApplicationInfo &New)
bool UpdateDivisionNames(uint32 corpID, const Call_UpdateDivisionNames &divs, PyDict *notif)
int64 GetAdvertTime(uint16 adID, uint32 corpID)
static double GetCorpBalance(uint32 corpID, uint16 accountKey)
int64 grantableRolesAtBase
int64 GetInt64(uint32 index) const
Dispatcher *const m_dispatch
std::set< uint32 > locations
int64 grantableRolesAtOther
static void SetCorpRole(uint32 charID, int64 role)
void AddVoteCase(uint32 corpID, uint32 charID, Call_InsertVoteCase &args)
PyRep * GetSanctionedItems(uint32 corpID, uint8 status=0)
bool IsShortNameTaken(std::string shortName)
CorporationDB uint32 corpID
const char * TypeString() const
bool InsertApplication(Corp::ApplicationInfo &aInfo)
static std::string GetCorpName(uint32 corpID)
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
bool CreateAlliance(Call_CreateAlliance &allyInfo, Client *pClient, uint32 &allyID, uint32 &corpID)
const char * GetName() const
bool icontains(std::string data, std::string toSearch, size_t pos=0)
uint8 GetQueryType(std::string queryType)
uint32 CreateAdvert(Client *pClient, uint32 corpID, int64 typeMask, int8 days, uint16 members, std::string description, uint32 channelID, std::string title)
PyRep * GetVoteItems(uint32 corpID, uint8 status=0, uint8 maxLen=20)
bool GetCurrentApplicationInfo(uint32 allyID, uint32 corpID, Alliance::ApplicationInfo &aInfo)