Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsNewsUtils.cpp File Reference
#include "msgCore.h"
#include "nntpCore.h"
#include "nsNewsUtils.h"
#include "nsReadableUtils.h"

Go to the source code of this file.

Functions

nsresult nsParseNewsMessageURI (const char *uri, nsCString &folderURI, PRUint32 *key)
nsresult nsCreateNewsBaseMessageURI (const char *baseURI, char **baseMessageURI)

Function Documentation

nsresult nsCreateNewsBaseMessageURI ( const char *  baseURI,
char **  baseMessageURI 
)

Definition at line 76 of file nsNewsUtils.cpp.

{
       if(!baseMessageURI)
              return NS_ERROR_NULL_POINTER;

       nsCAutoString tailURI(baseURI);

       // chop off mailbox:/
       if (tailURI.Find(kNewsRootURI) == 0)
              tailURI.Cut(0, PL_strlen(kNewsRootURI));
       
       nsCAutoString baseURIStr(kNewsMessageRootURI);
       baseURIStr += tailURI;

       *baseMessageURI = ToNewCString(baseURIStr);
       if(!*baseMessageURI)
              return NS_ERROR_OUT_OF_MEMORY;

       return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsParseNewsMessageURI ( const char *  uri,
nsCString folderURI,
PRUint32 key 
)

Definition at line 47 of file nsNewsUtils.cpp.

{
    NS_ENSURE_ARG_POINTER(uri);
    NS_ENSURE_ARG_POINTER(key);

       nsCAutoString uriStr(uri);
       PRInt32 keySeparator = uriStr.FindChar('#');
       if(keySeparator != -1)
       {
    PRInt32 keyEndSeparator = uriStr.FindCharInSet("?&", 
                                                   keySeparator); 

              uriStr.Left(folderURI, keySeparator);
        folderURI.Cut(4, 8);    // cut out the -message part of news-message:

              nsCAutoString keyStr;
    if (keyEndSeparator != -1)
        uriStr.Mid(keyStr, keySeparator+1, 
                   keyEndSeparator-(keySeparator+1));
    else
        uriStr.Right(keyStr, uriStr.Length() - (keySeparator + 1));
              PRInt32 errorCode;
              *key = keyStr.ToInteger(&errorCode);

              return errorCode;
       }
       return NS_ERROR_FAILURE;
}

Here is the caller graph for this function: