diff -Nup privatemsg/privatemsg.info privatemsg_new/privatemsg.info --- privatemsg/privatemsg.info 2007-12-21 13:10:21.000000000 +0100 +++ privatemsg_new/privatemsg.info 2008-01-21 19:04:15.000000000 +0100 @@ -1,10 +1,5 @@ -; $Id: privatemsg.info,v 1.1.2.1.2.2 2007/10/28 10:25:23 karthik Exp $ +; $Id$ name = Privatemsg description = Allow private messages between users. package = Mail - -; Information added by drupal.org packaging script on 2007-12-21 -version = "5.x-2.x-dev" -project = "privatemsg" -datestamp = "1198239021" - +core = 6.x diff -Nup privatemsg/privatemsg.install privatemsg_new/privatemsg.install --- privatemsg/privatemsg.install 2007-10-28 11:25:23.000000000 +0100 +++ privatemsg_new/privatemsg.install 2008-01-12 17:26:53.000000000 +0100 @@ -1,291 +1,85 @@ 1, + 'uid' => 0, + 'name' => 'Sent', + ); + drupal_write_record('privatemsg_folder', $data); } function privatemsg_uninstall() { - db_query("DROP TABLE {privatemsg}"); - db_query("DROP TABLE {privatemsg_folder}"); - db_query("DROP TABLE {privatemsg_archive}"); - if (db_table_exists('privatemsg_block_user')) { - db_query("DROP TABLE {privatemsg_block_user}"); - } - - // The following two tables are now a part of the pm_subscriptions module, - // but have been retained to handle updated installs that do not use the - // pm_subscriptions module. - if (db_table_exists('privatemsg_mails')) { - db_query("DROP TABLE {privatemsg_mails}"); - } - if (db_table_exists('privatemsg_mail_edit')) { - db_query("DROP TABLE {privatemsg_mail_edit}"); - } - - db_query("DELETE FROM {variable} WHERE name LIKE 'privatemsg_%'"); - cache_clear_all('variables', 'cache'); -} - -/* Upgrade on mysql from versions before 22-May-2003: - Create privatemsg_archive/privatemsg_folder tables and insert one row, shown above^ - ALTER TABLE privatemsg ADD folder int unsigned NOT NULL; - ALTER TABLE privatemsg ADD author_del tinyint unsigned NOT NULL; - ALTER TABLE privatemsg ADD recipient_del tinyint unsigned NOT NULL; - ALTER TABLE privatemsg ADD INDEX(folder); - ALTER TABLE privatemsg CHANGE hostname hostname varchar(255) NOT NULL; - Continue with steps below, but skip ALTER line for privatemsg_archive.. - * - * Upgrade on mysql from versions before 29-Apr-2005: - ALTER TABLE privatemsg CHANGE new newmsg tinyint UNSIGNED NOT NULL; - ALTER TABLE privatemsg ADD format int NOT NULL DEFAULT '0'; - ALTER TABLE privatemsg_archive ADD format int NOT NULL DEFAULT '0'; - UPDATE privatemsg SET format=1; - UPDATE privatemsg_archive SET format=1; - */ - -function privatemsg_update_1() { - return _system_update_utf8(array('privatemsg', 'privatemsg_archive', 'privatemsg_folder')); -} - -function privatemsg_update_2() { - $ret = array(); - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - $sql = 'ALTER TABLE {%s} MODIFY %s int unsigned NOT NULL'; - $seq = "INSERT INTO {sequences} (name, id) VALUES ('%s', %d)"; - break; - case 'pgsql': - $sql = 'ALTER TABLE {%s} ALTER COLUMN %s SET DEFAULT NULL'; - $seq = 'CREATE SEQUENCE %s_seq INCREMENT 1 START %d'; - break; - default: - return $ret; - } - foreach (array('privatemsg' => 'id', 'privatemsg_folder' => 'fid') as $table => $id) { - $ret[] = update_sql(sprintf($sql, $table, $id)); - $max = db_result(db_query('SELECT max('. $id .') FROM {'. $table .'}')); - if ($table == 'privatemsg') { - $max = max($max, db_result(db_query('SELECT max(id) FROM {privatemsg_archive}'))); - } - $ret[] = update_sql(sprintf($seq, '{'. $table .'}_'. $id, $max)); - } - $ret[] = update_sql(sprintf($sql, 'privatemsg_archive', 'id')); - return $ret; + // Drop tables. + drupal_uninstall_schema('privatemsg'); } -function privatemsg_update_3() { - $ret = array(); - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - $ret[] = update_sql('ALTER TABLE {privatemsg} ADD thread int NOT NULL'); - $ret[] = update_sql('ALTER TABLE {privatemsg_archive} ADD thread int NOT NULL'); - break; - case 'pgsql': - foreach (array('privatemsg', 'privatemsg_archive') as $table) { - $ret[] = update_sql("ALTER TABLE {$table} ADD thread int"); - $ret[] = update_sql("ALTER TABLE {$table} ALTER COLUMN thread SET DEFAULT 0"); - $ret[] = update_sql("UPDATE {$table} SET thread = 0"); - $ret[] = update_sql("ALTER TABLE {$table} ALTER COLUMN thread SET NOT NULL"); - } - break; - } - return $ret; -} - -function privatemsg_update_4() { - $ret = array(); - - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - $ret[] = update_sql("ALTER TABLE {privatemsg} ADD type varchar(255) NOT NULL default '', ADD KEY (type)"); - $ret[] = update_sql("ALTER TABLE {privatemsg} CHANGE subject subject varchar(255) NOT NULL default ''"); - if (!db_table_exists('privatemsg_block_user')) { - $ret[] = update_sql('CREATE TABLE {privatemsg_block_user} ( - author int unsigned NOT NULL, - recipient int unsigned NOT NULL, - PRIMARY KEY (author, recipient) - ) /*!40100 DEFAULT CHARACTER SET utf8 */'); - } - break; - case 'pgsql': - db_add_column($ret, 'privatemsg', 'type', 'varchar(255)', array('not null' => TRUE, 'default' => "''")); - $ret[] = update_sql("CREATE INDEX {privatemsg_folder_type} ON {privatemsg}(type)"); - db_change_column($ret, 'privatemsg', 'subject', 'subject', 'varchar(255)', array('not null' => TRUE, 'default' => "''")); - if (!db_table_exists('privatemsg_block_user')) { - $ret[] = update_sql('CREATE TABLE {privatemsg_block_user} ( - author int unsigned NOT NULL, - recipient int unsigned NOT NULL, - PRIMARY KEY (author, recipient) - )'); - } - break; - } - - return $ret; -} - -/** - * Add variables column for use by the subscriptions module. - */ -function privatemsg_update_5() { - $ret = array(); - - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - $ret[] = update_sql("ALTER TABLE {privatemsg} ADD variables longtext"); - break; - case 'pgsql': - db_add_column($ret, 'privatemsg', 'variables', 'text'); - break; - } - - return $ret; +function privatemsg_schema() { + $schema['privatemsg'] = array( + 'fields' => array( + 'id' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), + 'author' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'recipient' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'subject' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + 'message' => array('type' => 'text'), + 'timestamp' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'newmsg' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny'), + 'hostname' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + 'folder' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'author_del' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny', 'default' => 0), + 'recipient_del' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny', 'default' => 0), + 'format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'thread' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'type' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + 'variables' => array('type' => 'text', 'size' => 'big'), + ), + 'indexes' => array ( + 'recipient' => array('recipient'), + 'folder' => array('folder'), + 'type' => array('type'), + 'author' => array('author'), + ), + 'primary key' => array ('id'), + ); + + $schema['privatemsg_folder'] = array( + 'fields' => array( + 'fid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), + 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + ), + 'primary key' => array('fid'), + ); + + $schema['privatemsg_archive'] = array( + 'fields' => array( + 'id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'author' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'recipient' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'subject' => array('type' => 'varchar', 'length' => 64, 'not null' => TRUE), + 'message' => array('type' => 'text', 'not null' => TRUE), + 'timestamp' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'hostname' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + 'folder' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'format' => array('type' => 'int', 'default' => 0, 'not null' => TRUE), + 'thread' => array('type' => 'int', 'default' => 0, 'not null' => TRUE), + ), + 'indexes' => array( + 'recipient' => array('recipient'), + ), + 'primary key' => array('id'), + ); + + $schema['privatemsg_block_user'] = array( + 'fields' => array( + 'author' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + 'recipient' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), + ), + 'primary key' => array('author', 'recipient'), + ); + + return $schema; } diff -Nup privatemsg/privatemsg.module privatemsg_new/privatemsg.module --- privatemsg/privatemsg.module 2007-12-21 10:00:40.000000000 +0100 +++ privatemsg_new/privatemsg.module 2008-02-05 20:52:36.000000000 +0100 @@ -1,5 +1,5 @@ '. t('The private messaging module allows users to send messages to each other without having to share email addresses. An inbox link will appear in the navigation menu. The "write to author" links are included in posts, allowing users to write a private message instead of commenting openly. Allowing users to communicate directly is an important part of building the strength of the community.') .'

'; + $output = '

'. t('The private messaging module allows users to send messages to each other without having to share email addresses. An inbox link will appear in the navigation menu. The "write to author" links are included in posts, allowing users to write a private message instead of commenting openly. Allowing users to communicate directly is an important part of building the strength of the community.') .'

'; $output .= '

'. t('The contacts list contains only users that you have previously messaged. To contact users not in your list, you need to know their local user name. Administrators can set messaging options such as frequency of emails, message status display, and number of messages to display per page. They can also configure \'Write to Author\' options.') .'

'; $output .= t('

You can