diff options
| author | Dave Hibberd <hibby@debian.org> | 2025-09-30 20:26:28 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2025-09-30 20:26:28 +0100 |
| commit | e4cb672cbbef4d86e66522ea3834202423aa99b3 (patch) | |
| tree | 5b3d036aac4d4f15a9e926a86f919ff440255ab5 /AGWCode.cpp | |
| parent | 14657a895ce46ef2ae8c9ccf7774a6f4b5231d7f (diff) | |
New upstream version 0.0.0.79upstream/0.0.0.79
Diffstat (limited to 'AGWCode.cpp')
| -rw-r--r-- | AGWCode.cpp | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/AGWCode.cpp b/AGWCode.cpp index 00e319f..4c44124 100644 --- a/AGWCode.cpp +++ b/AGWCode.cpp @@ -262,7 +262,7 @@ void doAGWBeacon() char ports[80]; char * ptr, * context; - int DataLen = (int)strlen(AGWBeaconMsg); + int DataLen; strcpy(ports, AGWBeaconPorts); // strtok changes it @@ -282,8 +282,9 @@ void doAGWBeacon() { while (ptr) { - AGW_frame_header(Msg, atoi(ptr) - 1, 'M', 240, AGWTermCall, AGWBeaconDest, DataLen); + DataLen = (int)strlen(AGWBeaconMsg); + AGW_frame_header(Msg, atoi(ptr) - 1, 'M', 240, AGWTermCall, AGWBeaconDest, DataLen); memcpy(&Msg[AGWHDDRRLEN], AGWBeaconMsg, DataLen); DataLen += AGWHDDRRLEN; AGWSock->write((char *)Msg, DataLen); @@ -587,7 +588,7 @@ void QtTermTCP::onAGWSocketStateChanged(QAbstractSocket::SocketState socketState if (Sess) { AGWUsers->MonSess = Sess; - Sess->AGWSession = sender; // Flag as in use +// Sess->AGWSession = sender; // Flag as in use if (TermMode == MDI) Sess->setWindowTitle("AGW Monitor Window"); @@ -864,7 +865,8 @@ void Send_AGW_Ds_Frame(void * Sess) UCHAR Msg[512]; AGW_frame_header(Msg, AGW->port, 'd', 240, AGW->corrcall, AGW->mycall, 0); - AGW->socket->write((char *)Msg, AGWHDDRRLEN); + if (AGW->socket) + AGW->socket->write((char *)Msg, AGWHDDRRLEN); } @@ -1036,9 +1038,9 @@ void on_AGW_C_frame(AGWUser * AGW, struct AGWHeader * Frame, byte * Msg) Sess = newWindow((QObject *)mythis, Listen, ""); } } - else + else if (TermMode == Tabbed) { - // Single or Tabbed - look for free session + // Single Tabbed - look for free session for (i = 0; i < _sessions.size(); ++i) @@ -1051,15 +1053,33 @@ void on_AGW_C_frame(AGWUser * AGW, struct AGWHeader * Frame, byte * Msg) break; } } + } + else + { + // Single - Only one available + S = _sessions.at(0); - if (Sess == NULL) - { - // Clear connection - - return; - } + if (S->clientSocket == NULL && S->AGWSession == NULL && S->KISSSession == NULL) + Sess = S; } + if (Sess == NULL) + { + // Clear connection by sendinf d fraame + + UCHAR Msg[512]; + + int snd_ch = Frame->Port; + char * CallFrom = Frame->callfrom; + char * CallTo = Frame->callto; + + AGW_frame_header(Msg, Frame->Port, 'd', 240, Frame->callto, Frame->callfrom, 0); + if (AGW->socket) + AGW->socket->write((char *)Msg, AGWHDDRRLEN); + + return; + } + if (Sess) { sprintf(Title, "Connected to %s", CallFrom); |
