Tweaked all messaging classes to comply with new message protocol policies
AppServerLink no longer inherits from BSession Modified client files which talk to the server to sync with changes in messaging classes git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4942 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7507620c3a
commit
45799af7b5
@ -44,12 +44,11 @@
|
|||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
BAppServerLink::BAppServerLink(void)
|
BAppServerLink::BAppServerLink(void)
|
||||||
: BSession(0L,0L)
|
: PortLink(0L)
|
||||||
{
|
{
|
||||||
be_app->Lock();
|
be_app->Lock();
|
||||||
receiver=create_port(100,"AppServerLink reply port");
|
receiver=create_port(100,"AppServerLink reply port");
|
||||||
SetSendPort(be_app->fServerFrom);
|
SetPort(be_app->fServerFrom);
|
||||||
SetRecvPort(receiver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -378,33 +378,31 @@ void BApplication::ShowCursor()
|
|||||||
{
|
{
|
||||||
// Because we're just sending an opcode, we can skip the BSession and fake the protocol
|
// Because we're just sending an opcode, we can skip the BSession and fake the protocol
|
||||||
int32 foo=AS_SHOW_CURSOR;
|
int32 foo=AS_SHOW_CURSOR;
|
||||||
write_port(fServerTo,AS_SERVER_SESSION,&foo,sizeof(int32));
|
write_port(fServerTo,AS_SHOW_CURSOR,&foo,sizeof(int32));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BApplication::HideCursor()
|
void BApplication::HideCursor()
|
||||||
{
|
{
|
||||||
// Because we're just sending an opcode, we can skip the BSession and fake the protocol
|
// Because we're just sending an opcode, we can skip the BSession and fake the protocol
|
||||||
int32 foo=AS_HIDE_CURSOR;
|
int32 foo=AS_HIDE_CURSOR;
|
||||||
write_port(fServerTo,AS_SERVER_SESSION,&foo,sizeof(int32));
|
write_port(fServerTo,AS_HIDE_CURSOR,&foo,sizeof(int32));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BApplication::ObscureCursor()
|
void BApplication::ObscureCursor()
|
||||||
{
|
{
|
||||||
// Because we're just sending an opcode, we can skip the BSession and fake the protocol
|
// Because we're just sending an opcode, we can skip the BSession and fake the protocol
|
||||||
int32 foo=AS_OBSCURE_CURSOR;
|
int32 foo=AS_OBSCURE_CURSOR;
|
||||||
write_port(fServerTo,AS_SERVER_SESSION,&foo,sizeof(int32));
|
write_port(fServerTo,AS_OBSCURE_CURSOR,&foo,sizeof(int32));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool BApplication::IsCursorHidden() const
|
bool BApplication::IsCursorHidden() const
|
||||||
{
|
{
|
||||||
int32 replycode;
|
PortMessage msg;
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.WriteInt32(AS_QUERY_CURSOR_HIDDEN);
|
link.SetOpCode(AS_QUERY_CURSOR_HIDDEN);
|
||||||
link.WriteInt32(link.GetRecvPort());
|
link.FlushWithReply(&msg);
|
||||||
link.Sync();
|
return (msg.Code()==SERVER_TRUE)?true:false;
|
||||||
link.ReadInt32(&replycode);
|
|
||||||
return (replycode==SERVER_TRUE)?true:false;
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BApplication::SetCursor(const void* cursor)
|
void BApplication::SetCursor(const void* cursor)
|
||||||
@ -419,18 +417,15 @@ void BApplication::SetCursor(const void* cursor)
|
|||||||
void BApplication::SetCursor(const BCursor* cursor, bool sync)
|
void BApplication::SetCursor(const BCursor* cursor, bool sync)
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.WriteInt32(AS_SET_CURSOR_BCURSOR);
|
PortMessage msg;
|
||||||
link.WriteBool(sync);
|
|
||||||
link.WriteInt32(cursor->m_serverToken);
|
link.SetOpCode(AS_SET_CURSOR_BCURSOR);
|
||||||
|
link.Attach<bool>(sync);
|
||||||
|
link.Attach<int32>(cursor->m_serverToken);
|
||||||
if(sync)
|
if(sync)
|
||||||
link.WriteInt32(link.GetRecvPort());
|
link.FlushWithReply(&msg);
|
||||||
link.Sync();
|
else
|
||||||
|
link.Flush();
|
||||||
if(sync)
|
|
||||||
{
|
|
||||||
int32 foo;
|
|
||||||
link.ReadInt32(&foo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
int32 BApplication::CountWindows() const
|
int32 BApplication::CountWindows() const
|
||||||
@ -804,16 +799,16 @@ void BApplication::InitData(const char* signature, status_t* error)
|
|||||||
void BApplication::BeginRectTracking(BRect r, bool trackWhole)
|
void BApplication::BeginRectTracking(BRect r, bool trackWhole)
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.WriteInt32(AS_BEGIN_RECT_TRACKING);
|
link.Attach<int32>(AS_BEGIN_RECT_TRACKING);
|
||||||
link.WriteRect(r);
|
link.Attach<BRect>(r);
|
||||||
link.WriteInt32(trackWhole);
|
link.Attach<int32>(trackWhole);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BApplication::EndRectTracking()
|
void BApplication::EndRectTracking()
|
||||||
{
|
{
|
||||||
int32 foo=AS_END_RECT_TRACKING;
|
int32 foo=AS_END_RECT_TRACKING;
|
||||||
write_port(fServerTo,AS_SERVER_SESSION,&foo,sizeof(int32));
|
write_port(fServerTo,AS_END_RECT_TRACKING,&foo,sizeof(int32));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BApplication::get_scs()
|
void BApplication::get_scs()
|
||||||
|
@ -62,12 +62,13 @@ BCursor::BCursor(const void *cursorData)
|
|||||||
|
|
||||||
// Send data directly to server
|
// Send data directly to server
|
||||||
BPrivate::BAppServerLink serverlink;
|
BPrivate::BAppServerLink serverlink;
|
||||||
|
PortMessage msg;
|
||||||
|
|
||||||
serverlink.WriteInt32(AS_CREATE_BCURSOR);
|
serverlink.SetOpCode(AS_CREATE_BCURSOR);
|
||||||
serverlink.WriteData(cursorData,68);
|
serverlink.Attach(cursorData,68);
|
||||||
serverlink.WriteInt32(serverlink.GetRecvPort());
|
serverlink.FlushWithReply(&msg);
|
||||||
serverlink.Sync();
|
|
||||||
serverlink.ReadInt32(&m_serverToken);
|
msg.Read<int32>(&m_serverToken);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// undefined on BeOS
|
// undefined on BeOS
|
||||||
@ -80,9 +81,9 @@ BCursor::~BCursor()
|
|||||||
{
|
{
|
||||||
// Notify server to deallocate server-side objects for this cursor
|
// Notify server to deallocate server-side objects for this cursor
|
||||||
BPrivate::BAppServerLink serverlink;
|
BPrivate::BAppServerLink serverlink;
|
||||||
serverlink.WriteInt32(AS_DELETE_BCURSOR);
|
serverlink.SetOpCode(AS_DELETE_BCURSOR);
|
||||||
serverlink.WriteInt32(m_serverToken);
|
serverlink.Attach<int32>(m_serverToken);
|
||||||
serverlink.Sync();
|
serverlink.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// not implemented on BeOS
|
// not implemented on BeOS
|
||||||
|
@ -1,3 +1,29 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2001-2002, OpenBeOS
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
// File Name: PortLink.cpp
|
||||||
|
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
|
// Description: Class for low-overhead port-based messaging
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
#include "PortLink.h"
|
#include "PortLink.h"
|
||||||
#include "PortMessage.h"
|
#include "PortMessage.h"
|
||||||
@ -60,10 +86,10 @@ status_t PortLink::Flush(bigtime_t timeout=B_INFINITE_TIMEOUT)
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if(timeout!=B_INFINITE_TIMEOUT)
|
if(timeout!=B_INFINITE_TIMEOUT)
|
||||||
write_stat=write_port_etc(fSendPort, AS_SERVER_SESSION, fSendBuffer,
|
write_stat=write_port_etc(fSendPort, fSendCode, fSendBuffer,
|
||||||
fSendPosition, B_TIMEOUT, timeout);
|
fSendPosition, B_TIMEOUT, timeout);
|
||||||
else
|
else
|
||||||
write_stat=write_port(fSendPort, AS_SERVER_SESSION, fSendBuffer, fSendPosition);
|
write_stat=write_port(fSendPort, fSendCode, fSendBuffer, fSendPosition);
|
||||||
|
|
||||||
fSendPosition=4;
|
fSendPosition=4;
|
||||||
|
|
||||||
@ -79,7 +105,7 @@ status_t PortLink::FlushWithReply( PortMessage *msg,bigtime_t timeout=B_INFINITE
|
|||||||
Attach<int32>(fReceivePort);
|
Attach<int32>(fReceivePort);
|
||||||
|
|
||||||
// Flush the thing....FOOSH! :P
|
// Flush the thing....FOOSH! :P
|
||||||
write_port(fSendPort, AS_SERVER_SESSION, fSendBuffer, fSendPosition);
|
write_port(fSendPort, fSendCode, fSendBuffer, fSendPosition);
|
||||||
fSendPosition = 4;
|
fSendPosition = 4;
|
||||||
|
|
||||||
// Now we wait for the reply
|
// Now we wait for the reply
|
||||||
@ -88,27 +114,21 @@ status_t PortLink::FlushWithReply( PortMessage *msg,bigtime_t timeout=B_INFINITE
|
|||||||
int32 rcode;
|
int32 rcode;
|
||||||
|
|
||||||
if( timeout == B_INFINITE_TIMEOUT )
|
if( timeout == B_INFINITE_TIMEOUT )
|
||||||
{
|
|
||||||
rbuffersize = port_buffer_size(fReceivePort);
|
rbuffersize = port_buffer_size(fReceivePort);
|
||||||
if( rbuffersize > 0 )
|
|
||||||
rbuffer = new int8[rbuffersize];
|
|
||||||
read_port( fReceivePort, &rcode, rbuffer, rbuffersize);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rbuffersize = port_buffer_size_etc( fReceivePort, 0, timeout);
|
rbuffersize = port_buffer_size_etc( fReceivePort, 0, timeout);
|
||||||
if( rbuffersize == B_TIMED_OUT )
|
if( rbuffersize == B_TIMED_OUT )
|
||||||
return B_TIMED_OUT;
|
return B_TIMED_OUT;
|
||||||
|
|
||||||
if( rbuffersize > 0 )
|
|
||||||
rbuffer = new int8[rbuffersize];
|
|
||||||
read_port( fReceivePort, &rcode, rbuffer, rbuffersize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( rbuffersize > 0 )
|
||||||
|
rbuffer = new int8[rbuffersize];
|
||||||
|
read_port( fReceivePort, &rcode, rbuffer, rbuffersize);
|
||||||
|
|
||||||
// We got this far, so we apparently have some data
|
// We got this far, so we apparently have some data
|
||||||
msg->SetCode(rcode);
|
msg->SetCode(rcode);
|
||||||
msg->SetBuffer(rbuffer,rbuffersize,false);
|
msg->SetBuffer(rbuffer,rbuffersize,false);
|
||||||
msg->BSessionWorkaround();
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
#include "PortMessage.h"
|
#include "PortMessage.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
// TODO: Eliminate the reallocation of the message buffer - allocate it on construction
|
||||||
|
// and free it on destruction.
|
||||||
|
|
||||||
PortMessage::PortMessage(const int32 &code, const void *buffer, const ssize_t &buffersize,
|
PortMessage::PortMessage(const int32 &code, const void *buffer, const ssize_t &buffersize,
|
||||||
const bool ©)
|
const bool ©)
|
||||||
{
|
{
|
||||||
_code=code;
|
_code=code;
|
||||||
SetBuffer(buffer,buffersize,copy);
|
SetBuffer(buffer,buffersize,copy);
|
||||||
is_session_msg=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PortMessage::PortMessage(void)
|
PortMessage::PortMessage(void)
|
||||||
@ -43,7 +45,6 @@ PortMessage::PortMessage(void)
|
|||||||
_buffer=NULL;
|
_buffer=NULL;
|
||||||
_buffersize=0;
|
_buffersize=0;
|
||||||
_index=NULL;
|
_index=NULL;
|
||||||
is_session_msg=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PortMessage::~PortMessage(void)
|
PortMessage::~PortMessage(void)
|
||||||
@ -52,7 +53,6 @@ PortMessage::~PortMessage(void)
|
|||||||
delete _buffer;
|
delete _buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t PortMessage::ReadFromPort(const port_id &port, const bigtime_t &timeout)
|
status_t PortMessage::ReadFromPort(const port_id &port, const bigtime_t &timeout)
|
||||||
{
|
{
|
||||||
if(_buffersize>0 && _buffer!=NULL)
|
if(_buffersize>0 && _buffer!=NULL)
|
||||||
@ -61,16 +61,11 @@ status_t PortMessage::ReadFromPort(const port_id &port, const bigtime_t &timeout
|
|||||||
_index=NULL;
|
_index=NULL;
|
||||||
_buffersize=0;
|
_buffersize=0;
|
||||||
|
|
||||||
is_session_msg=false;
|
|
||||||
if(timeout==B_INFINITE_TIMEOUT)
|
if(timeout==B_INFINITE_TIMEOUT)
|
||||||
{
|
{
|
||||||
_buffersize=port_buffer_size(port);
|
_buffersize=port_buffer_size(port);
|
||||||
if(_buffersize==B_BAD_PORT_ID)
|
if(_buffersize==B_BAD_PORT_ID)
|
||||||
return (status_t)_buffersize;
|
return (status_t)_buffersize;
|
||||||
|
|
||||||
if(_buffersize>0)
|
|
||||||
_buffer=new uint8[_buffersize];
|
|
||||||
read_port(port, &_code, _buffer, _buffersize);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -78,13 +73,13 @@ status_t PortMessage::ReadFromPort(const port_id &port, const bigtime_t &timeout
|
|||||||
if(_buffersize==B_TIMED_OUT || _buffersize==B_BAD_PORT_ID ||
|
if(_buffersize==B_TIMED_OUT || _buffersize==B_BAD_PORT_ID ||
|
||||||
_buffersize==B_WOULD_BLOCK)
|
_buffersize==B_WOULD_BLOCK)
|
||||||
return (status_t)_buffersize;
|
return (status_t)_buffersize;
|
||||||
|
|
||||||
if(_buffersize>0)
|
|
||||||
_buffer=new uint8[_buffersize];
|
|
||||||
read_port(port, &_code, _buffer, _buffersize);
|
|
||||||
}
|
}
|
||||||
_index=_buffer;
|
|
||||||
BSessionWorkaround();
|
if(_buffersize>0)
|
||||||
|
_buffer=new uint8[_buffersize];
|
||||||
|
read_port(port, &_code, _buffer, _buffersize);
|
||||||
|
|
||||||
|
_index=_buffer+4;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@ -93,10 +88,12 @@ status_t PortMessage::WriteToPort(const port_id &port)
|
|||||||
{
|
{
|
||||||
// Check port validity
|
// Check port validity
|
||||||
port_info pi;
|
port_info pi;
|
||||||
is_session_msg=false;
|
|
||||||
if(get_port_info(port,&pi)!=B_OK)
|
if(get_port_info(port,&pi)!=B_OK)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
int32 *cast=(int32*)_buffer;
|
||||||
|
*cast=_code;
|
||||||
|
|
||||||
write_port(port,_code, _buffer, _buffersize);
|
write_port(port,_code, _buffer, _buffersize);
|
||||||
|
|
||||||
if(_buffer && _buffersize>0)
|
if(_buffer && _buffersize>0)
|
||||||
@ -119,9 +116,9 @@ void PortMessage::SetBuffer(const void *buffer, const ssize_t &size, const bool
|
|||||||
if(_buffersize>0 && _buffer!=NULL)
|
if(_buffersize>0 && _buffer!=NULL)
|
||||||
delete _buffer;
|
delete _buffer;
|
||||||
_buffer=NULL;
|
_buffer=NULL;
|
||||||
_buffersize=0;
|
_buffersize=4;
|
||||||
|
|
||||||
if(!buffer || size<1)
|
if(!buffer || size<5)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(copy)
|
if(copy)
|
||||||
@ -135,7 +132,7 @@ void PortMessage::SetBuffer(const void *buffer, const ssize_t &size, const bool
|
|||||||
_buffersize=size;
|
_buffersize=size;
|
||||||
_buffer=(uint8 *)buffer;
|
_buffer=(uint8 *)buffer;
|
||||||
}
|
}
|
||||||
_index=_buffer;
|
_index=_buffer+4;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t PortMessage::Read(void *data, ssize_t size)
|
status_t PortMessage::Read(void *data, ssize_t size)
|
||||||
@ -155,22 +152,7 @@ status_t PortMessage::Read(void *data, ssize_t size)
|
|||||||
|
|
||||||
void PortMessage::Rewind(void)
|
void PortMessage::Rewind(void)
|
||||||
{
|
{
|
||||||
_index=(is_session_msg)?_buffer+4:_buffer;
|
_index=_buffer+4;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PortMessage::BSessionWorkaround(void)
|
|
||||||
{
|
|
||||||
// Do some stuff to work around BSession stupidity with packaging the message code as
|
|
||||||
// the first attachment in the message's data buffer.
|
|
||||||
if(_code==AS_SERVER_SESSION)
|
|
||||||
{
|
|
||||||
is_session_msg=true;
|
|
||||||
_index+=4;
|
|
||||||
_code=*((int32*)_buffer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
is_session_msg=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t PortMessage::ReadString(char **string)
|
status_t PortMessage::ReadString(char **string)
|
||||||
|
@ -76,7 +76,6 @@ void PortQueue::GetMessagesFromPort(bool wait_for_messages)
|
|||||||
delete msg;
|
delete msg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
msg->BSessionWorkaround();
|
|
||||||
_q.push(msg);
|
_q.push(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +89,6 @@ PortMessage *PortQueue::GetMessageFromQueue(void)
|
|||||||
|
|
||||||
PortMessage *msg=_q.front();
|
PortMessage *msg=_q.front();
|
||||||
_q.pop();
|
_q.pop();
|
||||||
msg->BSessionWorkaround();
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ BSession::BSession(port_id receivePort, port_id sendPort, bool isPortLink = fals
|
|||||||
fSendPort = sendPort;
|
fSendPort = sendPort;
|
||||||
fReceivePort = receivePort;
|
fReceivePort = receivePort;
|
||||||
|
|
||||||
fSendCode = AS_SERVER_SESSION;
|
fSendCode = 0;
|
||||||
fSendBuffer = NULL;
|
fSendBuffer = NULL;
|
||||||
fSendPosition = 4;
|
fSendPosition = 4;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ BSession::BSession( const BSession &ses){
|
|||||||
fSendPort = ses.fSendPort;
|
fSendPort = ses.fSendPort;
|
||||||
fReceivePort = ses.fReceivePort;
|
fReceivePort = ses.fReceivePort;
|
||||||
|
|
||||||
fSendCode = AS_SERVER_SESSION;
|
fSendCode = 0;
|
||||||
fSendBuffer = NULL;
|
fSendBuffer = NULL;
|
||||||
fSendPosition = 4;
|
fSendPosition = 4;
|
||||||
|
|
||||||
@ -40,8 +40,7 @@ BSession::BSession( const BSession &ses){
|
|||||||
fReceiveBuffer = (char*)malloc(1024);
|
fReceiveBuffer = (char*)malloc(1024);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
BSession::~BSession()
|
BSession::~BSession(){
|
||||||
{
|
|
||||||
free(fSendBuffer);
|
free(fSendBuffer);
|
||||||
free(fReceiveBuffer);
|
free(fReceiveBuffer);
|
||||||
}
|
}
|
||||||
@ -54,13 +53,15 @@ void BSession::SetRecvPort( port_id port ){
|
|||||||
fReceivePort = port;
|
fReceivePort = port;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool BSession::DropInputBuffer(void)
|
bool BSession::DropInputBuffer(void){
|
||||||
{
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
char *BSession::ReadString()
|
void BSession::SetMsgCode(int32 code){
|
||||||
{
|
fSendCode=code;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
char *BSession::ReadString(){
|
||||||
int16 len = 0;
|
int16 len = 0;
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
|
|
||||||
@ -190,16 +191,15 @@ status_t BSession::ReadData( void *data, int32 size)
|
|||||||
{
|
{
|
||||||
int32 fRecvCode;
|
int32 fRecvCode;
|
||||||
status_t rv;
|
status_t rv;
|
||||||
do{
|
while( (rv = port_buffer_size(fReceivePort) ) == B_WOULD_BLOCK);
|
||||||
while( (rv = read_port(fReceivePort, &fRecvCode, fReceiveBuffer, 1024)) ==
|
|
||||||
B_WOULD_BLOCK);
|
rv=read_port(fReceivePort, &fRecvCode, fReceiveBuffer, 1024);
|
||||||
} while( fRecvCode != AS_SERVER_SESSION && rv != B_BAD_PORT_ID );
|
|
||||||
|
|
||||||
if ( rv == B_BAD_PORT_ID )
|
if ( rv == B_BAD_PORT_ID )
|
||||||
return B_BAD_PORT_ID;
|
return B_BAD_PORT_ID;
|
||||||
|
|
||||||
fReceivePosition = 4;
|
fReceivePosition = 0;
|
||||||
fReceiveSize = *(int32*)fReceiveBuffer;
|
fReceiveSize = rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 copySize = fReceiveSize - fReceivePosition;
|
int32 copySize = fReceiveSize - fReceivePosition;
|
||||||
@ -389,7 +389,7 @@ status_t BSession::Sync()
|
|||||||
|
|
||||||
status_t rv;
|
status_t rv;
|
||||||
|
|
||||||
*(int32*)fSendBuffer = fSendPosition;
|
*(int32*)fSendBuffer = fSendCode;
|
||||||
while( (rv = write_port(fSendPort, fSendCode, fSendBuffer,
|
while( (rv = write_port(fSendPort, fSendCode, fSendBuffer,
|
||||||
fSendPosition)) == B_WOULD_BLOCK);
|
fSendPosition)) == B_WOULD_BLOCK);
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
|
#include <PortMessage.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
|
|
||||||
@ -52,11 +53,11 @@ _IMPEXP_BE status_t
|
|||||||
set_screen_space(int32 index, uint32 res, bool stick)
|
set_screen_space(int32 index, uint32 res, bool stick)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_SET_SCREEN_MODE);
|
link.SetOpCode(AS_SET_SCREEN_MODE);
|
||||||
link.WriteInt32(index);
|
link.Attach<int32>(index);
|
||||||
link.WriteInt32((int32)res);
|
link.Attach<int32>((int32)res);
|
||||||
link.WriteBool(stick);
|
link.Attach<bool>(stick);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
|
|
||||||
//TODO: Read back the status from the app_server's reply
|
//TODO: Read back the status from the app_server's reply
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -70,10 +71,11 @@ set_scroll_bar_info(scroll_bar_info *info)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_SET_SCROLLBAR_INFO);
|
PortMessage msg;
|
||||||
link.WriteData(info, sizeof(scroll_bar_info));
|
|
||||||
link.Sync();
|
link.SetOpCode(AS_SET_SCROLLBAR_INFO);
|
||||||
link.ReadData(info,sizeof(scroll_bar_info));
|
link.Attach<scroll_bar_info>(*info);
|
||||||
|
link.FlushWithReply(&msg);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,9 +254,10 @@ count_workspaces()
|
|||||||
int32 count;
|
int32 count;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_COUNT_WORKSPACES);
|
PortMessage msg;
|
||||||
link.Sync();
|
link.SetOpCode(AS_COUNT_WORKSPACES);
|
||||||
link.ReadInt32(&count);
|
link.FlushWithReply(&msg);
|
||||||
|
msg.Read<int32>(&count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,9 +266,9 @@ _IMPEXP_BE void
|
|||||||
set_workspace_count(int32 count)
|
set_workspace_count(int32 count)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_SET_WORKSPACE_COUNT);
|
link.SetOpCode(AS_SET_WORKSPACE_COUNT);
|
||||||
link.WriteInt32(count);
|
link.Attach<int32>(count);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,9 +278,10 @@ current_workspace()
|
|||||||
int32 index;
|
int32 index;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_CURRENT_WORKSPACE);
|
PortMessage msg;
|
||||||
link.Sync();
|
link.SetOpCode(AS_CURRENT_WORKSPACE);
|
||||||
link.ReadInt32(&index);
|
link.FlushWithReply(&msg);
|
||||||
|
msg.Read<int32>(&index);
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
@ -287,9 +291,9 @@ _IMPEXP_BE void
|
|||||||
activate_workspace(int32 workspace)
|
activate_workspace(int32 workspace)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_ACTIVATE_WORKSPACE);
|
link.SetOpCode(AS_ACTIVATE_WORKSPACE);
|
||||||
link.WriteInt32(workspace);
|
link.Attach<int32>(workspace);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -299,9 +303,10 @@ idle_time()
|
|||||||
bigtime_t idletime;
|
bigtime_t idletime;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_IDLE_TIME);
|
PortMessage msg;
|
||||||
link.Sync();
|
link.SetOpCode(AS_IDLE_TIME);
|
||||||
link.ReadInt64(&idletime);
|
link.FlushWithReply(&msg);
|
||||||
|
msg.Read<int64>(&idletime);
|
||||||
|
|
||||||
return idletime;
|
return idletime;
|
||||||
}
|
}
|
||||||
@ -336,9 +341,9 @@ _IMPEXP_BE void
|
|||||||
set_focus_follows_mouse(bool follow)
|
set_focus_follows_mouse(bool follow)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_SET_FOCUS_FOLLOWS_MOUSE);
|
link.SetOpCode(AS_SET_FOCUS_FOLLOWS_MOUSE);
|
||||||
link.WriteBool(follow);
|
link.Attach<bool>(follow);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -348,9 +353,10 @@ focus_follows_mouse()
|
|||||||
bool ffm;
|
bool ffm;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_FOCUS_FOLLOWS_MOUSE);
|
PortMessage msg;
|
||||||
link.Sync();
|
link.SetOpCode(AS_FOCUS_FOLLOWS_MOUSE);
|
||||||
link.ReadBool(&ffm);
|
link.FlushWithReply(&msg);
|
||||||
|
msg.Read<bool>(&ffm);
|
||||||
return ffm;
|
return ffm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,9 +365,9 @@ _IMPEXP_BE void
|
|||||||
set_mouse_mode(mode_mouse mode)
|
set_mouse_mode(mode_mouse mode)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_SET_MOUSE_MODE);
|
link.SetOpCode(AS_SET_MOUSE_MODE);
|
||||||
link.WriteData(&mode,sizeof(mode_mouse));
|
link.Attach<mode_mouse>(mode);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -371,9 +377,10 @@ mouse_mode()
|
|||||||
mode_mouse mode;
|
mode_mouse mode;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_GET_MOUSE_MODE);
|
PortMessage msg;
|
||||||
link.Sync();
|
link.SetOpCode(AS_GET_MOUSE_MODE);
|
||||||
link.ReadData(&mode,sizeof(mode_mouse));
|
link.FlushWithReply(&msg);
|
||||||
|
msg.Read<mode_mouse>(&mode);
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,10 +391,11 @@ ui_color(color_which which)
|
|||||||
rgb_color color;
|
rgb_color color;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_GET_UI_COLOR);
|
PortMessage msg;
|
||||||
link.WriteData(&which, sizeof(which));
|
link.SetOpCode(AS_GET_UI_COLOR);
|
||||||
link.Sync();
|
link.Attach<color_which>(which);
|
||||||
link.ReadData(&color,sizeof(rgb_color));
|
link.FlushWithReply(&msg);
|
||||||
|
msg.Read<rgb_color>(&color);
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +456,7 @@ bitmaps_support_space(color_space space, uint32 * support_flags)
|
|||||||
void __set_window_decor(int32 theme)
|
void __set_window_decor(int32 theme)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.WriteInt32(AS_R5_SET_DECORATOR);
|
link.SetOpCode(AS_R5_SET_DECORATOR);
|
||||||
link.WriteInt32(theme);
|
link.Attach<int32>(theme);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <Errors.h>
|
#include <Errors.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <AppServerLink.h>
|
#include <AppServerLink.h>
|
||||||
|
#include <PortMessage.h>
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
// Project Includes ------------------------------------------------------------
|
||||||
@ -84,11 +85,12 @@ BPicture::BPicture(const BPicture &picture)
|
|||||||
{
|
{
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
PortMessage msg;
|
||||||
|
|
||||||
link.WriteInt32(AS_CLONE_PICTURE);
|
link.Attach<int32>(AS_CLONE_PICTURE);
|
||||||
link.WriteInt32(picture.token);
|
link.Attach<int32>(picture.token);
|
||||||
link.Sync();
|
link.FlushWithReply(&msg);
|
||||||
link.ReadInt32(&token);
|
msg.Read<int32>(&token);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (picture.extent->fNewData != NULL)
|
if (picture.extent->fNewData != NULL)
|
||||||
@ -158,20 +160,21 @@ BPicture::BPicture(BMessage *archive)
|
|||||||
if (extent->fNewSize != 0 && extent->fNewData != 0)
|
if (extent->fNewSize != 0 && extent->fNewData != 0)
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
PortMessage msg;
|
||||||
BPicture *pic;
|
BPicture *pic;
|
||||||
|
|
||||||
link.WriteInt32(AS_CREATE_PICTURE);
|
link.Attach<int32>(AS_CREATE_PICTURE);
|
||||||
link.WriteInt32(extent->fPictures.CountItems());
|
link.Attach<int32>(extent->fPictures.CountItems());
|
||||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||||
{
|
{
|
||||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||||
if(pic)
|
if(pic)
|
||||||
link.WriteInt32(pic->token);
|
link.Attach<int32>(pic->token);
|
||||||
}
|
}
|
||||||
link.WriteInt32(extent->fNewSize);
|
link.Attach<int32>(extent->fNewSize);
|
||||||
link.WriteData(extent->fNewData,extent->fNewSize);
|
link.Attach(extent->fNewData,extent->fNewSize);
|
||||||
link.Sync();
|
link.FlushWithReply(&msg);
|
||||||
link.ReadInt32(&token);
|
msg.Read<int32>(&token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,9 +205,9 @@ BPicture::~BPicture()
|
|||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
|
||||||
link.WriteInt32(AS_DELETE_PICTURE);
|
link.Attach<int32>(AS_DELETE_PICTURE);
|
||||||
link.WriteInt32(token);
|
link.Attach<int32>(token);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extent->fNewData != NULL)
|
if (extent->fNewData != NULL)
|
||||||
@ -338,20 +341,21 @@ status_t BPicture::Unflatten(BDataIO *stream)
|
|||||||
// swap_data(extent->fNewData, extent->fNewSize);
|
// swap_data(extent->fNewData, extent->fNewSize);
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
PortMessage msg;
|
||||||
BPicture *pic;
|
BPicture *pic;
|
||||||
|
|
||||||
link.WriteInt32(AS_CREATE_PICTURE);
|
link.Attach<int32>(AS_CREATE_PICTURE);
|
||||||
link.WriteInt32(extent->fPictures.CountItems());
|
link.Attach<int32>(extent->fPictures.CountItems());
|
||||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||||
{
|
{
|
||||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||||
if(pic)
|
if(pic)
|
||||||
link.WriteInt32(pic->token);
|
link.Attach<int32>(pic->token);
|
||||||
}
|
}
|
||||||
link.WriteInt32(extent->fNewSize);
|
link.Attach<int32>(extent->fNewSize);
|
||||||
link.WriteData(extent->fNewData, extent->fNewSize);
|
link.Attach(extent->fNewData, extent->fNewSize);
|
||||||
link.Sync();
|
link.FlushWithReply(&msg);
|
||||||
link.ReadInt32(&token);
|
msg.Read<int32>(&token);
|
||||||
|
|
||||||
if (extent->fNewData)
|
if (extent->fNewData)
|
||||||
{
|
{
|
||||||
@ -391,17 +395,18 @@ void BPicture::import_data(const void *data, int32 size, BPicture **subs,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
PortMessage msg;
|
||||||
link.WriteInt32(AS_CREATE_PICTURE);
|
|
||||||
link.WriteInt32(subCount);
|
link.Attach<int32>(AS_CREATE_PICTURE);
|
||||||
|
link.Attach<int32>(subCount);
|
||||||
|
|
||||||
for (int32 i = 0; i < subCount; i++)
|
for (int32 i = 0; i < subCount; i++)
|
||||||
link.WriteInt32(subs[i]->token);
|
link.Attach<int32>(subs[i]->token);
|
||||||
|
|
||||||
link.WriteInt32(size);
|
link.Attach<int32>(size);
|
||||||
link.WriteData(data, size);
|
link.Attach(data, size);
|
||||||
link.Sync();
|
link.FlushWithReply(&msg);
|
||||||
link.ReadInt32(&token);
|
msg.Read<int32>(&token);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BPicture::import_old_data(const void *data, int32 size)
|
void BPicture::import_old_data(const void *data, int32 size)
|
||||||
@ -416,12 +421,12 @@ void BPicture::import_old_data(const void *data, int32 size)
|
|||||||
convert_old_to_new(data, size, &extent->fNewData, &extent->fNewSize);
|
convert_old_to_new(data, size, &extent->fNewData, &extent->fNewSize);
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.WriteInt32(AS_CREATE_PICTURE);
|
link.Attach<int32>(AS_CREATE_PICTURE);
|
||||||
link.WriteInt32(0L);
|
link.Attach<int32>(0L);
|
||||||
link.WriteInt32(extent->fNewSize);
|
link.Attach<int32>(extent->fNewSize);
|
||||||
link.WriteData(extent->fNewData,extent->fNewSize);
|
link.Attach(extent->fNewData,extent->fNewSize);
|
||||||
link.Sync();
|
link.FlushWithReply(&msg);
|
||||||
link.ReadInt32(&token)
|
msg.Read<int32>(&token)
|
||||||
|
|
||||||
// Do we free all data now?
|
// Do we free all data now?
|
||||||
free(extent->fNewData);
|
free(extent->fNewData);
|
||||||
@ -448,9 +453,9 @@ bool BPicture::assert_local_copy()
|
|||||||
/* BPrivate::BAppServerLink link;
|
/* BPrivate::BAppServerLink link;
|
||||||
int32 count;
|
int32 count;
|
||||||
|
|
||||||
link.WriteInt32(AS_DOWNLOAD_PICTURE);
|
link.Attach<int32>(AS_DOWNLOAD_PICTURE);
|
||||||
link.WriteInt32(token);
|
link.Attach<int32>(token);
|
||||||
link.Sync();
|
link.FlushWithReply(&msg);
|
||||||
count=*((int32*)replydata.buffer);
|
count=*((int32*)replydata.buffer);
|
||||||
|
|
||||||
// Read sub picture tokens
|
// Read sub picture tokens
|
||||||
@ -496,14 +501,14 @@ bool BPicture::assert_server_copy()
|
|||||||
extent->fPictures.ItemAt(i)->assert_server_copy();
|
extent->fPictures.ItemAt(i)->assert_server_copy();
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.WriteInt32(AS_CREATE_PICTURE);
|
link.Attach<int32>(AS_CREATE_PICTURE);
|
||||||
link.WriteInt32(extent->fPictures.CountItems());
|
link.Attach<int32>(extent->fPictures.CountItems());
|
||||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||||
link.WriteInt32(extent->fPictures.ItemAt(i)->token);
|
link.Attach<int32>(extent->fPictures.ItemAt(i)->token);
|
||||||
link.WriteInt32(extent->fNewSize);
|
link.Attach<int32>(extent->fNewSize);
|
||||||
link.WriteData(extent->fNewData,extent->fNewSize);
|
link.Attach(extent->fNewData,extent->fNewSize);
|
||||||
link.Sync();
|
link.FlushWithReply(&msg);
|
||||||
link.ReadInt32(&token);
|
msg.Read<int32>(&token);
|
||||||
|
|
||||||
return token != -1;*/
|
return token != -1;*/
|
||||||
return true;
|
return true;
|
||||||
@ -543,9 +548,9 @@ void BPicture::usurp(BPicture *lameDuck)
|
|||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
|
||||||
link.WriteInt32(AS_DELETE_PICTURE);
|
link.Attach<int32>(AS_DELETE_PICTURE);
|
||||||
link.WriteInt32(token);
|
link.Attach<int32>(token);
|
||||||
link.Sync();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extent->fNewData != NULL)
|
if (extent->fNewData != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user