changeset 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 918db59d3814
files libfaim/CHANGES.gaim libfaim/README.gaim libfaim/aim.h libfaim/aim_conn.c libfaim/aim_txqueue.c src/buddy.c src/server.c
diffstat 7 files changed, 60 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES.gaim	Tue May 30 06:36:32 2000 +0000
+++ b/libfaim/CHANGES.gaim	Tue May 30 23:49:54 2000 +0000
@@ -1,3 +1,12 @@
+
+Tue May 30 23:40:11 UTC 2000 EWarmenhoven
+	- So today, somone IMs me and says that he thinks that allowing only the
+	  people on your buddy list to see you is a good thing, and that I
+	  should implement it. Well, I did, but it doesn't work right most of
+	  the time, as far as I can tell. At least it works occasionally. I
+	  think I did everything right though. Maybe my timing is off?
+	- Updates to libfaim, so I updated gaim's copy. There should really be a
+	  better system.
 
 Tue May 30 04:04:40 UTC 2000 EWarmenhoven
 	- Well, after trying to screw around with the permit/deny stuff a bit,
--- a/libfaim/README.gaim	Tue May 30 06:36:32 2000 +0000
+++ b/libfaim/README.gaim	Tue May 30 23:49:54 2000 +0000
@@ -33,6 +33,9 @@
 	this, gaim with libfaim is still really buggy, none of you will listen
 	to me anyway)
 Telling the server who's on your permit/deny lists
+Chat:
+ - getting invited
+ - refreshing the chatlist in the preferences dialog
 
 CURRENTLY UNSUPPORTED FEATURES
 ==============================
@@ -41,10 +44,8 @@
  - joining rooms
  - leaving rooms
  - talking
- - getting invited
  - inviting someone
  - whispering (this will never happen)
- - refreshing the chatlist in the preferences dialog
 Getting/setting dir info
 Changing your password
 File transfer/IM images/voice chat/etc.
--- a/libfaim/aim.h	Tue May 30 06:36:32 2000 +0000
+++ b/libfaim/aim.h	Tue May 30 23:49:54 2000 +0000
@@ -133,9 +133,8 @@
   time_t lastactivity; /* time of last transmit */
   int forcedlatency; 
   struct aim_rxcblist_t *handlerlist;
-#ifdef FAIM_USEPTHREADS
-  faim_mutex_t active;
-#endif
+  faim_mutex_t active; /* lock around read/writes */
+  faim_mutex_t seqnum_lock; /* lock around ->seqnum changes */
 };
 
 /* struct for incoming commands */
--- a/libfaim/aim_conn.c	Tue May 30 06:36:32 2000 +0000
+++ b/libfaim/aim_conn.c	Tue May 30 23:49:54 2000 +0000
@@ -40,6 +40,7 @@
     free(deadconn->priv);
   deadconn->priv = NULL;
   faim_mutex_init(&deadconn->active, NULL);
+  faim_mutex_init(&deadconn->seqnum_lock, NULL);
 }
 
 struct aim_conn_t *aim_getconn_type(struct aim_session_t *sess,
--- a/libfaim/aim_txqueue.c	Tue May 30 06:36:32 2000 +0000
+++ b/libfaim/aim_txqueue.c	Tue May 30 23:49:54 2000 +0000
@@ -141,7 +141,12 @@
  */
 u_int aim_get_next_txseqnum(struct aim_conn_t *conn)
 {
-  return ( ++conn->seqnum );
+  u_int ret;
+  
+  faim_mutex_lock(&conn->seqnum_lock);
+  ret = ++conn->seqnum;
+  faim_mutex_unlock(&conn->seqnum_lock);
+  return ret;
 }
 
 /*
--- a/src/buddy.c	Tue May 30 06:36:32 2000 +0000
+++ b/src/buddy.c	Tue May 30 23:49:54 2000 +0000
@@ -1582,6 +1582,10 @@
 	/* We don't save this 'at home', it's on the server.
          * So, we gotta resend the config to the server. */
         serv_save_config();
+#ifdef USE_OSCAR
+	/* we do this here because we can :) */
+	serv_set_permit_deny();
+#endif
 }
 
 
--- 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
 }