summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authorsteven_carr <steven_carr>2006-05-15 18:41:56 +0000
committersteven_carr <steven_carr>2006-05-15 18:41:56 +0000
commit7218843ac0d39b5ae83cf166cab350e6fff82222 (patch)
treebeb646d701d5eb8d502e458ee7d305b58dca3d38 /libvncserver
parent1c3af68549c544de065ceedec518449ee8cff49d (diff)
downloadlibtdevnc-7218843ac0d39b5ae83cf166cab350e6fff82222.tar.gz
libtdevnc-7218843ac0d39b5ae83cf166cab350e6fff82222.zip
Support sending TextChat messages back to the client
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/rfbserver.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index d3d4409..133007d 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -1015,6 +1015,47 @@ rfbSendServerIdentity(rfbClientPtr cl)
return TRUE;
}
+rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer)
+{
+ rfbTextChatMsg tc;
+ int bytesToSend=0;
+
+ memset((char *)&tc, 0, sizeof(tc));
+ tc.type = rfbTextChat;
+ tc.length = Swap32IfLE(length);
+
+ switch(length) {
+ case rfbTextChatOpen:
+ case rfbTextChatClose:
+ case rfbTextChatFinished:
+ bytesToSend=0;
+ break;
+ default:
+ bytesToSend=length;
+ if (bytesToSend>rfbTextMaxSize)
+ bytesToSend=rfbTextMaxSize;
+ }
+
+ if (cl->ublen + sz_rfbTextChatMsg + bytesToSend > UPDATE_BUF_SIZE) {
+ if (!rfbSendUpdateBuf(cl))
+ return FALSE;
+ }
+
+ memcpy(&cl->updateBuf[cl->ublen], (char *)&tc, sz_rfbTextChatMsg);
+ cl->ublen += sz_rfbTextChatMsg;
+ if (bytesToSend>0) {
+ memcpy(&cl->updateBuf[cl->ublen], buffer, bytesToSend);
+ cl->ublen += bytesToSend;
+ }
+ rfbStatRecordMessageSent(cl, rfbTextChat, sz_rfbTextChatMsg+bytesToSend, sz_rfbTextChatMsg+bytesToSend);
+
+ if (!rfbSendUpdateBuf(cl))
+ return FALSE;
+
+ return TRUE;
+}
+
+
rfbBool rfbSendFileTransferMessage(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length, char *buffer)
{
rfbFileTransferMsg ft;