NntpListNewGroups
INT NntpListNewGroups(
HCLIENT hClient,  
LPCTSTR lpszLastUpdated,  
BOOL bLocalTime  
);

The NntpListNewGroups function instructs the server to begin sending a list of newsgroups that were created since the specified date.

Parameters

hClient
Handle to the client session.
lpszLastUpdated
Pointer to a null-terminated string which specifies the date and time that the list of newsgroups were last retrieved from the server. This parameter may be NULL or an empty string, in which case all available newsgroups will be listed by the server.
bLocalTime
A boolean value which indicates if the time specified in the lpszLastUpdated parameter is for the current timezone. If the value is non-zero, the time is assumed to be in the local timezone. If the value is zero, the time is assumed to be in Coordinated Universal Time (UTC).

Return Value

If the function succeeds, the return value is the server result code. If the function fails, the return value is NNTP_ERROR. To get extended error information, call NntpGetLastError.

Remarks

The NntpListNewGroups function is used in conjunction with the NntpGetFirstGroup and NntpGetNextGroup functions to enumerate all of the newsgroups that were added to the server since a specific date and time. Typically this is used to provide the user with a list of updated newsgroups to select. To list all of the newsgroups available on the server, use the NntpListGroups function.

While the newsgroups are being listed, the client cannot select a newsgroup or retrieve the contents of a specific article. The client should store those newsgroups which it wants to retrieve articles from, and then once all of the newsgroups have been listed, it can then select each newsgroup and retrieve the available articles from that group.

Example

NEWSGROUP newsGroup;
LPCTSTR lpszUpdated = _T("1/1/2004 12:00 AM");
BOOL bResult;
INT nResult;

// List all newsgroups that were added after a
// specific date
nResult = NntpListNewGroups(hClient, lpszUpdated, TRUE);

if (nResult == NNTP_ERROR)
{
    TCHAR szError[ASTRING];
    DWORD dwError = NntpGetLastError();
    NntpGetErrorString(dwError, szError, ASTRING);
    fprintf(stderr, "Error %08x: %s\n", dwError, szError);
    return;
}

// Get each newsgroup, printing the article range and
// the name of the group
bResult = NntpGetFirstGroup(hClient, &newsGroup);
while (bResult)
{
    printf("%ld %ld %s\n", newsGroup.nFirstArticle,
                           newsGroup.nLastArticle,
                           newsGroup.szName);
    bResult = NntpGetNextGroup(hClient, &newsGroup);
}

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csnwsav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

NntpGetArticleRange, NntpGetFirstGroup, NntpGetNextGroup, NntpListGroups, NntpSelectGroup


Copyright © 2008 Catalyst Development Corporation. All rights reserved.