diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..6e546c13 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +ROOT=$(realpath $(dirname $0)); + + +# Uninstall +sudo find /{usr,etc,var} -type d -name '*hotot*' -exec rm -fr {} \; +sudo find /{usr,etc,var} -type f -name '*hotot*' -exec rm -f {} \; + +rm -fr build && mkdir build && cd build + +cmake -DPYTHON_EXECUTABLE=/usr/bin/python2 -DWITH_GIR=off -DWITH_QT=off -DWITH_KDE=off -DWITH_CHROME=off -DWITH_GTK3=off -DWITH_GTK2=on -DWITH_GTK=off .. +make +sudo make install + +hotot diff --git a/data/js/lib.twitter.js b/data/js/lib.twitter.js index 82735b3a..3096cc18 100644 --- a/data/js/lib.twitter.js +++ b/data/js/lib.twitter.js @@ -893,10 +893,13 @@ function TwitterClient() { newText = interrupted_response + newText; interrupted_response = '' - var lines = newText.split(/[\n\r]/g); + var lines = newText.split(/[\n\r]/g), + ret for (var i = 0; i < lines.length; i += 1) { var line = lines[i].split(/({[^\0]+})/gm); for (var j = 0; j < line.length; j += 1) { + ret = null + if (!empty_tester.test(line[j])) { try { ret = JSON.parse(line[j]); @@ -911,7 +914,9 @@ function TwitterClient() { //return; } try { - callback(ret); + if(ret) { + callback(ret) + } } catch(e) { console.log('Streams callback: ' + e.message + '\n' + line); return; diff --git a/data/js/ui.main.js b/data/js/ui.main.js index 5316a8dc..ee9b68bd 100644 --- a/data/js/ui.main.js +++ b/data/js/ui.main.js @@ -165,6 +165,26 @@ function loadmore_messages(self, success, fail) { success); }, +getDisplayName: +function getDisplayName(user) { + const + displayName = '@' + user.screen_name, + + sanitize = function(text) { + return text.replace(/[^a-z0-9_]/i, '').toLowerCase() + } + + if(user.hasOwnProperty('name')) { + if(sanitize(user.name) === sanitize(user.screen_name)) { + return user.name + } + + return user.name + ' (' + displayName + ')' + } + + return displayName +}, + load_tweet_success: function load_tweet_success(self, json) { var ret = ui.Main.add_tweets(self, json, false); @@ -188,7 +208,8 @@ function load_tweet_success(self, json) { if (user.screen_name == globals.myself.screen_name) continue; text = json[i].text; - hotot_notify(user.screen_name, text, user.profile_image_url , 'content'); + + hotot_notify(ui.Main.getDisplayName(user), text, user.profile_image_url , 'content'); notify_count += 1; } if (3 < notify_count) { diff --git a/data/js/ui.template.js b/data/js/ui.template.js index f04cc347..22736e52 100644 --- a/data/js/ui.template.js +++ b/data/js/ui.template.js @@ -44,7 +44,7 @@ tweet_t: