MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ParseIRCMessage

Function ParseIRCMessage

netcon/mtclient/chat_api.cpp:589–1015  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589char *ParseIRCMessage(char *Line, int iMode) {
590 char szRemLine[MAXLOCALSTRING];
591 const char *pszTempStr;
592 char szPrefix[MAXLOCALSTRING];
593 char szHackPrefix[MAXLOCALSTRING];
594 char szTarget[MAXLOCALSTRING];
595 char szNick[MAXLOCALSTRING];
596 char szCmd[MAXLOCALSTRING];
597 char szCTCPCmd[MAXLOCALSTRING];
598
599 static char szResponse[MAXLOCALSTRING];
600
601 int iNickLen;
602 int iPrefixLen = 0;
603
604 szPrefix[0] = '\0';
605 szNick[0] = '\0';
606
607 if (strlen(Line) >= MAXLOCALSTRING) {
608 return nullptr;
609 }
610 // Nick included....
611 if (iMode == MSG_REMOTE) {
612 strcpy(szRemLine, Line);
613 // Start by getting the prefix
614 szHackPrefix[0] = '\0';
615 if (Line[0] == ':') {
616 //
617 pszTempStr = GetWordNum(0, Line + 1);
618 strcpy(szPrefix, pszTempStr);
619 strcpy(szHackPrefix, pszTempStr);
620 strcpy(szRemLine, Line + 1 + strlen(szPrefix));
621 }
622 // Next, get the Nick
623 pszTempStr = strtok(szHackPrefix, "!");
624 if (pszTempStr) {
625 strcpy(szNick, pszTempStr);
626 } else {
627 strncpy(szNick, szPrefix, 31);
628 szNick[31] = 0;
629 }
630 // strcpy(NewMsg.Nickname,szNick);
631 iNickLen = strlen(szNick);
632 iPrefixLen = strlen(szPrefix);
633 } else if (iMode == MSG_LOCAL) {
634 strcpy(szRemLine, Line);
635 strcpy(szNick, Nick_name);
636 strcpy(szPrefix, Nick_name);
637 // strcpy(NewMsg.Nickname,szNick);
638 iNickLen = -2;
639 iPrefixLen = -2;
640 }
641 // Next is the command
642 pszTempStr = GetWordNum(0, szRemLine);
643 if (pszTempStr[0]) {
644 strcpy(szCmd, pszTempStr);
645 } else {
646 // Shouldn't ever happen, but we can't be sure of what the host will send us.

Callers 2

SendChatStringFunction · 0.85
ChatGetStringFunction · 0.85

Calls 8

GetWordNumFunction · 0.85
SendChatStringFunction · 0.85
AddChatCommandToQueueFunction · 0.85
AddChatUserFunction · 0.85
RemoveAllChatUsersFunction · 0.85
RemoveChatUserFunction · 0.85
FlushChannelListFunction · 0.85
AddChannelFunction · 0.85

Tested by

no test coverage detected