diff --git a/lib/activitystreamjsondocument.php b/lib/activitystreamjsondocument.php index 9964f1e60c..ed3197bc7f 100644 --- a/lib/activitystreamjsondocument.php +++ b/lib/activitystreamjsondocument.php @@ -165,7 +165,7 @@ class ActivityStreamJSONDocument extends JSONActivityCollection */ function asString() { - $this->doc['generator'] = 'StatusNet ' . STATUSNET_VERSION; // extension + $this->doc['generator'] = 'GNU social ' . GNUSOCIAL_VERSION; // extension $this->doc['title'] = $this->title; $this->doc['url'] = $this->url; $this->doc['totalItems'] = $this->count; diff --git a/lib/httpclient.php b/lib/httpclient.php index 0c249a518f..c7abe12116 100644 --- a/lib/httpclient.php +++ b/lib/httpclient.php @@ -158,7 +158,7 @@ class HTTPClient extends HTTP_Request2 } parent::__construct($url, $method, $config); - $this->setHeader('User-Agent', $this->userAgent()); + $this->setHeader('User-Agent', self::userAgent()); } /** @@ -247,9 +247,10 @@ class HTTPClient extends HTTP_Request2 * * @return string */ - function userAgent() + static public function userAgent() { - return "GNU Social/".GNUSOCIAL_VERSION." (".GNUSOCIAL_CODENAME.")"; + return GNUSOCIAL_ENGINE . '/' . GNUSOCIAL_VERSION + . ' (' . GNUSOCIAL_CODENAME . ')'; } /** diff --git a/lib/ping.php b/lib/ping.php index 4d370593cc..14639d76d2 100644 --- a/lib/ping.php +++ b/lib/ping.php @@ -90,11 +90,11 @@ function ping_broadcast_notice($notice) { if ($type === 'get') { $result = $fetcher->get($notify_url . '?' . http_build_query($args), - array('User-Agent: StatusNet/'.STATUSNET_VERSION)); + array('User-Agent: ' . HTTPClient::userAgent())); } else { $result = $fetcher->post($notify_url, http_build_query($args), - array('User-Agent: StatusNet/'.STATUSNET_VERSION)); + array('User-Agent: ' . HTTPClient::userAgent())); } if ($result->status != '200') { common_log(LOG_WARNING, diff --git a/lib/plugin.php b/lib/plugin.php index 80a3e96207..605a4d12b5 100644 --- a/lib/plugin.php +++ b/lib/plugin.php @@ -158,12 +158,22 @@ class Plugin $this->log(LOG_DEBUG, $msg); } - function name() + public function name() { $cls = get_class($this); return mb_substr($cls, 0, -6); } + public function version() + { + return GNUSOCIAL_VERSION; + } + + protected function userAgent() { + return HTTPClient::userAgent() + . ' (' . get_class($this) . ' v' . $this->version() . ')'; + } + function onPluginVersion(&$versions) { $name = $this->name(); diff --git a/plugins/BlogspamNet/BlogspamNetPlugin.php b/plugins/BlogspamNet/BlogspamNetPlugin.php index edb9406d9a..f4de0d6c88 100644 --- a/plugins/BlogspamNet/BlogspamNetPlugin.php +++ b/plugins/BlogspamNet/BlogspamNetPlugin.php @@ -143,9 +143,9 @@ class BlogspamNetPlugin extends Plugin return '127.0.0.1'; } - function userAgent() + function version() { - return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION; + return BLOGSPAMNETPLUGIN_VERSION; } function onPluginVersion(&$versions) diff --git a/plugins/Linkback/LinkbackPlugin.php b/plugins/Linkback/LinkbackPlugin.php index 5cc4aadb05..337cfdedfa 100644 --- a/plugins/Linkback/LinkbackPlugin.php +++ b/plugins/Linkback/LinkbackPlugin.php @@ -227,10 +227,9 @@ class LinkbackPlugin extends Plugin } } - function userAgent() + public function version() { - return 'LinkbackPlugin/'.LINKBACKPLUGIN_VERSION . - ' StatusNet/' . STATUSNET_VERSION; + return LINKBACKPLUGIN_VERSION; } function onPluginVersion(&$versions) diff --git a/plugins/Spotify/SpotifyPlugin.php b/plugins/Spotify/SpotifyPlugin.php index 6d4e645629..5877694e0f 100644 --- a/plugins/Spotify/SpotifyPlugin.php +++ b/plugins/Spotify/SpotifyPlugin.php @@ -67,12 +67,6 @@ class SpotifyPlugin extends Plugin return true; } - function userAgent() - { - return 'SpotifyPlugin/'.SPOTIFYPLUGIN_VERSION . - ' StatusNet/' . STATUSNET_VERSION; - } - function onPluginVersion(&$versions) { $versions[] = array('name' => 'Spotify', diff --git a/plugins/TwitterBridge/lib/jsonstreamreader.php b/plugins/TwitterBridge/lib/jsonstreamreader.php index d5852c93e3..f6ec1f3f50 100644 --- a/plugins/TwitterBridge/lib/jsonstreamreader.php +++ b/plugins/TwitterBridge/lib/jsonstreamreader.php @@ -129,7 +129,7 @@ abstract class JsonStreamReader $lines = array( "GET $path HTTP/1.1", "Host: $host", - "User-Agent: StatusNet/" . STATUSNET_VERSION . " (TwitterBridgePlugin)", + 'User-Agent: ' . HTTPClient::userAgent() . ' (TwitterBridgePlugin)', "Connection: close", "", ""