]> code.citadel.org Git - citadel.git/commitdiff
* Allow set/clear of per-user Internet mail privilege
authorArt Cancro <ajc@citadel.org>
Mon, 25 Nov 2002 04:57:43 +0000 (04:57 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 25 Nov 2002 04:57:43 +0000 (04:57 +0000)
* Honor that flag

citadel/ChangeLog
citadel/msgbase.c
citadel/msgbase.h
citadel/routines.c
citadel/routines.h

index e656a922e3bdd28667c577b2856d113fa7b151c5..86c7e17d49bcc301cfa0e7ab8748e56f80186dae 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 601.71  2002/11/25 04:57:43  ajc
+ * Allow set/clear of per-user Internet mail privilege
+ * Honor that flag
+
  Revision 601.70  2002/11/23 13:35:47  error
  * Makefile.in: Alphabetized all the source files
 
@@ -4227,3 +4231,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 2f69288a2d3956bf3005dbe0293787591d1a4dcd..471d8901c8ad1d020cda5f4a9e91841be48ce7af 100644 (file)
@@ -2361,6 +2361,27 @@ int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf, size_t n) {
 }
 
 
+/*
+ * Check to see if the specified user has Internet mail permission
+ * (returns nonzero if permission is granted)
+ */
+int CtdlCheckInternetMailPermission(struct usersupp *who) {
+
+       /* Globally enabled? */
+       if (config.c_restrict == 0) return(1);
+
+       /* User flagged ok? */
+       if (who->flags & US_INTERNET) return(2);
+
+       /* Aide level access? */
+       if (who->axlevel >= 6) return(3);
+
+       /* No mail for you! */
+       return(0);
+}
+
+
+
 /*
  * Validate recipients, count delivery types and errors, and handle aliasing
  * FIXME check for dupes!!!!!
@@ -2593,6 +2614,15 @@ void cmd_ent0(char *entargs)
                        phree(valid);
                        return;
                }
+               if (valid->num_internet > 0) {
+                       if (CtdlCheckInternetMailPermission(&CC->usersupp)==0) {
+                               cprintf("%d You do not have permission "
+                                       "to send Internet mail.\n",
+                                       ERROR + HIGHER_ACCESS_REQUIRED);
+                               phree(valid);
+                               return;
+                       }
+               }
 
                if ( ( (valid->num_internet + valid->num_ignet) > 0)
                   && (CC->usersupp.axlevel < 4) ) {
index ba37dc734ab6df73e55c1d201d6bb10c218af9bc..9f40974fd910b6e80fd673022bf5ad5a7bb5cb49 100644 (file)
@@ -136,3 +136,4 @@ struct CtdlMessage *CtdlMakeMessage(
         char *subject,                  /* Subject (optional) */
         char *preformatted_text         /* ...or NULL to read text from client */
 );
+int CtdlCheckInternetMailPermission(struct usersupp *who);
index 15f954d36802391e3849b52df54459c80a4e171d..1c6e07e6a8d64a0054a919bbe4055f1ae7c74a7f 100644 (file)
@@ -134,6 +134,11 @@ void edituser(CtdlIPC *ipc)
        }
 
        user->axlevel = intprompt("Access level", user->axlevel, 0, 6);
+
+       user->flags = set_attr(ipc, user->flags,
+               "Permission to send/receive Internet mail",
+               US_INTERNET, 0);
+
        if (boolprompt("Ask user to register again", !(user->flags & US_REGIS)))
                user->flags &= ~US_REGIS;
        else
index 986d928cd64aaa4d0ef5c50b8ae67a510fc735b1..f6637394bc56d24c2b25a0a1236b29106b7f29df 100644 (file)
@@ -11,3 +11,4 @@ int num_parms(char *source);
 void strproc(char *string);
 void back(int spaces);
 void progress(unsigned long curr, unsigned long cmax);
+int set_attr(CtdlIPC *ipc, unsigned int sval, char *prompt, unsigned int sbit, int backwards);