Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
XRemoteClient Class Reference

#include <PhRemoteClient.h>

Inheritance diagram for XRemoteClient:
Inheritance graph
[legend]
Collaboration diagram for XRemoteClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 XRemoteClient ()
 ~XRemoteClient ()
virtual nsresult Init ()
 Initializes the client.
virtual nsresult SendCommand (const char *aProgram, const char *aUsername, const char *aProfile, const char *aCommand, char **aResponse, PRBool *aSucceeded)
 Sends a command to a running instance.
virtual nsresult SendCommandLine (const char *aProgram, const char *aUsername, const char *aProfile, PRInt32 argc, char **argv, char **aResponse, PRBool *aSucceeded)
 Send a complete command line to a running instance.
void Shutdown ()
 XRemoteClient ()
 ~XRemoteClient ()
virtual nsresult Init ()
 Initializes the client.
virtual nsresult SendCommand (const char *aProgram, const char *aUsername, const char *aProfile, const char *aCommand, char **aResponse, PRBool *aSucceeded)
 Sends a command to a running instance.
virtual nsresult SendCommandLine (const char *aProgram, const char *aUsername, const char *aProfile, PRInt32 argc, char **argv, char **aResponse, PRBool *aSucceeded)
 Send a complete command line to a running instance.
void Shutdown ()

Private Member Functions

Window CheckWindow (Window aWindow)
Window CheckChildren (Window aWindow)
nsresult GetLock (Window aWindow, PRBool *aDestroyed)
nsresult FreeLock (Window aWindow)
Window FindBestWindow (const char *aProgram, const char *aUsername, const char *aProfile, PRBool aSupportsCommandLine)
nsresult DoSendCommand (Window aWindow, const char *aCommand, char **aResponse, PRBool *aDestroyed)
nsresult DoSendCommandLine (Window aWindow, PRInt32 argc, char **argv, char **aResponse, PRBool *aDestroyed)
PRBool WaitForResponse (Window aWindow, char **aResponse, PRBool *aDestroyed, Atom aCommandAtom)

Private Attributes

PRBool mInitialized
DisplaymDisplay
Atom mMozVersionAtom
Atom mMozLockAtom
Atom mMozCommandAtom
Atom mMozCommandLineAtom
Atom mMozResponseAtom
Atom mMozWMStateAtom
Atom mMozUserAtom
Atom mMozProfileAtom
Atom mMozProgramAtom
Atom mMozSupportsCLAtom
char * mLockData

Detailed Description

Definition at line 41 of file PhRemoteClient.h.


Constructor & Destructor Documentation

Definition at line 55 of file PhRemoteClient.cpp.

Definition at line 60 of file PhRemoteClient.cpp.

{
  if (mInitialized)
    Shutdown();
}

Here is the call graph for this function:


Member Function Documentation

Window XRemoteClient::CheckChildren ( Window  aWindow) [private]

Definition at line 288 of file XRemoteClient.cpp.

{
  Window root, parent;
  Window *children;
  unsigned int nchildren;
  unsigned int i;
  Atom type = None;
  int format;
  unsigned long nitems, after;
  unsigned char *data;
  Window retval = None;
  
  if (!XQueryTree(mDisplay, aWindow, &root, &parent, &children,
                &nchildren))
    return None;
  
  // scan the list first before recursing into the list of windows
  // which can get quite deep.
  for (i=0; !retval && (i < nchildren); i++) {
    XGetWindowProperty(mDisplay, children[i], mMozWMStateAtom,
                     0, 0, False, AnyPropertyType, &type, &format,
                     &nitems, &after, &data);
    if (type) {
      XFree(data);
      retval = children[i];
    }
  }

  // otherwise recurse into the list
  for (i=0; !retval && (i < nchildren); i++) {
    retval = CheckChildren(children[i]);
  }

  if (children)
    XFree((char *)children);

  return retval;
}

Here is the caller graph for this function:

Window XRemoteClient::CheckWindow ( Window  aWindow) [private]

Definition at line 261 of file XRemoteClient.cpp.

{
  Atom type = None;
  int  format;
  unsigned long nitems, bytesafter;
  unsigned char *data;
  Window innerWindow;

  XGetWindowProperty(mDisplay, aWindow, mMozWMStateAtom,
                   0, 0, False, AnyPropertyType,
                   &type, &format, &nitems, &bytesafter, &data);

  if (type) {
    XFree(data);
    return aWindow;
  }

  // didn't find it here so check the children of this window
  innerWindow = CheckChildren(aWindow);

  if (innerWindow)
    return innerWindow;

  return aWindow;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult XRemoteClient::DoSendCommand ( Window  aWindow,
const char *  aCommand,
char **  aResponse,
PRBool aDestroyed 
) [private]

Definition at line 645 of file XRemoteClient.cpp.

{
  *aDestroyed = PR_FALSE;

  PR_LOG(sRemoteLm, PR_LOG_DEBUG,
     ("(writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n",
      aCommand, (unsigned int) aWindow));

  XChangeProperty (mDisplay, aWindow, mMozCommandAtom, XA_STRING, 8,
           PropModeReplace, (unsigned char *)aCommand,
           strlen(aCommand));

  if (!WaitForResponse(aWindow, aResponse, aDestroyed, mMozCommandAtom))
    return NS_ERROR_FAILURE;
  
  return NS_OK;
}

Here is the call graph for this function:

nsresult XRemoteClient::DoSendCommandLine ( Window  aWindow,
PRInt32  argc,
char **  argv,
char **  aResponse,
PRBool aDestroyed 
) [private]

Definition at line 676 of file XRemoteClient.cpp.

{
  int i;

  *aDestroyed = PR_FALSE;

  char cwdbuf[MAX_PATH];
  if (!getcwd(cwdbuf, MAX_PATH))
    return NS_ERROR_UNEXPECTED;

  // the commandline property is constructed as an array of PRInt32
  // followed by a series of null-terminated strings:
  //
  // [argc][offsetargv0][offsetargv1...]<workingdir>\0<argv[0]>\0argv[1]...\0
  // (offset is from the beginning of the buffer)

  PRInt32 argvlen = strlen(cwdbuf);
  for (i = 0; i < argc; ++i)
    argvlen += strlen(argv[i]);

  PRInt32* buffer = (PRInt32*) malloc(argvlen + argc + 1 +
                                      sizeof(PRInt32) * (argc + 1));
  if (!buffer)
    return NS_ERROR_OUT_OF_MEMORY;

  buffer[0] = TO_LITTLE_ENDIAN32(argc);

  char *bufend = (char*) (buffer + argc + 1);

  bufend = estrcpy(cwdbuf, bufend);

  for (int i = 0; i < argc; ++i) {
    buffer[i + 1] = TO_LITTLE_ENDIAN32(bufend - ((char*) buffer));
    bufend = estrcpy(argv[i], bufend);
  }

#ifdef DEBUG_bsmedberg
  PRInt32   debug_argc   = TO_LITTLE_ENDIAN32(*buffer);
  char *debug_workingdir = (char*) (buffer + argc + 1);

  printf("Sending command line:\n"
         "  working dir: %s\n"
         "  argc:\t%i",
         debug_workingdir,
         debug_argc);

  PRInt32  *debug_offset = buffer + 1;
  for (int debug_i = 0; debug_i < debug_argc; ++debug_i)
    printf("  argv[%i]:\t%s\n", debug_i,
           ((char*) buffer) + TO_LITTLE_ENDIAN32(debug_offset[debug_i]));
#endif

  XChangeProperty (mDisplay, aWindow, mMozCommandLineAtom, XA_STRING, 8,
                   PropModeReplace, (unsigned char *) buffer,
                   bufend - ((char*) buffer));

  if (!WaitForResponse(aWindow, aResponse, aDestroyed, mMozCommandLineAtom))
    return NS_ERROR_FAILURE;
  
  return NS_OK;
}

Here is the call graph for this function:

Window XRemoteClient::FindBestWindow ( const char *  aProgram,
const char *  aUsername,
const char *  aProfile,
PRBool  aSupportsCommandLine 
) [private]

Definition at line 453 of file XRemoteClient.cpp.

{
  Window root = RootWindowOfScreen(DefaultScreenOfDisplay(mDisplay));
  Window bestWindow = 0;
  Window root2, parent, *kids;
  unsigned int nkids;
  int i;

  // Get a list of the children of the root window, walk the list
  // looking for the best window that fits the criteria.
  if (!XQueryTree(mDisplay, root, &root2, &parent, &kids, &nkids)) {
    PR_LOG(sRemoteLm, PR_LOG_DEBUG,
           ("XQueryTree failed in XRemoteClient::FindBestWindow"));
    return 0;
  }

  if (!(kids && nkids)) {
    PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("root window has no children"));
    return 0;
  }

  // We'll walk the list of windows looking for a window that best
  // fits the criteria here.

  for (i=nkids-1; i >= 0; i--) {
    Atom type;
    int format;
    unsigned long nitems, bytesafter;
    unsigned char *data_return = 0;
    Window w;
    w = kids[i];
    // find the inner window with WM_STATE on it
    w = CheckWindow(w);

    int status = XGetWindowProperty(mDisplay, w, mMozVersionAtom,
                                    0, (65536 / sizeof (long)),
                                    False, XA_STRING,
                                    &type, &format, &nitems, &bytesafter,
                                    &data_return);

    if (!data_return)
      continue;

    PRFloat64 version = PR_strtod((char*) data_return, nsnull);
    XFree(data_return);

    if (aSupportsCommandLine && !(version >= 5.1 && version < 6))
      continue;

    data_return = 0;

    if (status != Success || type == None)
      continue;

    // If someone passed in a program name, check it against this one
    // unless it's "any" in which case, we don't care.  If someone did
    // pass in a program name and this window doesn't support that
    // protocol, we don't include it in our list.
    if (aProgram && strcmp(aProgram, "any")) {
        status = XGetWindowProperty(mDisplay, w, mMozProgramAtom,
                                    0, (65536 / sizeof(long)),
                                    False, XA_STRING,
                                    &type, &format, &nitems, &bytesafter,
                                    &data_return);
        
        // If the return name is not the same as what someone passed in,
        // we don't want this window.
        if (data_return) {
            if (strcmp(aProgram, (const char *)data_return)) {
                XFree(data_return);
                continue;
            }

            // This is actually the success condition.
            XFree(data_return);
        }
        else {
            // Doesn't support the protocol, even though the user
            // requested it.  So we're not going to use this window.
            continue;
        }
    }

    // Check to see if it has the user atom on that window.  If there
    // is then we need to make sure that it matches what we have.
    const char *username;
    if (aUsername) {
      username = aUsername;
    }
    else {
      username = PR_GetEnv("LOGNAME");
    }

    if (username) {
        status = XGetWindowProperty(mDisplay, w, mMozUserAtom,
                                    0, (65536 / sizeof(long)),
                                    False, XA_STRING,
                                    &type, &format, &nitems, &bytesafter,
                                    &data_return);

        // if there's a username compare it with what we have
        if (data_return) {
            // If the IDs aren't equal, we don't want this window.
            if (strcmp(username, (const char *)data_return)) {
                XFree(data_return);
                continue;
            }

            XFree(data_return);
        }
    }

    // Check to see if there's a profile name on this window.  If
    // there is, then we need to make sure it matches what someone
    // passed in.
    if (aProfile) {
        status = XGetWindowProperty(mDisplay, w, mMozProfileAtom,
                                    0, (65536 / sizeof(long)),
                                    False, XA_STRING,
                                    &type, &format, &nitems, &bytesafter,
                                    &data_return);

        // If there's a profile compare it with what we have
        if (data_return) {
            // If the profiles aren't equal, we don't want this window.
            if (strcmp(aProfile, (const char *)data_return)) {
                XFree(data_return);
                continue;
            }

            XFree(data_return);
        }
    }

    // Check to see if the window supports the new command-line passing
    // protocol, if that is requested.

    // If we got this far, this is the best window so far.  It passed
    // all the tests.
    bestWindow = w;
  }

  if (kids)
    XFree((char *) kids);

  return bestWindow;
}

Here is the call graph for this function:

nsresult XRemoteClient::FreeLock ( Window  aWindow) [private]

Definition at line 604 of file XRemoteClient.cpp.

{
  int result;
  Atom actual_type;
  int actual_format;
  unsigned long nitems, bytes_after;
  unsigned char *data = 0;

  result = XGetWindowProperty(mDisplay, aWindow, mMozLockAtom,
                              0, (65536 / sizeof(long)),
                              True, /* atomic delete after */
                              XA_STRING,
                              &actual_type, &actual_format,
                              &nitems, &bytes_after,
                              &data);
  if (result != Success) {
      PR_LOG(sRemoteLm, PR_LOG_DEBUG,
             ("unable to read and delete " MOZILLA_LOCK_PROP
              " property\n"));
      return NS_ERROR_FAILURE;
  }
  else if (!data || !*data){
      PR_LOG(sRemoteLm, PR_LOG_DEBUG,
             ("invalid data on " MOZILLA_LOCK_PROP
              " of window 0x%x.\n",
              (unsigned int) aWindow));
      return NS_ERROR_FAILURE;
  }
  else if (strcmp((char *)data, mLockData)) {
      PR_LOG(sRemoteLm, PR_LOG_DEBUG,
             (MOZILLA_LOCK_PROP " was stolen!  Expected \"%s\", saw \"%s\"!\n",
              mLockData, data));
      return NS_ERROR_FAILURE;
  }

  if (data)
      XFree(data);
  return NS_OK;
}
nsresult XRemoteClient::GetLock ( Window  aWindow,
PRBool aDestroyed 
) [private]

Definition at line 328 of file XRemoteClient.cpp.

{
  PRBool locked = PR_FALSE;
  PRBool waited = PR_FALSE;
  *aDestroyed = PR_FALSE;

  if (!mLockData) {
    
    char pidstr[32];
    char sysinfobuf[SYS_INFO_BUFFER_LENGTH];
    PR_snprintf(pidstr, sizeof(pidstr), "pid%d@", getpid());
    PRStatus status;
    status = PR_GetSystemInfo(PR_SI_HOSTNAME, sysinfobuf,
                           SYS_INFO_BUFFER_LENGTH);
    if (status != PR_SUCCESS) {
      return NS_ERROR_FAILURE;
    }
    
    // allocate enough space for the string plus the terminating
    // char
    mLockData = (char *)malloc(strlen(pidstr) + strlen(sysinfobuf) + 1);
    if (!mLockData)
      return NS_ERROR_OUT_OF_MEMORY;

    strcpy(mLockData, pidstr);
    if (!strcat(mLockData, sysinfobuf))
      return NS_ERROR_FAILURE;
  }

  do {
    int result;
    Atom actual_type;
    int actual_format;
    unsigned long nitems, bytes_after;
    unsigned char *data = 0;

    XGrabServer(mDisplay);

    result = XGetWindowProperty (mDisplay, aWindow, mMozLockAtom,
                             0, (65536 / sizeof (long)),
                             False, /* don't delete */
                             XA_STRING,
                             &actual_type, &actual_format,
                             &nitems, &bytes_after,
                             &data);
    if (result != Success || actual_type == None) {
      /* It's not now locked - lock it. */
      XChangeProperty (mDisplay, aWindow, mMozLockAtom, XA_STRING, 8,
                     PropModeReplace,
                     (unsigned char *)mLockData,
                     strlen(mLockData));
      locked = True;
    }

    XUngrabServer(mDisplay);
    XSync(mDisplay, False);

    if (!locked) {
      /* We tried to grab the lock this time, and failed because someone
        else is holding it already.  So, wait for a PropertyDelete event
        to come in, and try again. */
      PR_LOG(sRemoteLm, PR_LOG_DEBUG, 
            ("window 0x%x is locked by %s; waiting...\n",
             (unsigned int) aWindow, data));
      waited = True;
      while (1) {
       XEvent event;
       int select_retval;
#ifdef POLL_WITH_XCONNECTIONNUMBER
       struct pollfd fds[1];
       fds[0].fd = XConnectionNumber(mDisplay);
       fds[0].events = POLLIN;
       select_retval = poll(fds,1,10*1000);
#else
       fd_set select_set;
       struct timeval delay;
       delay.tv_sec = 10;
       delay.tv_usec = 0;

       FD_ZERO(&select_set);
       // add the x event queue to the select set
       FD_SET(ConnectionNumber(mDisplay), &select_set);
       select_retval = select(ConnectionNumber(mDisplay) + 1,
                            &select_set, NULL, NULL, &delay);
#endif
       // did we time out?
       if (select_retval == 0) {
         PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("timed out waiting for window\n"));
         return NS_ERROR_FAILURE;
       }
       PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("xevent...\n"));
       XNextEvent (mDisplay, &event);
       if (event.xany.type == DestroyNotify &&
           event.xdestroywindow.window == aWindow) {
         PR_LOG(sRemoteLm, PR_LOG_DEBUG,
               ("window 0x%x unexpectedly destroyed.\n",
                (unsigned int) aWindow));
         *aDestroyed = PR_TRUE;
         return NS_ERROR_FAILURE;
       }
       else if (event.xany.type == PropertyNotify &&
               event.xproperty.state == PropertyDelete &&
               event.xproperty.window == aWindow &&
               event.xproperty.atom == mMozLockAtom) {
         /* Ok!  Someone deleted their lock, so now we can try
            again. */
         PR_LOG(sRemoteLm, PR_LOG_DEBUG,
               ("(0x%x unlocked, trying again...)\n",
                (unsigned int) aWindow));
                break;
       }
      }
    }
    if (data)
      XFree(data);
  } while (!locked);

  if (waited) {
    PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("obtained lock.\n"));
  }

  return NS_OK;
}

Here is the call graph for this function:

Initializes the client.

Implements nsRemoteClient.

Definition at line 67 of file PhRemoteClient.cpp.

{

  if (mInitialized)
    return NS_OK;

       /* we have to initialize the toolkit since we use PtConnection stuff to send messages */
       PtInit( NULL );

  mInitialized = PR_TRUE;

  return NS_OK;
}

Here is the caller graph for this function:

virtual nsresult XRemoteClient::Init ( ) [virtual]

Initializes the client.

Implements nsRemoteClient.

nsresult XRemoteClient::SendCommand ( const char *  aProgram,
const char *  aUsername,
const char *  aProfile,
const char *  aCommand,
char **  aResponse,
PRBool aSucceeded 
) [virtual]

Sends a command to a running instance.

Parameters:
aProgramThis is the preferred program that we want to use for this particular command.
aNoProgramFallbackThis boolean attribute tells the client code that if the preferred program isn't found that it should fail not send the command to another server.
aUsernameThis allows someone to only talk to an instance of the server that's running under a particular username. If this isn't specified here it's pulled from the LOGNAME environmental variable if it's set.
aProfileThis allows you to specify a particular server running under a named profile. If it is not specified the profile is not checked.
aCommandThis is the command that is passed to the server. Please see the additional information located at: http://www.mozilla.org/unix/remote.html
aResponseIf there is a response, it will be here. This includes error messages. The string is allocated using stdlib string functions, so free it with free().

true if succeeded, false if no running instance was found.

Implements nsRemoteClient.

Definition at line 82 of file PhRemoteClient.cpp.

{
  *aWindowFound = PR_TRUE;

       char RemoteServerName[128];

       sprintf( RemoteServerName, "%s_RemoteServer", aProgram ? aProgram : "mozilla" );

       PtConnectionClient_t *cnt = PtConnectionFindName( RemoteServerName, 0, 0 );
       if( !cnt ) {
              /* no window has registered for the remote service */
              *aWindowFound = PR_FALSE;
              return NS_OK;
              }

       if( PtConnectionSend( cnt, MOZ_REMOTE_MSG_TYPE, aCommand, NULL, strlen( aCommand ), 0 ) < 0 )
              return NS_ERROR_FAILURE;

  return NS_OK;
}

Here is the caller graph for this function:

virtual nsresult XRemoteClient::SendCommand ( const char *  aProgram,
const char *  aUsername,
const char *  aProfile,
const char *  aCommand,
char **  aResponse,
PRBool aSucceeded 
) [virtual]

Sends a command to a running instance.

Parameters:
aProgramThis is the preferred program that we want to use for this particular command.
aNoProgramFallbackThis boolean attribute tells the client code that if the preferred program isn't found that it should fail not send the command to another server.
aUsernameThis allows someone to only talk to an instance of the server that's running under a particular username. If this isn't specified here it's pulled from the LOGNAME environmental variable if it's set.
aProfileThis allows you to specify a particular server running under a named profile. If it is not specified the profile is not checked.
aCommandThis is the command that is passed to the server. Please see the additional information located at: http://www.mozilla.org/unix/remote.html
aResponseIf there is a response, it will be here. This includes error messages. The string is allocated using stdlib string functions, so free it with free().

true if succeeded, false if no running instance was found.

Implements nsRemoteClient.

nsresult XRemoteClient::SendCommandLine ( const char *  aProgram,
const char *  aUsername,
const char *  aProfile,
PRInt32  argc,
char **  argv,
char **  aResponse,
PRBool aSucceeded 
) [virtual]

Send a complete command line to a running instance.

See also:
sendCommand
Parameters:
argcThe number of command-line arguments.

Implements nsRemoteClient.

Definition at line 106 of file PhRemoteClient.cpp.

{
  return NS_ERROR_FAILURE;
}
virtual nsresult XRemoteClient::SendCommandLine ( const char *  aProgram,
const char *  aUsername,
const char *  aProfile,
PRInt32  argc,
char **  argv,
char **  aResponse,
PRBool aSucceeded 
) [virtual]

Send a complete command line to a running instance.

See also:
sendCommand
Parameters:
argcThe number of command-line arguments.

Implements nsRemoteClient.

Definition at line 115 of file PhRemoteClient.cpp.

{

  if (!mInitialized)
    return;

  // shut everything down
  mInitialized = PR_FALSE;

  return;
}

Here is the caller graph for this function:

PRBool XRemoteClient::WaitForResponse ( Window  aWindow,
char **  aResponse,
PRBool aDestroyed,
Atom  aCommandAtom 
) [private]

Definition at line 740 of file XRemoteClient.cpp.

{
  PRBool done = PR_FALSE;
  PRBool accepted = PR_FALSE;

  while (!done) {
    XEvent event;
    XNextEvent (mDisplay, &event);
    if (event.xany.type == DestroyNotify &&
        event.xdestroywindow.window == aWindow) {
      /* Print to warn user...*/
      PR_LOG(sRemoteLm, PR_LOG_DEBUG,
             ("window 0x%x was destroyed.\n",
              (unsigned int) aWindow));
      *aResponse = strdup("Window was destroyed while reading response.");
      *aDestroyed = PR_TRUE;
      return PR_FALSE;
    }
    else if (event.xany.type == PropertyNotify &&
             event.xproperty.state == PropertyNewValue &&
             event.xproperty.window == aWindow &&
             event.xproperty.atom == mMozResponseAtom) {
      Atom actual_type;
      int actual_format;
      unsigned long nitems, bytes_after;
      unsigned char *data = 0;
      Bool result;
      result = XGetWindowProperty (mDisplay, aWindow, mMozResponseAtom,
                                   0, (65536 / sizeof (long)),
                                   True, /* atomic delete after */
                                   XA_STRING,
                                   &actual_type, &actual_format,
                                   &nitems, &bytes_after,
                                   &data);
      if (result != Success) {
        PR_LOG(sRemoteLm, PR_LOG_DEBUG,
               ("failed reading " MOZILLA_RESPONSE_PROP
                " from window 0x%0x.\n",
                (unsigned int) aWindow));
        *aResponse = strdup("Internal error reading response from window.");
        done = PR_TRUE;
      }
      else if (!data || strlen((char *) data) < 5) {
        PR_LOG(sRemoteLm, PR_LOG_DEBUG,
               ("invalid data on " MOZILLA_RESPONSE_PROP
                " property of window 0x%0x.\n",
                (unsigned int) aWindow));
        *aResponse = strdup("Server returned invalid data in response.");
        done = PR_TRUE;
      }
      else if (*data == '1') {  /* positive preliminary reply */
        PR_LOG(sRemoteLm, PR_LOG_DEBUG,  ("%s\n", data + 4));
        /* keep going */
        done = PR_FALSE;
      }

      else if (!strncmp ((char *)data, "200", 3)) { /* positive completion */
        *aResponse = strdup((char *)data);
        accepted = PR_TRUE;
        done = PR_TRUE;
      }

      else if (*data == '2') {  /* positive completion */
        PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("%s\n", data + 4));
        *aResponse = strdup((char *)data);
        accepted = PR_TRUE;
        done = PR_TRUE;
      }

      else if (*data == '3') {  /* positive intermediate reply */
        PR_LOG(sRemoteLm, PR_LOG_DEBUG,
               ("internal error: "
                "server wants more information?  (%s)\n",
                data));
        *aResponse = strdup((char *)data);
        done = PR_TRUE;
      }

      else if (*data == '4' ||  /* transient negative completion */
               *data == '5') {  /* permanent negative completion */
        PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("%s\n", data + 4));
        *aResponse = strdup((char *)data);
        done = PR_TRUE;
      }

      else {
        PR_LOG(sRemoteLm, PR_LOG_DEBUG,
               ("unrecognised " MOZILLA_RESPONSE_PROP
                " from window 0x%x: %s\n",
                (unsigned int) aWindow, data));
        *aResponse = strdup((char *)data);
        done = PR_TRUE;
      }

      if (data)
        XFree(data);
    }

    else if (event.xany.type == PropertyNotify &&
             event.xproperty.window == aWindow &&
             event.xproperty.state == PropertyDelete &&
             event.xproperty.atom == aCommandAtom) {
      PR_LOG(sRemoteLm, PR_LOG_DEBUG,
             ("(server 0x%x has accepted "
              MOZILLA_COMMAND_PROP ".)\n",
              (unsigned int) aWindow));
    }
    
  }

  return accepted;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 79 of file XRemoteClient.h.

Definition at line 58 of file PhRemoteClient.h.

char* XRemoteClient::mLockData [private]

Definition at line 92 of file XRemoteClient.h.

Definition at line 83 of file XRemoteClient.h.

Definition at line 84 of file XRemoteClient.h.

Definition at line 82 of file XRemoteClient.h.

Definition at line 88 of file XRemoteClient.h.

Definition at line 89 of file XRemoteClient.h.

Definition at line 85 of file XRemoteClient.h.

Definition at line 90 of file XRemoteClient.h.

Definition at line 87 of file XRemoteClient.h.

Definition at line 81 of file XRemoteClient.h.

Definition at line 86 of file XRemoteClient.h.


The documentation for this class was generated from the following files: