Index: openacs-4/packages/chat/sql/postgresql/chat-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/sql/postgresql/chat-create.sql,v
diff -u -r1.1 -r1.1.2.1
--- openacs-4/packages/chat/sql/postgresql/chat-create.sql	14 Mar 2006 12:16:09 -0000	1.1
+++ openacs-4/packages/chat/sql/postgresql/chat-create.sql	7 Apr 2006 16:59:52 -0000	1.1.2.1
@@ -201,13 +201,13 @@
                        check (active_p in ('t','f')),
     -- if set then log all chat messages in this room.
     archive_p          boolean
-                       default 'f'
+                        default 't'
                        constraint chat_rooms_archive_p_ck
-                       check (archive_p in ('t', 'f'))
-
-
-
-
+                        check (archive_p in ('t', 'f')),
+    -- flush the rooms messages every night at 00:05                    
+    auto_flush_p        boolean default 't',
+    -- automatically create a transcript after flushing the room
+    auto_transcript_p   boolean default 'f'
 );
 
 
@@ -343,7 +343,7 @@
 
 ---------------------------------
 
-create function chat_room__new (integer, varchar, varchar, boolean, boolean, boolean, integer, timestamptz, integer, varchar, varchar)
+create or replace function chat_room__new (integer, varchar, varchar, boolean, boolean, boolean, boolean, boolean, integer, timestamptz, integer, varchar, varchar)
 returns integer as '
 declare
    p_room_id        alias for $1;
@@ -352,11 +352,13 @@
    p_moderated_p    alias for $4;
    p_active_p       alias for $5;
    p_archive_p      alias for $6;
-   p_context_id     alias for $7;
-   p_creation_date  alias for $8;
-   p_creation_user  alias for $9;
-   p_creation_ip    alias for $10;
-   p_object_type    alias for $11;
+   p_auto_flush_p      alias for $7;
+   p_auto_transcript_p      alias for $8;
+   p_context_id     alias for $9;
+   p_creation_date  alias for $10;
+   p_creation_user  alias for $11;
+   p_creation_ip    alias for $12;
+   p_object_type    alias for $13;
    v_room_id        chat_rooms.room_id%TYPE;
 begin
    v_room_id := acs_object__new (
@@ -369,9 +371,9 @@
    );
 
    insert into chat_rooms
-       (room_id, pretty_name, description, moderated_p, active_p, archive_p)
+       (room_id, pretty_name, description, moderated_p, active_p, archive_p, auto_flush_p, auto_transcript_p)
    values
-       (v_room_id, p_pretty_name, p_description, p_moderated_p, p_active_p, p_archive_p);
+       (v_room_id, p_pretty_name, p_description, p_moderated_p, p_active_p, p_archive_p, p_auto_flush_p, p_auto_transcript_p);
 
 return v_room_id;
 
@@ -507,7 +509,8 @@
 end;' language 'plpgsql';
 ----------------------------
 
-create function chat_room__edit (integer, varchar, varchar, boolean, boolean, boolean)
+
+create or replace function chat_room__edit (integer, varchar, varchar, boolean, boolean, boolean, boolean, boolean)
 returns integer as '
 declare
    p_room_id        alias for $1;
@@ -516,14 +519,18 @@
    p_moderated_p    alias for $4;
    p_active_p       alias for $5;
    p_archive_p      alias for $6;
+   p_auto_flush_p      alias for $7;
+   p_auto_transcript_p      alias for $8;
 begin
 
         update chat_rooms set
             pretty_name = p_pretty_name,
             description = p_description,
             moderated_p = p_moderated_p,
             active_p    = p_active_p,
-            archive_p   = p_archive_p
+            archive_p   = p_archive_p,
+            auto_flush_p   = p_auto_flush_p,
+            auto_transcript_p   = p_auto_transcript_p
         where
             room_id = p_room_id;
         return 0;
