diff --git a/src/kits/network/libnetapi/GopherRequest.cpp b/src/kits/network/libnetapi/GopherRequest.cpp
index 8b4bf68555..6c1fca7e95 100644
--- a/src/kits/network/libnetapi/GopherRequest.cpp
+++ b/src/kits/network/libnetapi/GopherRequest.cpp
@@ -360,6 +360,9 @@ BGopherRequest::_ProtocolLoop()
fPosition += fInputBuffer.Size();
+ if (fListener != NULL)
+ fListener->DownloadProgress(this, fPosition, 0);
+
// XXX: this is plain stupid, we already copied the data
// and just want to drop it...
char *inputTempBuffer = new(std::nothrow) char[bytesRead];
@@ -372,11 +375,8 @@ BGopherRequest::_ProtocolLoop()
}
}
- if (fPosition > 0) {
+ if (fPosition > 0)
fResult.SetLength(fPosition);
- if (fListener != NULL)
- fListener->DownloadProgress(this, fPosition, fPosition);
- }
fSocket->Disconnect();
@@ -650,7 +650,7 @@ BGopherRequest::_ParseInput(bool last)
// emit header
BString header;
- header <<
+ header <<
"\n"
"
\n"
"\n"
"" << pageTitle << "
\n";
- fListener->DataReceived(this, header.String(), fPosition,
- header.Length());
+ if (fListener != NULL) {
+ fListener->DataReceived(this, header.String(), fPosition,
+ header.Length());
+ }
fPosition += header.Length();
+
+ if (fListener != NULL)
+ fListener->DownloadProgress(this, fPosition, 0);
}
if (item.Length()) {
- fListener->DataReceived(this, item.String(), fPosition,
- item.Length());
+ if (fListener != NULL) {
+ fListener->DataReceived(this, item.String(), fPosition,
+ item.Length());
+ }
fPosition += item.Length();
+
+ if (fListener != NULL)
+ fListener->DownloadProgress(this, fPosition, 0);
}
}
@@ -689,10 +699,15 @@ BGopherRequest::_ParseInput(bool last)
"\n"
"\n";
- fListener->DataReceived(this, footer.String(), fPosition,
- footer.Length());
+ if (fListener != NULL) {
+ fListener->DataReceived(this, footer.String(), fPosition,
+ footer.Length());
+ }
fPosition += footer.Length();
+
+ if (fListener != NULL)
+ fListener->DownloadProgress(this, fPosition, 0);
}
}