From 6cfc6477ab56654bacede426f25cf9ae544220cb Mon Sep 17 00:00:00 2001 From: mar Date: Thu, 11 Jan 1990 19:23:18 +0000 Subject: [PATCH] have get_members_of_list use the caching routines --- server/qsupport.qc | 70 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/server/qsupport.qc b/server/qsupport.qc index 80a9b84c..294ef879 100644 --- a/server/qsupport.qc +++ b/server/qsupport.qc @@ -2215,18 +2215,64 @@ get_members_of_list(q, argv, cl, action, actarg) int (*action)(); int actarg; ##{ -## int list_id; -## char member_name[129]; +## int list_id, member_id; +## char member_name[129], member_type[9]; char *targv[2]; + int members; + struct save_queue *sq; list_id = *(int *)argv[0]; - targv[0] = "USER"; - targv[1] = member_name; + members = 0; + sq = sq_create(); +## repeat retrieve (member_type = imembers.#member_type, +## member_id = imembers.#member_id) +## where imembers.#list_id = @list_id and imembers.direct = 1 { + if (members++ > 49) +## endretrieve + sq_save_data(sq, (member_type[0] << 24) | (member_id & 0xffffff)); +## } + if (members <= 49) { + targv[1] = malloc(0); + while (sq_remove_data(sq, &member_id)) { + switch (member_id >> 24) { + case 'U': + targv[0] = "USER"; + id_to_name(member_id & 0xffffff, "USER", &targv[1]); + (*action)(2, targv, actarg); + break; + case 'L': + targv[0] = "LIST"; + id_to_name(member_id & 0xffffff, "LIST", &targv[1]); + (*action)(2, targv, actarg); + break; + case 'S': + targv[0] = "STRING"; + id_to_name(member_id & 0xffffff, "STRING", &targv[1]); + (*action)(2, targv, actarg); + break; + case 'K': + targv[0] = "KERBEROS"; + id_to_name(member_id & 0xffffff, "STRING", &targv[1]); + (*action)(2, targv, actarg); + break; + default: + sq_destroy(sq); + return(SMS_INTERNAL); + } + } + free(targv[1]); + sq_destroy(sq); + return(SMS_SUCCESS); + } + sq_destroy(sq); + + targv[1] = member_name; + targv[0] = "USER"; ## range of m is imembers ## repeat retrieve (member_name = users.login) -## where m.#list_id = @list_id and m.member_type = "USER" -## and m.member_id = users.users_id and m.direct = 1 +## where m.#list_id = @list_id and m.#member_type = "USER" +## and m.#member_id = users.users_id and m.direct = 1 ## sort by #member_name ## { (*action)(2, targv, actarg); @@ -2235,8 +2281,8 @@ get_members_of_list(q, argv, cl, action, actarg) targv[0] = "LIST"; ## repeat retrieve (member_name = list.name) -## where m.#list_id = @list_id and m.member_type = "LIST" -## and m.member_id = list.#list_id and m.direct = 1 +## where m.#list_id = @list_id and m.#member_type = "LIST" +## and m.#member_id = list.#list_id and m.direct = 1 ## sort by #member_name ## { (*action)(2, targv, actarg); @@ -2245,8 +2291,8 @@ get_members_of_list(q, argv, cl, action, actarg) targv[0] = "STRING"; ## repeat retrieve (member_name = strings.string) -## where m.#list_id = @list_id and m.member_type = "STRING" -## and m.member_id = strings.string_id and m.direct = 1 +## where m.#list_id = @list_id and m.#member_type = "STRING" +## and m.#member_id = strings.string_id and m.direct = 1 ## sort by #member_name ## { (*action)(2, targv, actarg); @@ -2255,8 +2301,8 @@ get_members_of_list(q, argv, cl, action, actarg) targv[0] = "KERBEROS"; ## repeat retrieve (member_name = strings.string) -## where m.#list_id = @list_id and m.member_type = "KERBEROS" -## and m.member_id = strings.string_id and m.direct = 1 +## where m.#list_id = @list_id and m.#member_type = "KERBEROS" +## and m.#member_id = strings.string_id and m.direct = 1 ## sort by #member_name ## { (*action)(2, targv, actarg); -- 2.45.2