source: vendor/synergy/current/lib/server/CClientProxy.cpp

Last change on this file was 2749, checked in by bird, 19 years ago

synergy v1.3.1 sources (zip).

File size: 1.9 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file COPYING that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include "CClientProxy.h"
16#include "CProtocolUtil.h"
17#include "IStream.h"
18#include "CLog.h"
19
20//
21// CClientProxy
22//
23
24CEvent::Type CClientProxy::s_readyEvent = CEvent::kUnknown;
25CEvent::Type CClientProxy::s_disconnectedEvent = CEvent::kUnknown;
26CEvent::Type CClientProxy::s_clipboardChangedEvent= CEvent::kUnknown;
27
28CClientProxy::CClientProxy(const CString& name, IStream* stream) :
29 CBaseClientProxy(name),
30 m_stream(stream)
31{
32 // do nothing
33}
34
35CClientProxy::~CClientProxy()
36{
37 delete m_stream;
38}
39
40void
41CClientProxy::close(const char* msg)
42{
43 LOG((CLOG_DEBUG1 "send close \"%s\" to \"%s\"", msg, getName().c_str()));
44 CProtocolUtil::writef(getStream(), msg);
45
46 // force the close to be sent before we return
47 getStream()->flush();
48}
49
50IStream*
51CClientProxy::getStream() const
52{
53 return m_stream;
54}
55
56CEvent::Type
57CClientProxy::getReadyEvent()
58{
59 return CEvent::registerTypeOnce(s_readyEvent,
60 "CClientProxy::ready");
61}
62
63CEvent::Type
64CClientProxy::getDisconnectedEvent()
65{
66 return CEvent::registerTypeOnce(s_disconnectedEvent,
67 "CClientProxy::disconnected");
68}
69
70CEvent::Type
71CClientProxy::getClipboardChangedEvent()
72{
73 return CEvent::registerTypeOnce(s_clipboardChangedEvent,
74 "CClientProxy::clipboardChanged");
75}
76
77void*
78CClientProxy::getEventTarget() const
79{
80 return static_cast<IScreen*>(const_cast<CClientProxy*>(this));
81}
Note: See TracBrowser for help on using the repository browser.