Index: openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-packages.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-packages.sql,v
diff -u -r1.6 -r1.7
--- openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-packages.sql	11 Jan 2002 20:38:36 -0000	1.6
+++ openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-packages.sql	9 Mar 2002 02:00:02 -0000	1.7
@@ -309,12 +309,13 @@
     p_creation_date alias for $11;  -- default sysdate
     p_creation_user alias for $12;  -- default null
     p_creation_ip   alias for $13;  -- default null
-    p_object_type   alias for $14;  -- default ''acs_message''
+    p_object_type   alias for $14;  -- default ''bboard_message''
+	v_message_id	bboard_messages.message_id%TYPE;
     v_sent_date   timestamp;
 begin
     v_sent_date := coalesce(p_sent_date, now());
 
-    return acs_message__new (
+    v_message_id := acs_message__new (
         p_message_id,
         p_reply_to,
         v_sent_date,
@@ -332,7 +333,13 @@
         p_object_type,
         ''t''
     );
-    return 0;
+
+	insert into bboard_messages
+	(message_id)
+	values
+	(v_message_id);
+
+    return v_message_id;
 end;
 ' language 'plpgsql';
 
@@ -344,7 +351,7 @@
     v_check_message_id integer;
 begin
     select count(message_id) into v_check_message_id
-        from acs_messages
+        from bboard_messages
         where message_id = p_message_id;
     if v_check_message_id = 1 then
         return ''t'';
@@ -510,7 +517,7 @@
          where o.context_id = m.message_id 
            and m.tree_sortkey between v_search_key and tree_right(v_search_key)
     loop
-        if child_val.object_type = ''acs_message'' then
+        if child_val.object_type = ''bboard_message'' then
            perform acs_message__delete(child_val.child_id);
         elsif child_val.object_type = ''content_item'' then
             select count(*) into image_p
@@ -549,18 +556,20 @@
 	  from acs_objects
          where context_id = message_id
     loop
-	if child_val.object_type = ''acs_message'' then
+	if child_val.object_type = ''bboard_message'' then
 	   perform acs_message__delete(child_val.child_id);
-	elsif child_val.object_type = ''content_item'' then
+	else if child_val.object_type = ''content_item'' then
 	    select count(*) into image_p
 	      from images
                 where image_id = child_val.child_id;
             if image_p = 1 then
                 perform acs_message__delete_image(child_val.child_id);
+
             else
+
                 perform acs_message__delete_file(child_val.child_id);
-            end if;
        end if;
+       end if; end if;
    end loop;
 
    perform acs_message__delete(message_id);
