prepareStreamResponse method

String prepareStreamResponse(
  1. String response
)

Implementation

String prepareStreamResponse(String response) {
  Log.xmppp_receiving(response);
  var response1 = extractWholeChild(restOfResponse + response);
  if (response1.contains('</stream:stream>')) {
    close();
    return '';
  }
  if (response1.contains('stream:stream') &&
      !(response1.contains('</stream:stream>'))) {
    response1 = response1 +
        '</stream:stream>'; // fix for crashing xml library without ending
  }

  //fix for multiple roots issue
  response1 = '<xmpp_stone>$response1</xmpp_stone>';
  return response1;
}