Commit 600ba5d6 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(lookup_z_name): New function.

parent 4b6a0533
/* /*
* $Id: services.h,v 0.19 1994/12/31 11:44:00 ceder Exp $ * $Id: services.h,v 0.20 1994/12/31 15:13:41 ceder Exp $
* Copyright (C) 1991, 1992, 1993 Lysator Academic Computer Association. * Copyright (C) 1991, 1992, 1993 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -229,6 +229,12 @@ KOM_( lookup_name (const String name, ...@@ -229,6 +229,12 @@ KOM_( lookup_name (const String name,
Conf_list *result)); Conf_list *result));
#endif #endif
extern Success
KOM_( lookup_z_name (const String name,
int want_persons,
int want_confs,
Conf_z_info_list *result));
/* Use these two lookup-calls instead of lookup_name */ /* Use these two lookup-calls instead of lookup_name */
extern Success extern Success
KOM_( lookup_person (const String pattern, KOM_( lookup_person (const String pattern,
......
/* /*
* $Id: conference.c,v 0.27 1994/10/23 16:12:56 ceder Exp $ * $Id: conference.c,v 0.28 1994/12/31 15:18:26 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994 Lysator Academic Computer Association. * Copyright (C) 1991, 1992, 1993, 1994 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* All atomic calls that deals with conferences. * All atomic calls that deals with conferences.
*/ */
static char *rcsid = "$Id: conference.c,v 0.27 1994/10/23 16:12:56 ceder Exp $"; static char *rcsid = "$Id: conference.c,v 0.28 1994/12/31 15:18:26 ceder Exp $";
#include "rcs.h" #include "rcs.h"
USE(rcsid); USE(rcsid);
...@@ -543,6 +543,65 @@ lookup_name (const String name, ...@@ -543,6 +543,65 @@ lookup_name (const String name,
return OK; return OK;
} }
extern Success
lookup_z_name (const String name,
int want_persons,
int want_confs,
Conf_z_info_list * result)
{
Conf_no *no;
Conf_type *type;
Conf_z_info *res;
int i;
int n_filtered;
Conf_list_old raw_matches;
if (cached_lookup_name(name, &raw_matches) != OK)
return FAILURE;
no = raw_matches.conf_nos;
type = raw_matches.type_of_conf;
n_filtered = raw_matches.no_of_conf_nos;
for (i = raw_matches.no_of_conf_nos; i > 0; i--)
{
if (*no == 0)
restart_kom("Internal error detected in lookup_z_name");
if ((type->letter_box ? want_persons : want_confs) == 0
|| fast_access_perm(*no, ACTPERS, ACT_P) <= none)
{
*no = 0;
n_filtered--;
}
no++;
type++;
}
result->no_of_confs = n_filtered;
result->confs = tmp_alloc(n_filtered * sizeof(Conf_z_info));
no = raw_matches.conf_nos;
type = raw_matches.type_of_conf;
res = result->confs;
for (i = raw_matches.no_of_conf_nos; i > 0; i--)
{
if (*no != 0)
{
res->conf_no = *no;
res->type = *type;
res->name = cached_get_name(*no);
res++;
}
no++;
type++;
}
if (res != result->confs + n_filtered)
restart_kom("Internal error in lookup_z_name");
return OK;
}
static Success static Success
do_lookup (const String name, do_lookup (const String name,
Conf_no_list * result, Conf_no_list * result,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment