diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.cpp | 9 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp | 15 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendImageShack.cpp | 4 |
3 files changed, 17 insertions, 11 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index a2f8e51beb..f0c800004e 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -454,9 +454,12 @@ void CSend::Exit(unsigned int Result) { const char* CSend::GetHTMLContent(char* str, const char* startTag, const char* endTag) { char* begin=strstr(str,startTag); if(!begin) return NULL; - begin+=strlen(startTag); - char* end=strstr(begin,endTag); - if(end) *end=0; + begin+=strlen(startTag)-1; + for(; *begin!='>' && *begin; ++begin); + if(*begin){ + char* end=strstr(++begin,endTag); + if(end) *end=0; + } return begin; } diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp index 0218956559..6a2c7fe48a 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp @@ -67,8 +67,8 @@ void CSendHost_UploadPie::SendThread(void* obj) NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&self->m_nlhr); self->HTTPFormDestroy(&self->m_nlhr); if(reply){ - if(reply->resultCode>=200 && reply->resultCode<300){ - reply->pData[reply->dataLength]='\0';/// make sure its null terminated + if(reply->resultCode>=200 && reply->resultCode<300 && reply->dataLength){ + reply->pData[reply->dataLength-1]='\0';/// make sure its null terminated char* url=reply->pData; do{ char* pos; @@ -76,7 +76,7 @@ void CSendHost_UploadPie::SendThread(void* obj) for(pos=url+21; (*pos>='0'&&*pos<='9') || (*pos>='a'&&*pos<='z') || (*pos>='A'&&*pos<='Z') || *pos=='_' || *pos=='-' || *pos=='"' || *pos=='\''; ++pos){ if(*pos=='"' || *pos=='\'') break; } - if(*pos=='"' || *pos=='\''){ + if(url+21!=pos && (*pos=='"' || *pos=='\'')){ *pos='\0'; break; } @@ -88,9 +88,12 @@ void CSendHost_UploadPie::SendThread(void* obj) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)reply); self->svcSendMsgExit(url); return; }else{/// check error mess from server - TCHAR* err=mir_a2t(reply->pData); - self->Error(_T("%s"),err); - mir_free(err); + const char* err=GetHTMLContent(reply->pData,"<p id=\"error\"","</p>"); + TCHAR* werr; + if(err) werr=mir_a2t(err); + else werr=mir_a2t(reply->pData); + self->Error(_T("%s"),werr); + mir_free(werr); } }else{ self->Error(LPGENT("Upload server did not respond timely.")); diff --git a/plugins/SendScreenshotPlus/src/CSendImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendImageShack.cpp index c12eed48fe..9bd0ef0e0f 100644 --- a/plugins/SendScreenshotPlus/src/CSendImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendImageShack.cpp @@ -72,8 +72,8 @@ void CSendImageShack::SendThread() { NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&m_nlhr); HTTPFormDestroy(&m_nlhr); if(reply){ - if(reply->resultCode>=200 && reply->resultCode<300){ - reply->pData[reply->dataLength]='\0';/// make sure its null terminated + if(reply->resultCode>=200 && reply->resultCode<300 && reply->dataLength){ + reply->pData[reply->dataLength-1]='\0';/// make sure its null terminated const char* url=NULL; url=GetHTMLContent(reply->pData,"<image_link>","</image_link>"); if(url && *url){ |