diff src/server.c @ 281:7b06ba09ffe2

[gaim-migrate @ 291] So someone today told me I should make it so the permit list works, so I did. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 30 May 2000 23:49:54 +0000
parents e606585a38bd
children 0f14e6d8a51b
line wrap: on
line diff
--- a/src/server.c	Tue May 30 06:36:32 2000 +0000
+++ b/src/server.c	Tue May 30 23:49:54 2000 +0000
@@ -344,11 +344,11 @@
 
 void serv_set_permit_deny()
 {
+#ifndef USE_OSCAR
 	char buf[MSG_LEN];
 	int at;
 	GList *list;
 
-#ifndef USE_OSCAR
         /* FIXME!  We flash here. */
         if (permdeny == 1 || permdeny == 3) {
         	g_snprintf(buf, sizeof(buf), "toc_add_permit");
@@ -379,14 +379,41 @@
 #else
 	/* oscar requires us to do everyone at once (?) */
 	/* I think this code is OK now. */
-	list = deny; at = 0;
-	if (list == NULL) return;
-	while (list) {
-		at += g_snprintf(&buf[at], sizeof(buf) - at, "%s&", list->data);
-		list = list->next;
+	char buf[BUF_LONG]; int at; GList *list, *grp, *bud;
+	if (permdeny == 3) { /* Permit Some : Only people on buddy list and
+				on permit list */
+		struct group *g; struct buddy *b;
+		at = 0; list = permit; grp = groups;
+		debug_print("Setting permit list...\n");
+		while (grp) {
+			g = (struct group *)grp->data;
+			bud = g->members;
+			while (bud) {
+				b = (struct buddy *)bud->data;
+				at += g_snprintf(&buf[at], sizeof(buf) - at,
+					"%s&", b->name);
+				bud = bud->next;
+			}
+			grp = grp->next;
+		}
+		while (list) {
+			at += g_snprintf(&buf[at], sizeof(buf) - at, "%s&",
+					list->data);
+			list = list->next;
+		}
+		aim_bos_changevisibility(gaim_sess, gaim_conn,
+					AIM_VISIBILITYCHANGE_PERMITADD, buf);
+	} else { /* Deny Some : Deny people on deny list */
+		list = deny; at = 0;
+		if (list == NULL) return;
+		while (list) {
+			at += g_snprintf(&buf[at], sizeof(buf) - at, "%s&",
+					list->data);
+			list = list->next;
+		}
+		aim_bos_changevisibility(gaim_sess, gaim_conn,
+					AIM_VISIBILITYCHANGE_DENYADD, buf);
 	}
-	aim_bos_changevisibility(gaim_sess, gaim_conn,
-				AIM_VISIBILITYCHANGE_DENYADD, buf);
 #endif
 }