[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / lond

raeburn raeburn at source.lon-capa.org
Sat Aug 3 23:13:39 EDT 2013


raeburn		Sun Aug  4 03:13:39 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom	lond 
  Log:
  - For 2.11
    - Backport 1.501
  
  
Index: loncom/lond
diff -u loncom/lond:1.489.2.5 loncom/lond:1.489.2.6
--- loncom/lond:1.489.2.5	Sat May 11 22:42:22 2013
+++ loncom/lond	Sun Aug  4 03:13:39 2013
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.489.2.5 2013/05/11 22:42:22 raeburn Exp $
+# $Id: lond,v 1.489.2.6 2013/08/04 03:13:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,7 +61,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.489.2.5 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.6 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -4448,6 +4448,49 @@
 }
 &register_handler("idget", \&get_id_handler, 0, 1, 0);
 
+   Deletes one or more ids in a domain's id database.
+#
+#   Parameters:
+#       $cmd                  - Command keyword (iddel).
+#       $tail                 - Command tail.  In this case a colon
+#                               separated list containing:
+#                               The domain for which we are deleting the id(s).
+#                               &-separated list of id(s) to delete.
+#       $client               - File open on client socket.
+# Returns:
+#     1   - Continue processing
+#     0   - Exit server.
+#
+#
+
+sub del_id_handler {
+    my ($cmd,$tail,$client) = @_;
+
+    my $userinput = "$cmd:$tail";
+
+    my ($udom,$what)=split(/:/,$tail);
+    chomp($what);
+    my $hashref = &tie_domain_hash($udom, "ids", &GDBM_WRCREAT(),
+                                   "D", $what);
+    if ($hashref) {
+        my @keys=split(/\&/,$what);
+        foreach my $key (@keys) {
+            delete($hashref->{$key});
+        }
+        if (&untie_user_hash($hashref)) {
+            &Reply($client, "ok\n", $userinput);
+        } else {
+            &Failure($client, "error: ".($!+0)." untie(GDBM) Failed ".
+                    "while attempting iddel\n", $userinput);
+        }
+    } else {
+        &Failure( $client, "error: ".($!+0)." tie(GDBM) Failed ".
+                 "while attempting iddel\n", $userinput);
+    }
+    return 1;
+}
+&register_handler("iddel", \&del_id_handler, 0, 1, 0);
+
 #
 # Puts broadcast e-mail sent by Domain Coordinator in nohist_dcmail database 
 #




More information about the LON-CAPA-cvs mailing list