Beispiel #1
0
/** Return true on success, false on error. */
bool FacebookProto::NegotiateConnection()
{
	debugLogA("*** Negotiating connection with Facebook");

	ptrA username(getStringA(FACEBOOK_KEY_LOGIN));
	if (!username || !mir_strlen(username)) {
		NotifyEvent(m_tszUserName, TranslateT("Please enter a username."), NULL, FACEBOOK_EVENT_CLIENT);
		return false;
	}

	ptrA password(getStringA(FACEBOOK_KEY_PASS));
	if (!password || !*password) {
		NotifyEvent(m_tszUserName, TranslateT("Please enter a password."), NULL, FACEBOOK_EVENT_CLIENT);
		return false;
	}

	password = mir_utf8encode(password);

	// Refresh last time of feeds update
	facy.last_feeds_update_ = ::time(NULL);

	// Generate random clientid for this connection
	facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &facy.random_);

	// Create default group for new contacts
	if (m_tszDefaultGroup)
		Clist_CreateGroup(0, m_tszDefaultGroup);

	return facy.login(username, password);
}
Beispiel #2
0
//
// Inform accessibility a new line has been selected and/or a previously
// selected line is being unselected
//
void
KeyViewAx::SetCurrentLine(int line)
{
   // Only send selection remove notification if a line was
   // previously selected
   if (mLastId != -1)
   {
      NotifyEvent(wxACC_EVENT_OBJECT_SELECTIONREMOVE,
               mView,
               wxOBJID_CLIENT,
               mLastId);
   }

   // Nothing is now selected
   mLastId = -1;

   // Just clearing selection
   if (line != wxNOT_FOUND)
   {
      // Convert line number to childId
      LineToId(line, mLastId);

      // Send notifications that the line has focus
      NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
                  mView,
                  wxOBJID_CLIENT,
                  mLastId);

      // And is selected
      NotifyEvent(wxACC_EVENT_OBJECT_SELECTION,
                  mView,
                  wxOBJID_CLIENT,
                  mLastId);
   }
}
// Completes a frame-step operation.
HRESULT EVRCustomPresenter::CompleteFrameStep(IMFSample *pSample)
{
  HRESULT hr = S_OK;
  MFTIME hnsSampleTime = 0;
  MFTIME hnsSystemTime = 0;

  // Update our state.
  m_FrameStep.state = FRAMESTEP_COMPLETE;
  m_FrameStep.pSampleNoRef = NULL;

  // Notify the EVR that the frame-step is complete.
  NotifyEvent(EC_STEP_COMPLETE, FALSE, 0); // FALSE = completed (not cancelled)

  // If we are scrubbing (rate == 0), also send the "scrub time" event.
  if (IsScrubbing())
  {
    // Get the time stamp from the sample.
    hr = pSample->GetSampleTime(&hnsSampleTime);
    if (FAILED(hr))
    {
      // No time stamp. Use the current presentation time.
      if (m_pClock)
      {
        hr = m_pClock->GetCorrelatedTime(0, &hnsSampleTime, &hnsSystemTime);
      }
      hr = S_OK; // Not an error condition.
    }

    NotifyEvent(EC_SCRUB_TIME, LODWORD(hnsSampleTime), HIDWORD(hnsSampleTime));
  }

  return hr;
}
Beispiel #4
0
void GridAx::TableUpdated()
{
    NotifyEvent(wxACC_EVENT_OBJECT_REORDER,
                mGrid->GetGridWindow(),
                wxOBJID_CLIENT,
                0);
}
Beispiel #5
0
void vfeSession::AppendStreamMessage (MessageType type, const char *message, bool chompLF)
{
  // messages may have embedded LF's, in which case we split them at
  // the LF into seperate entries. however if chompLF is true, and the
  // message ends with an LF, we remove it (but only one). if chompLF
  // is false and the message ends with an LF, *or* there are LF's left
  // after we chomp one, we must append a blank line for each one.

  const char *begin = message ;
  const char *end = begin + strlen (message) - 1;
  boost::mutex::scoped_lock lock(m_MessageMutex);

  for (const char *s = begin ; s <= end ; s++)
  {
    if (*s == '\n')
    {
      if (chompLF && s == end)
        break ;
      m_ConsoleQueue.push (MessageBase (*this, type, string (begin, s - begin)));
      begin = s + 1 ;
    }
  }

  m_ConsoleQueue.push (MessageBase (*this, type, string (begin)));
  if (m_MaxConsoleMessages != -1)
    while (m_ConsoleQueue.size() > m_MaxConsoleMessages)
      m_ConsoleQueue.pop();
  NotifyEvent(stStreamMessage);
}
Beispiel #6
0
void vfeSession::SetSucceeded (bool ok)
{
  if (m_Succeeded == ok)
    return;
  m_Succeeded = ok;
  NotifyEvent(stSucceeded);
}
Beispiel #7
0
void vfeSession::SetFailed()
{
  if (m_Failed)
    return;
  m_Failed = true ;
  NotifyEvent(stFailed);
}
//------------------------------------------------------------------------
void SUIElementLuaCallback::OnUIEventEx( IUIElement* pSender, const char* fscommand, const SUIArguments& args, void* pUserData )
{
	SUIArguments luaArgs;
	luaArgs.AddArgument(fscommand);
	luaArgs.AddArguments(args);
	NotifyEvent(SUILuaCallbackInfo<IUIElement>::CreateInfo(pSender, "OnUIEventEx"), luaArgs);
}
// Performs end-of-stream actions if the end of stream flag was set.
HRESULT EVRCustomPresenter::CheckEndOfStream()
{
  if (!m_bEndStreaming)
  {
    // The EVR did not send the MFVP_MESSAGE_ENDOFSTREAM message.
    return S_OK;
  }

  if (m_bSampleNotify)
  {
    // The mixer still has input. 
    return S_OK;
  }

  if (m_SamplePool.AreSamplesPending())
  {
    // Samples are still scheduled for rendering.
    return S_OK;
  }

  // Everything is complete. Now we can tell the EVR that we are done.
  NotifyEvent(EC_COMPLETE, (LONG_PTR)S_OK, 0);
  m_bEndStreaming = FALSE;

  return S_OK;
}
Beispiel #10
0
void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, TCHAR* url)
{
	TCHAR *rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8);
	TCHAR *rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8);
	NotifyEvent(rawTitle, rawInfo, contact, flags, url);
	mir_free(rawTitle);
	mir_free(rawInfo);
}
Beispiel #11
0
// Clears all messages from the status message queue.
void vfeSession::ClearStatusMessages()
{
  boost::mutex::scoped_lock lock(m_MessageMutex);

  while (m_StatusQueue.empty() == false)
    m_StatusQueue.pop();
  NotifyEvent(stStatusMessagesCleared);
}
Beispiel #12
0
//
// Send an event notification to accessibility that the view
// has changed.
//
void
KeyViewAx::ListUpdated()
{
   NotifyEvent(wxACC_EVENT_OBJECT_REORDER,
               mView,
               wxOBJID_CLIENT,
               0);
}
Beispiel #13
0
void vfeSession::StateChanged (pov_frontend::State NewState)
{
  if (NewState == kReady || NewState == kStopping)
    if (m_BackendState > kReady)
      RenderStopped () ;
  if (NewState == kRendering)
    m_StartTime = GetTimestamp();
  m_BackendState = NewState ;
  NotifyEvent(stBackendStateChanged);
}
Beispiel #14
0
void vfeSession::AppendWarningMessage (const string& Msg, const UCS2String& File, int Line, int Col)
{
  boost::mutex::scoped_lock lock(m_MessageMutex);

  m_MessageQueue.push (GenericMessage (*this, mWarning, Msg, File, Line, Col));
  if (m_MaxGenericMessages != -1)
    while (m_MessageQueue.size() > m_MaxGenericMessages)
      m_MessageQueue.pop();
  NotifyEvent(stWarningMessage);
}
Beispiel #15
0
// Changes focus to a specified track
void TrackPanelAx::SetFocus( Track *track )
{
#if wxUSE_ACCESSIBILITY
   if( mFocusedTrack != NULL )
   {
      NotifyEvent( wxACC_EVENT_OBJECT_SELECTIONREMOVE,
                   mTrackPanel,
                   wxOBJID_CLIENT,
                   TrackNum( mFocusedTrack ) );
   }
#endif

   if( track == NULL )
   {
      TrackListIterator iter( mTrackPanel->mTracks );
      track = iter.First();
   }

   mFocusedTrack = track;

#if wxUSE_ACCESSIBILITY
   if( mFocusedTrack != NULL )
   {
      int num = TrackNum( mFocusedTrack );

      NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
                   mTrackPanel,
                   wxOBJID_CLIENT,
                   num );

      if( mFocusedTrack->GetSelected() )
      {
         NotifyEvent( wxACC_EVENT_OBJECT_SELECTION,
                      mTrackPanel,
                      wxOBJID_CLIENT,
                      num );
      }
   }
#endif

   return;
}
Beispiel #16
0
void TrackPanelAx::Updated()
{
#if wxUSE_ACCESSIBILITY
   Track *t = GetFocus();
   NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
               mTrackPanel,
               wxOBJID_CLIENT,
               TrackNum(t));
   SetFocus(t);
#endif
}
int CAudioRenderer::SetEOS()
{
    if (m_bEOS) {
        return S_OK;
    }
    m_bEOS = TRUE;
    
    NotifyEvent(EVENT_AUDIO_EOS, 0, 0, NULL);
    
    return S_OK;
}
/**
 * @brief
 *  Notify function to invoke watermark event on portID if
 *  watermark type in http component is the same as the
 *  watermark type registered for.
 *
 * @param pHTTPSourceMMIHelper
 * @param portID
 * @param pClientData
 *
 * @return bool
 */
bool HTTPSourceMMIExtensionEventHandler::HTTPBufferingEventManager::NotifyBufferingEvent(
  HTTPSourceMMIHelper *pHTTPSourceMMIHelper,
  const uint32 portID,
  void *pClientData)
{
  return NotifyEvent(
    pHTTPSourceMMIHelper,
    portID,
    QOMX_HTTP_IndexStreamingConfigWaterMarkStatus,
    pClientData);
}
Beispiel #19
0
void vfeSession::AppendStatusMessage (const boost::format& fmt, int RecommendedPause)
{
  boost::mutex::scoped_lock lock(m_MessageMutex);

  m_StatusQueue.push (StatusMessage (*this, fmt.str(), RecommendedPause));
  m_StatusLineMessage = fmt.str();
  if (m_MaxStatusMessages != -1)
    while (m_StatusQueue.size() > m_MaxStatusMessages)
      m_StatusQueue.pop();
  NotifyEvent(stStatusMessage);
}
Beispiel #20
0
// This method causes a shutdown of the vfeSession instance. Specifically
// it will set a flag asking the worker thread to exit, issue a
// stShutdown notification, and then wait for the worker thread to exit.
// The optional boolean parameter (default false) is used by the caller
// to indicate a forced shutdown of the worker thread is permissible
// (e.g. a kill if it doesn't shutdown gracefully within a reasonable
// period of time). It is not mandatory to implement the forced feature.
void vfeSession::Shutdown(bool forced)
{
  if (m_Initialized == false || m_WorkerThread == NULL)
    return ;

  // TODO: implement forced if possible (may need to be platform-specific)
  m_WorkerThreadShutdownRequest = true;
  NotifyEvent(stShutdown);
  m_WorkerThread->join();
  delete m_WorkerThread;
  m_WorkerThread = NULL;
}
Beispiel #21
0
void TrackPanelAx::Updated()
{
#if wxUSE_ACCESSIBILITY
   Track *t = GetFocus();

   // logically, this should be an OBJECT_NAMECHANGE event, but Window eyes 9.1
   // does not read out the name with this event type, hence use OBJECT_FOCUS.
   NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
               mTrackPanel,
               wxOBJID_CLIENT,
               TrackNum(t));
#endif
}
Beispiel #22
0
void vfeSession::AppendAnimationStatus (int Frame, int Total, const UCS2String& Filename)
{
  boost::mutex::scoped_lock lock(m_MessageMutex);

  m_CurrentFrame = Frame;
  m_TotalFrames = Total;
  m_StatusQueue.push (StatusMessage (*this, Filename, Frame, Total));
  m_StatusLineMessage = (boost::format("Rendering frame %d of %d") % Frame % Total).str();
  if (m_MaxStatusMessages != -1)
    while (m_StatusQueue.size() > m_MaxStatusMessages)
      m_StatusQueue.pop();
  NotifyEvent(stAnimationStatus);
}
Beispiel #23
0
// Used to set up a session with a POV backend. Accepts two
// parameters - a destination (vfeDestInfo) and authorization
// (vfeAuthInfo), both pointers. Currently these must be NULL.
//
// Intialize() will call the Reset() method, and then create
// the session's worker thread, at which time it will wait on
// an event for the worker thread to signal that it has completed
// its own initialization. By default the worker thread setup is
// considered to have failed if it has not signalled within three
// seconds (elapsed time). However to aid debugging this is extended
// to 123 seconds if _DEBUG is defined.
//
// If the startup is successful, this method returns vfeNoError after
// issuing a stBackendStateChanged status notification. Otherwise it
// will either set m_LastError to vfeInitializeTimeout and return that
// same value, or it will retrieve the error code set by the worker
// thread, wait for the worker thread to exit, and return that code.
//
// The worker thread itself is responsible for creating the actual
// connection with the backend code.
int vfeSession::Initialize(vfeDestInfo *Dest, vfeAuthInfo *Auth)
{
  boost::mutex::scoped_lock lock (m_InitializeMutex);

  // params must be NULL in this version
  if (Dest != NULL || Auth != NULL)
    return (m_LastError = vfeInvalidParameter);

  // only one session at once permitted in this version
  if (m_Initialized == true)
    return (m_LastError = vfeSessionExists);

  Reset();
  m_WorkerThreadExited = false;
  m_HadCriticalError = false;
  m_WorkerThreadShutdownRequest = false;
  m_Initialized = true ;
  m_StatusFlags = stNone;
  m_EventMask = vfeStatusFlags(~stNone);
  m_MessageCount = 0;
  m_LastError = vfeNoError;

  boost::xtime t;
  boost::xtime_get (&t, POV_TIME_UTC);
  t.sec += 3 ;
#ifdef _DEBUG
  t.sec += 120;
#endif
  t.nsec = 0;
  m_WorkerThread = new boost::thread(vfeSessionWorker(*this));

  // TODO FIXME: see thread <[email protected]>
  if (m_BackendState == kUnknown && m_InitializeEvent.timed_wait(lock, t)  == false)
  {
    m_WorkerThreadShutdownRequest = true ;
    m_Initialized = false ;
    return (m_LastError = vfeInitializeTimedOut);
  }
  if (m_LastError != vfeNoError)
  {
    m_WorkerThread->join();
    delete m_WorkerThread;
    m_WorkerThread = NULL;
    return (m_LastError);
  }

  NotifyEvent (stBackendStateChanged);
  AppendStreamMessage (mDivider, "");
  return (vfeNoError) ;
}
Beispiel #24
0
void GridAx::SetCurrentCell(int row, int col)
{
    int id = (((row * mGrid->GetNumberCols()) + col) + 1);

    if (mLastId != -1) {
        NotifyEvent(wxACC_EVENT_OBJECT_SELECTIONREMOVE,
                    mGrid->GetGridWindow(),
                    wxOBJID_CLIENT,
                    mLastId);
    }

    NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
                mGrid->GetGridWindow(),
                wxOBJID_CLIENT,
                id);

    NotifyEvent(wxACC_EVENT_OBJECT_SELECTION,
                mGrid->GetGridWindow(),
                wxOBJID_CLIENT,
                id);

    mLastId = id;
}
Beispiel #25
0
void vfeSession::AppendErrorMessage (const string& Msg, const UCS2String& File, int Line, int Col)
{
  boost::mutex::scoped_lock lock(m_MessageMutex);
  bool possibleError = Msg.find("Possible ") == 0 ;

  // for the purpose of setting m_HadErrorMessage, we don't consider a
  // 'possible parse error' to be an error (i.e. we look for fatal errors).
  if (possibleError == false)
    m_HadErrorMessage = true;
  m_MessageQueue.push (GenericMessage (*this, possibleError ? mPossibleError : mError, Msg, File, Line, Col));
  if (m_MaxGenericMessages != -1)
    while (m_MessageQueue.size() > m_MaxGenericMessages)
      m_MessageQueue.pop();
  NotifyEvent(stErrorMessage);
}
Beispiel #26
0
// This method allows your platform code to perform platform-specific action
// when a render stops (whether it succeeds or fails). A good example would
// be to shrink the heap. Be aware that it is called in the context of the
// worker thread, and that therefore on windowing systems where thread context
// is relevent to making certain UI calls, it may not be possible to perform
// certain UI actions here. For most platforms the default implementation
// should be sufficient.
void vfeSession::RenderStopped (void)
{
  // TODO: we should check the state of the various stream output options
  // before writing to the streams
  if (m_Succeeded)
  {
    AppendStreamMessage (vfeSession::mUnclassified, BRANCH_NAME " finished");
    AppendStreamMessage (vfeSession::mDivider, "");
  }
  else
  {
    AppendStreamMessage (vfeSession::mUnclassified, m_RenderCancelled ? "Render cancelled by user" : "Render failed");
    AppendStreamMessage (vfeSession::mDivider, "");
  }
  ShrinkHeap();
  NotifyEvent(stRenderShutdown);
}
// Cancels the frame-step operation.
HRESULT EVRCustomPresenter::CancelFrameStep()
{
  FRAMESTEP_STATE oldState = m_FrameStep.state;

  m_FrameStep.state = FRAMESTEP_NONE;
  m_FrameStep.steps = 0;
  m_FrameStep.pSampleNoRef = NULL;
  // Don't clear the frame-step queue yet, because we might frame step again.

  if (oldState > FRAMESTEP_NONE && oldState < FRAMESTEP_COMPLETE)
  {
    // We were in the middle of frame-stepping when it was cancelled. Notify the EVR.
    NotifyEvent(EC_STEP_COMPLETE, TRUE, 0); // TRUE = cancelled
  }

  return S_OK;
}
Beispiel #28
0
// Start a render. Will set m_LastError and return vfeRenderOptionsNotSet
// if you didn't call vfeSession::SetOptions() first. Otherwise will attempt
// to start the render; if this fails vfeFailedToSendRenderStart is returned.
// If the start attempt succeeds (note this is distinct from the start itself
// actually succeeding - all that the lack of a vfeFailedToSendRenderStart
// error means is that the start request was successfully sent to the backend)
// then a stRenderStartup notification is sent and the state is changed to
// kStarting.
//
// If the start attempt fails (signified by the receipt of a std::exception),
// the exception code will, in the case of a pov_base::Exception, be extracted
// and stored in m_LastError and returned; otherwise (not pov_base::Exception),
// m_LastError is set to -1. In either case, a failed status is set (so that
// vfeSession::Failed() will return true), and, if a fatal error message has
// not already been queued, the text of the exception will be added to both
// the status and error message queues.
int vfeSession::StartRender()
{
  if (m_OptionsSet == false)
    return (m_LastError = vfeRenderOptionsNotSet);

  if (m_RenderOptions.m_Options.Exist(kPOVAttrib_CreateIni))
  {
    // we deliberately do this twice - once here and once in SetOptions
    POVMSUCS2String fn = m_RenderOptions.m_Options.TryGetUCS2String(kPOVAttrib_CreateIni, "");
    if (fn.empty() == false)
    {
      vfeProcessRenderOptions options(this);
      POVMSObject obj = *m_RenderOptions.GetOptions();
      if (options.WriteFile (UCS2toASCIIString(fn).c_str(), &obj) != kNoErr)
        return (m_LastError = vfeFailedToWriteINI);
    }
  }

  try
  {
    if (!m_Frontend->Start (m_RenderOptions.m_Options))
      return (m_LastError = vfeFailedToSendRenderStart) ;
  }
  catch (std::exception& e)
  {
    if (dynamic_cast<pov_base::Exception *> (&e) != NULL)
      m_RenderErrorCode = dynamic_cast<pov_base::Exception *> (&e)->code() ;
    if (m_RenderErrorCode == 0)
      m_RenderErrorCode = -1 ;
    m_Failed = true ;
    if (m_HadErrorMessage == false)
    {
      AppendErrorMessage (e.what()) ;
      AppendStatusMessage (e.what()) ;
    }
    return (m_LastError = m_RenderErrorCode) ;
  }

  NotifyEvent(stRenderStartup);

  // set this now in case an error causes the frontend state to return to
  // kReady before we pick up kStarting in vfeSession::Process().
  StateChanged(kStarting) ;

  return (m_LastError = vfeNoError) ;
}
Beispiel #29
0
// Clears many of the internal state information held by VFE regarding
// a render. Typically called before starting a new render. Included in
// the clear are the failure/success status, cancel request state,
// error code, percent complete, number of pixels rendered, total pixels
// in render, current animation frame, and total animation frame count.
// If the optional Notify flag is set (defaults to true), a status event
// of type stClear is generated. Note that this method does not empty the
// message queues (see Reset() for that).
void vfeSession::Clear(bool Notify)
{
  m_Failed = false;
  m_Succeeded = false;
  m_HadErrorMessage = false;
  m_RenderCancelled = false;
  m_RenderCancelRequested = false;
  m_PauseWhenDone = false;
  m_RenderErrorCode = 0;
  m_PercentComplete = 0;
  m_PixelsRendered = 0;
  m_TotalPixels = 0;
  m_CurrentFrame = 0;
  m_TotalFrames = 0;
  if (Notify)
    NotifyEvent(stClear);
}
/**
 * @brief
 *  Notify QOE Event.
 *
 * @param pHTTPSourceMMIHelper
 * @param portID
 * @param eventID
 * @param pClientData
 *
 * @return status
 */
bool HTTPSourceMMIExtensionEventHandler::HTTPQOEEventManager::
      NotifyQOEEvent(HTTPSourceMMIHelper *pHTTPSourceMMIHelper,
                              const uint32 portID,
                              const uint32 eventID,
                              void *pClientData)
{
  bool status = false;
  if(m_bQOENotify)
  {
    QTV_MSG_PRIO1(QTVDIAG_HTTP_STREAMING, QTVDIAG_PRIO_LOW,
    "HTTPSourceMMIExtensionEventHandler::HTTPQOEEventManager::NotifyQOEEvent eventID = %u",eventID);
    status = NotifyEvent(
              pHTTPSourceMMIHelper,
              portID,
              eventID,
              pClientData);
  }
  return status;
}