Logo Search packages:      
Sourcecode: kmess version File versions  Download package

QString Application::generateCookie (  ) const [protected, inherited]

Generate a random cookie value.

This value is used in chat window hyperlinks and used by MimeApplication derived classes.

Returns:
The generated cookie.

Definition at line 245 of file application.cpp.

Referenced by P2PApplication::gotSlpInvite(), Application::start(), and FileTransfer::userStarted2_ContactAccepts().

{
  int     number, maxNumber;
  QString cookie;

  // The maximum size for a cookie is supposedly 2^32 - 1, though I've
  //  never seen one go higher than 100,000.
  maxNumber = 1048575;
  // Get a random number in the given range.
  number = rand()%maxNumber;
  // Convert the number to a QCString
  cookie.sprintf("%d", number);
  // Return the cookie
  return cookie;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index