| 501 | } |
| 502 | |
| 503 | void CClient::OnPostConnect(int Conn) |
| 504 | { |
| 505 | if(!m_ServerCapabilities.m_ChatTimeoutCode) |
| 506 | return; |
| 507 | |
| 508 | char aBufMsg[256]; |
| 509 | if(!g_Config.m_ClRunOnJoin[0] && !g_Config.m_ClDummyDefaultEyes && !g_Config.m_ClPlayerDefaultEyes) |
| 510 | str_format(aBufMsg, sizeof(aBufMsg), "/timeout %s", m_aTimeoutCodes[Conn]); |
| 511 | else |
| 512 | str_format(aBufMsg, sizeof(aBufMsg), "/mc;timeout %s", m_aTimeoutCodes[Conn]); |
| 513 | |
| 514 | if(g_Config.m_ClDummyDefaultEyes || g_Config.m_ClPlayerDefaultEyes) |
| 515 | { |
| 516 | int Emote = Conn == CONN_DUMMY ? g_Config.m_ClDummyDefaultEyes : g_Config.m_ClPlayerDefaultEyes; |
| 517 | |
| 518 | if(Emote != EMOTE_NORMAL) |
| 519 | { |
| 520 | char aBuf[32]; |
| 521 | static const char *s_EMOTE_NAMES[] = { |
| 522 | "pain", |
| 523 | "happy", |
| 524 | "surprise", |
| 525 | "angry", |
| 526 | "blink", |
| 527 | }; |
| 528 | static_assert(std::size(s_EMOTE_NAMES) == NUM_EMOTES - 1, "The size of EMOTE_NAMES must match NUM_EMOTES - 1"); |
| 529 | |
| 530 | str_append(aBufMsg, ";"); |
| 531 | str_format(aBuf, sizeof(aBuf), "emote %s %d", s_EMOTE_NAMES[Emote - 1], g_Config.m_ClEyeDuration); |
| 532 | str_append(aBufMsg, aBuf); |
| 533 | } |
| 534 | } |
| 535 | if(g_Config.m_ClRunOnJoin[0]) |
| 536 | { |
| 537 | str_append(aBufMsg, ";"); |
| 538 | str_append(aBufMsg, g_Config.m_ClRunOnJoin); |
| 539 | } |
| 540 | if(IsSixup()) |
| 541 | { |
| 542 | protocol7::CNetMsg_Cl_Say Msg7; |
| 543 | Msg7.m_Mode = protocol7::CHAT_ALL; |
| 544 | Msg7.m_Target = -1; |
| 545 | Msg7.m_pMessage = aBufMsg; |
| 546 | SendPackMsg(Conn, &Msg7, MSGFLAG_VITAL, true); |
| 547 | } |
| 548 | else |
| 549 | { |
| 550 | CNetMsg_Cl_Say MsgP; |
| 551 | MsgP.m_Team = 0; |
| 552 | MsgP.m_pMessage = aBufMsg; |
| 553 | CMsgPacker PackerTimeout(&MsgP); |
| 554 | MsgP.Pack(&PackerTimeout); |
| 555 | SendMsg(Conn, &PackerTimeout, MSGFLAG_VITAL); |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | static void GenerateTimeoutCode(char *pBuffer, unsigned Size, char *pSeed, const NETADDR *pAddrs, int NumAddrs, bool Dummy) |
| 560 | { |
nothing calls this directly
no test coverage detected