From c8c87fc6030cacd6591098b8f5ab69e3a824babe Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 31 Aug 2009 10:59:50 +1200 Subject: [PATCH 01/14] some typoes in comments that annoyed me, fixed now --- lib/twitteroauthclient.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/twitteroauthclient.php b/lib/twitteroauthclient.php index e37fa05f0a..bad2b74ca3 100644 --- a/lib/twitteroauthclient.php +++ b/lib/twitteroauthclient.php @@ -118,7 +118,7 @@ class TwitterOAuthClient extends OAuthClient } /** - * Calls Twitter's /stutuses/update API method + * Calls Twitter's /statuses/update API method * * @param string $status text of the status * @param int $in_reply_to_status_id optional id of the status it's @@ -137,7 +137,7 @@ class TwitterOAuthClient extends OAuthClient } /** - * Calls Twitter's /stutuses/friends_timeline API method + * Calls Twitter's /statuses/friends_timeline API method * * @param int $since_id show statuses after this id * @param int $max_id show statuses before this id @@ -167,7 +167,7 @@ class TwitterOAuthClient extends OAuthClient } /** - * Calls Twitter's /stutuses/friends API method + * Calls Twitter's /statuses/friends API method * * @param int $id id of the user whom you wish to see friends of * @param int $user_id numerical user id @@ -197,7 +197,7 @@ class TwitterOAuthClient extends OAuthClient } /** - * Calls Twitter's /stutuses/friends/ids API method + * Calls Twitter's /statuses/friends/ids API method * * @param int $id id of the user whom you wish to see friends of * @param int $user_id numerical user id From d46f2ee350b9bf2c70371f7bcd2f2793e7ed8110 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 11 Aug 2009 09:24:18 +1200 Subject: [PATCH 02/14] upgrade script for postgres --- db/08to09_pg.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/08to09_pg.sql diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql new file mode 100644 index 0000000000..892df4a39f --- /dev/null +++ b/db/08to09_pg.sql @@ -0,0 +1,2 @@ +// SQL commands to update an 0.8.x version of Laconica +// to 0.9.x. From e9edb803bc66028204defcfa659cccbf23da97c6 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 31 Aug 2009 11:53:59 +1200 Subject: [PATCH 03/14] added missing parts to postgres update, and the config+user_role tables to both upgrade scripts Conflicts: db/08to09.sql --- db/08to09.sql | 34 ++++++++++++++++++++++++++++++++++ db/08to09_pg.sql | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 db/08to09.sql diff --git a/db/08to09.sql b/db/08to09.sql new file mode 100644 index 0000000000..953e0e5f48 --- /dev/null +++ b/db/08to09.sql @@ -0,0 +1,34 @@ +alter table notice + modify column content text comment 'update content'; + +alter table message + modify column content text comment 'message content'; + +alter table profile + modify column bio text comment 'descriptive biography'; + +alter table user_group + modify column description text comment 'group description'; + +alter table file_oembed + add column mimetype varchar(50) comment 'mime type of resource'; + +create table config ( + + section varchar(32) comment 'configuration section', + setting varchar(32) comment 'configuration setting', + value varchar(255) comment 'configuration value', + + constraint primary key (section, setting) + +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +create table user_role ( + + user_id integer not null comment 'user having the role' references user (id), + role varchar(32) not null comment 'string representing the role', + created datetime not null comment 'date the role was granted', + + constraint primary key (user_id, role) + +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 892df4a39f..492b3ebb91 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -1,2 +1,40 @@ // SQL commands to update an 0.8.x version of Laconica // to 0.9.x. + +--these are just comments +/* +alter table notice + modify column content text comment 'update content'; + +alter table message + modify column content text comment 'message content'; + +alter table profile + modify column bio text comment 'descriptive biography'; + +alter table user_group + modify column description text comment 'group description'; +*/ + +alter table file_oembed + add column mimetype varchar(50) /*comment 'mime type of resource'*/; + +create table config ( + + section varchar(32) /* comment 'configuration section'*/, + setting varchar(32) /* comment 'configuration setting'*/, + value varchar(255) /* comment 'configuration value'*/, + + primary key (section, setting) + +); + +create table user_role ( + + user_id integer not null /* comment 'user having the role'*/ references "user" (id), + role varchar(32) not null /* comment 'string representing the role'*/, + created timestamp /* not null comment 'date the role was granted'*/, + + primary key (user_id, role) + +); \ No newline at end of file From 6704ddddf227865de43c1fdd846b68f76f723fe6 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 31 Aug 2009 11:01:01 +1200 Subject: [PATCH 04/14] fixed up some invalid comment syntax - this is ANSI SQL --- db/08to09_pg.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 492b3ebb91..9e37314aa8 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -1,5 +1,5 @@ -// SQL commands to update an 0.8.x version of Laconica -// to 0.9.x. +-- SQL commands to update an 0.8.x version of Laconica +-- to 0.9.x. --these are just comments /* @@ -37,4 +37,4 @@ create table user_role ( primary key (user_id, role) -); \ No newline at end of file +); From ddc95559215142e806428716772cb0edff206ecb Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 1 Sep 2009 19:00:18 +0000 Subject: [PATCH 05/14] Stop requeuing notices not bound for Twitter. --- lib/twitter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/twitter.php b/lib/twitter.php index b734d22d8e..e049dc8df0 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -160,6 +160,8 @@ function broadcast_twitter($notice) return broadcast_basicauth($notice, $flink); } } + + return true; } function broadcast_oauth($notice, $flink) { From 6adc50b97fb6d7b5dfd70321281f041f2f579461 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 29 Aug 2009 06:20:19 +0000 Subject: [PATCH 06/14] Fix error in log msg format specifier --- lib/twitter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/twitter.php b/lib/twitter.php index e049dc8df0..455f7e7ef0 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -196,7 +196,7 @@ function broadcast_oauth($notice, $flink) { $errmsg = sprintf('cURL error trying to send notice to Twitter ' . 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: $4$s.', + 'code: %3$s message: %4$s.', $user->nickname, $user->id, $e->getCode(), $e->getMessage()); common_log(LOG_WARNING, $errmsg); @@ -254,7 +254,7 @@ function broadcast_basicauth($notice, $flink) $errmsg = sprintf('cURL error trying to send notice to Twitter ' . 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: $4$s.', + 'code: %3$s message: %4$s.', $user->nickname, $user->id, $e->getCode(), $e->getMessage()); common_log(LOG_WARNING, $errmsg); From 78f367b23962ce1091807d7ed3eeed5f18a1475b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 2 Sep 2009 00:24:30 +0000 Subject: [PATCH 07/14] Fixed bug in which you cannot turn off importing friends timelines flag --- actions/twittersettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/twittersettings.php b/actions/twittersettings.php index 563d867a49..89169941eb 100644 --- a/actions/twittersettings.php +++ b/actions/twittersettings.php @@ -165,7 +165,7 @@ class TwittersettingsAction extends ConnectSettingsAction ($flink->noticesync & FOREIGN_NOTICE_RECV) : false); $this->elementEnd('li'); - + } else { // preserve setting even if bidrection bridge toggled off if ($flink && ($flink->noticesync & FOREIGN_NOTICE_RECV)) { From f049d669d95128741f9cb7b1604b758df0550360 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 2 Sep 2009 00:50:41 +0000 Subject: [PATCH 08/14] Better error handling --- lib/twitter.php | 100 ++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 58 deletions(-) diff --git a/lib/twitter.php b/lib/twitter.php index 455f7e7ef0..676c9b20a2 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -175,34 +175,7 @@ function broadcast_oauth($notice, $flink) { try { $status = $client->statusesUpdate($statustxt); } catch (OAuthClientCurlException $e) { - - if ($e->getMessage() == 'The requested URL returned error: 401') { - - $errmsg = sprintf('User %1$s (user id: %2$s) has an invalid ' . - 'Twitter OAuth access token.', - $user->nickname, $user->id); - common_log(LOG_WARNING, $errmsg); - - // Bad auth token! We need to delete the foreign_link - // to Twitter and inform the user. - - remove_twitter_link($flink); - return true; - - } else { - - // Some other error happened, so we should probably - // try to send again later. - - $errmsg = sprintf('cURL error trying to send notice to Twitter ' . - 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: %4$s.', - $user->nickname, $user->id, - $e->getCode(), $e->getMessage()); - common_log(LOG_WARNING, $errmsg); - - return false; - } + return process_error($e, $flink); } if (empty($status)) { @@ -210,9 +183,9 @@ function broadcast_oauth($notice, $flink) { // This could represent a failure posting, // or the Twitter API might just be behaving flakey. - $errmsg = sprintf('No data returned by Twitter API when ' . - 'trying to send update for %1$s (user id %2$s).', - $user->nickname, $user->id); + $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . + 'trying to send update for %1$s (user id %2$s).', + $user->nickname, $user->id); common_log(LOG_WARNING, $errmsg); return false; @@ -220,7 +193,7 @@ function broadcast_oauth($notice, $flink) { // Notice crossed the great divide - $msg = sprintf('Twitter bridge posted notice %s to Twitter using OAuth.', + $msg = sprintf('Twitter bridge - posted notice %s to Twitter using OAuth.', $notice->id); common_log(LOG_INFO, $msg); @@ -239,46 +212,57 @@ function broadcast_basicauth($notice, $flink) try { $status = $client->statusesUpdate($statustxt); } catch (BasicAuthCurlException $e) { - - if ($e->getMessage() == 'The requested URL returned error: 401') { - - $errmsg = sprintf('User %1$s (user id: %2$s) has an invalid ' . - 'Twitter screen_name/password combo.', - $user->nickname, $user->id); - common_log(LOG_WARNING, $errmsg); - - remove_twitter_link($flink); - return true; - - } else { - - $errmsg = sprintf('cURL error trying to send notice to Twitter ' . - 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: %4$s.', - $user->nickname, $user->id, - $e->getCode(), $e->getMessage()); - common_log(LOG_WARNING, $errmsg); - - return false; - } + return process_error($e, $flink); } if (empty($status)) { - $errmsg = sprintf('No data returned by Twitter API when ' . - 'trying to send update for %1$s (user id %2$s).', - $user->nickname, $user->id); + $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . + 'trying to send update for %1$s (user id %2$s).', + $user->nickname, $user->id); common_log(LOG_WARNING, $errmsg); return false; } - $msg = sprintf('Twitter bridge posted notice %s to Twitter using basic auth.', + $msg = sprintf('Twitter bridge - posted notice %s to Twitter using basic auth.', $notice->id); common_log(LOG_INFO, $msg); return true; +} +function process_error($e, $flink) +{ + $user = $flink->getUser(); + $errmsg = $e->getMessage(); + $delivered = false; + + switch($errmsg) { + case 'The requested URL returned error: 401': + $logmsg = sprintf('Twiter bridge - User %1$s (user id: %2$s) has an invalid ' . + 'Twitter screen_name/password combo or an invalid acesss token.', + $user->nickname, $user->id); + $delivered = true; + remove_twitter_link($flink); + break; + case 'The requested URL returned error: 403': + $logmsg = sprintf('Twitter bridge - User %1$s (user id: %2$s) has exceeded ' . + 'his/her Twitter request limit.', + $user->nickname, $user->id); + break; + default: + $logmsg = sprintf('Twitter bridge - cURL error trying to send notice to Twitter ' . + 'for user %1$s (user id: %2$s) - ' . + 'code: %3$s message: %4$s.', + $user->nickname, $user->id, + $e->getCode(), $e->getMessage()); + break; + } + + common_log(LOG_WARNING, $logmsg); + + return $delivered; } function format_status($notice) From acf2b19463d1a03b52f7db81eaade5eb9ebab662 Mon Sep 17 00:00:00 2001 From: Eric Helgeson Date: Mon, 19 Oct 2009 12:52:25 -0400 Subject: [PATCH 09/14] Ignoring Sent from my* line in mail (iPhone/Pre) --- scripts/maildaemon.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php index 11911dcbdc..678ca24c31 100755 --- a/scripts/maildaemon.php +++ b/scripts/maildaemon.php @@ -362,6 +362,10 @@ class MailerDaemon if (preg_match('/^\s*Sent via/', $line)) { continue; } + if (preg_match('/^\s*Sent from my/', $line)) { + continue; + } + // skip everything after a sig if (preg_match('/^\s*--+\s*$/', $line) || preg_match('/^\s*__+\s*$/', $line)) From 9d0e37c4e847f312c39eaf15deb95ff3777c13a6 Mon Sep 17 00:00:00 2001 From: Eric Helgeson Date: Mon, 19 Oct 2009 13:11:55 -0400 Subject: [PATCH 10/14] Utilize NICKNAME_FMT constant when creating at replies --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 9b299cb14f..047faeef0d 100644 --- a/lib/util.php +++ b/lib/util.php @@ -391,7 +391,7 @@ function common_render_content($text, $notice) { $r = common_render_text($text); $id = $notice->profile_id; - $r = preg_replace('/(^|\s+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r); + $r = preg_replace('/(^|\s+)@(['.NICKNAME_FMT.']{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r); $r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, '\\1').' '", $r); $r = preg_replace('/(^|\s+)@#([A-Za-z0-9]{1,64})/e', "'\\1@#'.common_at_hash_link($id, '\\2')", $r); $r = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/e', "'\\1!'.common_group_link($id, '\\2')", $r); From 728a146ec04acc853c4fd32a44fef6adbee517c2 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 19 Oct 2009 17:30:08 -0400 Subject: [PATCH 11/14] new codename for 0.8.2 --- README | 2 +- lib/common.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index 7562199811..c98090b4be 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ README ------ -StatusNet 0.8.1 ("Second Guessing") +StatusNet 0.8.2 ("Life and How to Live It") 26 Aug 2009 This is the README file for StatusNet (formerly Laconica), the Open diff --git a/lib/common.php b/lib/common.php index 0b4e031845..3de567cd93 100644 --- a/lib/common.php +++ b/lib/common.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } define('STATUSNET_VERSION', '0.8.2dev'); define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility -define('STATUSNET_CODENAME', 'Second Guessing'); +define('STATUSNET_CODENAME', 'Life and How to Live It'); define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); From c0eca0e59b1b9bb74d4457348d1e310e18cc082f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 19 Oct 2009 18:07:03 -0400 Subject: [PATCH 12/14] Revert "fixed up some invalid comment syntax - this is ANSI SQL" This reverts commit 6704ddddf227865de43c1fdd846b68f76f723fe6. --- db/08to09_pg.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 9e37314aa8..492b3ebb91 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -1,5 +1,5 @@ --- SQL commands to update an 0.8.x version of Laconica --- to 0.9.x. +// SQL commands to update an 0.8.x version of Laconica +// to 0.9.x. --these are just comments /* @@ -37,4 +37,4 @@ create table user_role ( primary key (user_id, role) -); +); \ No newline at end of file From 689b3ae73d83495774fa3ec500527ecb3edab1a1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 19 Oct 2009 18:07:19 -0400 Subject: [PATCH 13/14] Revert "added missing parts to postgres update, and the config+user_role tables to both upgrade scripts" This reverts commit e9edb803bc66028204defcfa659cccbf23da97c6. --- db/08to09.sql | 34 ---------------------------------- db/08to09_pg.sql | 38 -------------------------------------- 2 files changed, 72 deletions(-) delete mode 100644 db/08to09.sql diff --git a/db/08to09.sql b/db/08to09.sql deleted file mode 100644 index 953e0e5f48..0000000000 --- a/db/08to09.sql +++ /dev/null @@ -1,34 +0,0 @@ -alter table notice - modify column content text comment 'update content'; - -alter table message - modify column content text comment 'message content'; - -alter table profile - modify column bio text comment 'descriptive biography'; - -alter table user_group - modify column description text comment 'group description'; - -alter table file_oembed - add column mimetype varchar(50) comment 'mime type of resource'; - -create table config ( - - section varchar(32) comment 'configuration section', - setting varchar(32) comment 'configuration setting', - value varchar(255) comment 'configuration value', - - constraint primary key (section, setting) - -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - -create table user_role ( - - user_id integer not null comment 'user having the role' references user (id), - role varchar(32) not null comment 'string representing the role', - created datetime not null comment 'date the role was granted', - - constraint primary key (user_id, role) - -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 492b3ebb91..892df4a39f 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -1,40 +1,2 @@ // SQL commands to update an 0.8.x version of Laconica // to 0.9.x. - ---these are just comments -/* -alter table notice - modify column content text comment 'update content'; - -alter table message - modify column content text comment 'message content'; - -alter table profile - modify column bio text comment 'descriptive biography'; - -alter table user_group - modify column description text comment 'group description'; -*/ - -alter table file_oembed - add column mimetype varchar(50) /*comment 'mime type of resource'*/; - -create table config ( - - section varchar(32) /* comment 'configuration section'*/, - setting varchar(32) /* comment 'configuration setting'*/, - value varchar(255) /* comment 'configuration value'*/, - - primary key (section, setting) - -); - -create table user_role ( - - user_id integer not null /* comment 'user having the role'*/ references "user" (id), - role varchar(32) not null /* comment 'string representing the role'*/, - created timestamp /* not null comment 'date the role was granted'*/, - - primary key (user_id, role) - -); \ No newline at end of file From d72748eb8e71f81e7cddca610ec98a8910dd347f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 19 Oct 2009 18:07:36 -0400 Subject: [PATCH 14/14] Revert "upgrade script for postgres" This reverts commit d46f2ee350b9bf2c70371f7bcd2f2793e7ed8110. --- db/08to09_pg.sql | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 db/08to09_pg.sql diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql deleted file mode 100644 index 892df4a39f..0000000000 --- a/db/08to09_pg.sql +++ /dev/null @@ -1,2 +0,0 @@ -// SQL commands to update an 0.8.x version of Laconica -// to 0.9.x.