84 |
if (cchBuffer > 0) { |
if (cchBuffer > 0) { |
85 |
// Make sure received buffer it's null terminated. |
// Make sure received buffer it's null terminated. |
86 |
achBuffer[cchBuffer] = (char) 0; |
achBuffer[cchBuffer] = (char) 0; |
87 |
// Parse for the notification event message... |
pch = achBuffer; |
88 |
pszToken = lscp_strtok(achBuffer, pszSeps, &(pch)); // Have "NOTIFY". |
do { |
89 |
if (strcasecmp(pszToken, "NOTIFY") == 0) { |
// Parse for the notification event message... |
90 |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); // Have "NOTIFY" |
91 |
event = lscp_event_from_text(pszToken); |
if (strcasecmp(pszToken, "NOTIFY") == 0) { |
92 |
// And pick the rest of data... |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
93 |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
event = lscp_event_from_text(pszToken); |
94 |
cchToken = (pszToken == NULL ? 0 : strlen(pszToken)); |
// And pick the rest of data... |
95 |
// Double-check if we're really up to it... |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
96 |
if (pClient->events & event) { |
cchToken = (pszToken == NULL ? 0 : strlen(pszToken)); |
97 |
// Invoke the client event callback... |
// Double-check if we're really up to it... |
98 |
if ((*pClient->pfnCallback)( |
if (pClient->events & event) { |
99 |
pClient, |
// Invoke the client event callback... |
100 |
event, |
if ((*pClient->pfnCallback)( |
101 |
pszToken, |
pClient, |
102 |
cchToken, |
event, |
103 |
pClient->pvData) != LSCP_OK) { |
pszToken, |
104 |
pClient->evt.iState = 0; |
cchToken, |
105 |
|
pClient->pvData) != LSCP_OK) { |
106 |
|
pClient->evt.iState = 0; |
107 |
|
} |
108 |
} |
} |
109 |
} |
} |
110 |
} |
} while (*pch); |
111 |
} else { |
} else { |
112 |
lscp_socket_perror("_lscp_client_evt_proc: recv"); |
lscp_socket_perror("_lscp_client_evt_proc: recv"); |
113 |
pClient->evt.iState = 0; |
pClient->evt.iState = 0; |