author | zecke <zecke> | 2003-02-10 21:36:08 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-10 21:36:08 (UTC) |
commit | eb9be7ada3de060d8c5ce52590bd91120ed5e1bd (patch) (unidiff) | |
tree | 58a5566691737f6f3ee12fa7005b8bdf2d12332b /x11/ipc/client/ocopclient.cpp | |
parent | bbb3cdf8f91d567f6c2e786bd144b64bd679ff9a (diff) | |
download | opie-eb9be7ada3de060d8c5ce52590bd91120ed5e1bd.zip opie-eb9be7ada3de060d8c5ce52590bd91120ed5e1bd.tar.gz opie-eb9be7ada3de060d8c5ce52590bd91120ed5e1bd.tar.bz2 |
better commit that...
Diffstat (limited to 'x11/ipc/client/ocopclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | x11/ipc/client/ocopclient.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/x11/ipc/client/ocopclient.cpp b/x11/ipc/client/ocopclient.cpp index 91827e7..f59fa41 100644 --- a/x11/ipc/client/ocopclient.cpp +++ b/x11/ipc/client/ocopclient.cpp | |||
@@ -78,87 +78,87 @@ void OCOPClient::newData() { | |||
78 | case OCOPPacket::Register: | 78 | case OCOPPacket::Register: |
79 | case OCOPPacket::Unregister: | 79 | case OCOPPacket::Unregister: |
80 | case OCOPPacket::Method: | 80 | case OCOPPacket::Method: |
81 | case OCOPPacket::RegisterChannel: | 81 | case OCOPPacket::RegisterChannel: |
82 | case OCOPPacket::UnregisterChannel: | 82 | case OCOPPacket::UnregisterChannel: |
83 | case OCOPPacket::Return: | 83 | case OCOPPacket::Return: |
84 | case OCOPPacket::Signal: | 84 | case OCOPPacket::Signal: |
85 | /* is Registered should be handled sync */ | 85 | /* is Registered should be handled sync */ |
86 | case OCOPPacket::IsRegistered: | 86 | case OCOPPacket::IsRegistered: |
87 | break; | 87 | break; |
88 | /* emit the signal */ | 88 | /* emit the signal */ |
89 | case OCOPPacket::Call: | 89 | case OCOPPacket::Call: |
90 | emit called( pack.channel(), pack.header(), pack.content() ); | 90 | emit called( pack.channel(), pack.header(), pack.content() ); |
91 | break; | 91 | break; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | OCOPPacket OCOPClient::packet() const{ | 94 | OCOPPacket OCOPClient::packet() const{ |
95 | QCString chan; | 95 | QCString chan; |
96 | QCString func; | 96 | QCString func; |
97 | QByteArray ar; | 97 | QByteArray ar; |
98 | OCOPHead head; | 98 | OCOPHead head; |
99 | memset(&head, 0, sizeof(head) ); | 99 | memset(&head, 0, sizeof(head) ); |
100 | read(m_socket, &head, sizeof(head) ); | 100 | read(m_socket, &head, sizeof(head) ); |
101 | if ( head.magic == 47 ) { | 101 | if ( head.magic == 47 ) { |
102 | qWarning("Client:Magic Match"); | 102 | // qWarning("Client:Magic Match"); |
103 | chan = QCString( head.chlen+1); | 103 | chan = QCString( head.chlen+1); |
104 | func = QCString( head.funclen+1 ); | 104 | func = QCString( head.funclen+1 ); |
105 | ar = QByteArray( head.datalen); | 105 | ar = QByteArray( head.datalen); |
106 | read(m_socket, chan.data(), head.chlen ); | 106 | read(m_socket, chan.data(), head.chlen ); |
107 | read(m_socket, func.data(), head.funclen ); | 107 | read(m_socket, func.data(), head.funclen ); |
108 | read(m_socket, ar.data(), head.datalen ); | 108 | read(m_socket, ar.data(), head.datalen ); |
109 | qWarning("Client:%d %s",head.chlen,chan.data() ); | 109 | //qWarning("Client:%d %s",head.chlen,chan.data() ); |
110 | } | 110 | } |
111 | OCOPPacket pack(head.type, chan, func, ar ); | 111 | OCOPPacket pack(head.type, chan, func, ar ); |
112 | return pack; | 112 | return pack; |
113 | } | 113 | } |
114 | /* | 114 | /* |
115 | * we've blocking IO here on these sockets | 115 | * we've blocking IO here on these sockets |
116 | * so we send and go on read | 116 | * so we send and go on read |
117 | * this will be blocked | 117 | * this will be blocked |
118 | */ | 118 | */ |
119 | bool OCOPClient::isRegistered( const QCString& chan ) const{ | 119 | bool OCOPClient::isRegistered( const QCString& chan ) const{ |
120 | qWarning("OCopClient::isRegistered %s", chan.data() ); | 120 | // qWarning("OCopClient::isRegistered %s", chan.data() ); |
121 | /* should I disconnect the socket notfier? */ | 121 | /* should I disconnect the socket notfier? */ |
122 | OCOPPacket packe(OCOPPacket::IsRegistered, chan ); | 122 | OCOPPacket packe(OCOPPacket::IsRegistered, chan ); |
123 | OCOPHead head = packe.head(); | 123 | OCOPHead head = packe.head(); |
124 | write(m_socket, &head, sizeof(head) ); | 124 | write(m_socket, &head, sizeof(head) ); |
125 | write(m_socket, chan.data(), chan.size() ); | 125 | write(m_socket, chan.data(), chan.size() ); |
126 | /* block */ | 126 | /* block */ |
127 | OCOPPacket pack = packet(); | 127 | OCOPPacket pack = packet(); |
128 | qWarning("unblock %s %s", pack.channel().data(), chan.data() ); | 128 | qWarning("unblock %s %s", pack.channel().data(), chan.data() ); |
129 | 129 | ||
130 | /* connect here again */ | 130 | /* connect here again */ |
131 | if ( pack.channel() == chan ) { | 131 | if ( pack.channel() == chan ) { |
132 | QCString func = pack.header(); | 132 | QCString func = pack.header(); |
133 | if (func[0] == 1 ) | 133 | if (func[0] == 1 ) |
134 | return true; | 134 | return true; |
135 | } | 135 | } |
136 | 136 | ||
137 | return false; | 137 | return false; |
138 | }; | 138 | }; |
139 | void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) { | 139 | void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) { |
140 | qWarning("ClientSending %s %s", chan.data(), fu.data() ); | 140 | // qWarning("ClientSending %s %s", chan.data(), fu.data() ); |
141 | OCOPPacket pack(OCOPPacket::Call, chan, fu, arr ); | 141 | OCOPPacket pack(OCOPPacket::Call, chan, fu, arr ); |
142 | call( pack ); | 142 | call( pack ); |
143 | } | 143 | } |
144 | void OCOPClient::addChannel(const QCString& channel) { | 144 | void OCOPClient::addChannel(const QCString& channel) { |
145 | OCOPPacket pack(OCOPPacket::RegisterChannel, channel ); | 145 | OCOPPacket pack(OCOPPacket::RegisterChannel, channel ); |
146 | call( pack ); | 146 | call( pack ); |
147 | } | 147 | } |
148 | void OCOPClient::delChannel(const QCString& chan ) { | 148 | void OCOPClient::delChannel(const QCString& chan ) { |
149 | OCOPPacket pack(OCOPPacket::UnregisterChannel, chan ); | 149 | OCOPPacket pack(OCOPPacket::UnregisterChannel, chan ); |
150 | call( pack ); | 150 | call( pack ); |
151 | } | 151 | } |
152 | void OCOPClient::call( const OCOPPacket& pack ) { | 152 | void OCOPClient::call( const OCOPPacket& pack ) { |
153 | OCOPHead head = pack.head(); | 153 | OCOPHead head = pack.head(); |
154 | write(m_socket, &head, sizeof(head) ); | 154 | write(m_socket, &head, sizeof(head) ); |
155 | write(m_socket, pack.channel().data(), pack.channel().size() ); | 155 | write(m_socket, pack.channel().data(), pack.channel().size() ); |
156 | write(m_socket, pack.header().data(), pack.header().size() ); | 156 | write(m_socket, pack.header().data(), pack.header().size() ); |
157 | write(m_socket, pack.content().data(), pack.content().size() ); | 157 | write(m_socket, pack.content().data(), pack.content().size() ); |
158 | } | 158 | } |
159 | void OCOPClient::startUP() { | 159 | void OCOPClient::startUP() { |
160 | qWarning("Start me up"); | 160 | qWarning("Start me up"); |
161 | pid_t pi = fork(); | 161 | pid_t pi = fork(); |
162 | if ( pi == 0 ) { | 162 | if ( pi == 0 ) { |
163 | setsid(); | 163 | setsid(); |
164 | execlp("ocopserver", "ocopserver", NULL ); | 164 | execlp("ocopserver", "ocopserver", NULL ); |