diff --git a/include/freerdp/event.h b/include/freerdp/event.h index a41fe0a60..2e1fae804 100644 --- a/include/freerdp/event.h +++ b/include/freerdp/event.h @@ -68,6 +68,10 @@ DEFINE_EVENT_BEGIN(Terminate) int code; DEFINE_EVENT_END(Terminate) +DEFINE_EVENT_BEGIN(ConnectionResult) + int result; +DEFINE_EVENT_END(ConnectionResult) + #ifdef __cplusplus } #endif diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index a43f51768..87171d493 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -56,6 +56,7 @@ BOOL freerdp_connect(freerdp* instance) rdpRdp* rdp; rdpSettings* settings; BOOL status = FALSE; + ConnectionResultEventArgs e; /* We always set the return code to 0 before we start the connect sequence*/ connectErrorCode = 0; @@ -169,6 +170,10 @@ BOOL freerdp_connect(freerdp* instance) SetEvent(rdp->transport->connectedEvent); + EventArgsInit(&e, "freerdp"); + e.result = status ? 0 : -1; + PubSub_OnConnectionResult(instance->context->pubSub, instance->context, &e); + return status; } @@ -331,6 +336,7 @@ static wEventType FreeRDP_Events[] = DEFINE_EVENT_ENTRY(ErrorInfo) DEFINE_EVENT_ENTRY(ParamChange) DEFINE_EVENT_ENTRY(Terminate) + DEFINE_EVENT_ENTRY(ConnectionResult) }; /** Allocator function for a rdp context.