チェンジセット 2589

差分発生行の前後
無視リスト:
コミット日時:
2009/05/08 18:41:03 (3 年前)
コミッタ:
uwi
ログメッセージ:

protectedのreplyをとったときの挙動のデバッグ
インクリメンタルフィルタのデバッグ
多段タブのリサイズ時の動作のデバッグ
SQLクエリ作成の見直し
ログイン方法の変更(微高速化)
リンク解決の一般化
favタブの暗黙的追加
終了時ログアウトするように
Twitterの新UIに対応(日本語だけ)

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • air/TLife/trunk/bin/doc/readme.html

    r2531 r2589  
    99                <h1>TLife説明書</h1> 
    1010 
     11                <h2>操作説明</h2> 
     12                <ul> 
     13                        <li><a href="sub/main.html">メイン画面</a></li> 
     14                        <li><a href="sub/tabconfig.html">タブ設定画面</a></li> 
     15                        <li><a href="sub/globalconfig.html">全体設定画面</a></li> 
     16                        <li><a href="sub/mania.html">もっと凝った設定がしたい方へ</a></li> 
     17                </ul> 
     18                 
    1119                <h2>ソフト名</h2> 
    1220                <p>TLife</p> 
     
    2028                <h2>更新履歴</h2> 
    2129                <dl> 
    22                         <dt>2009年4月25日 ver 0.1</dt> 
     30                        <dt>2009年4月25日 ver &alpha;</dt> 
    2331                        <dd>&alpha; リリース</dd> 
    2432                </dl> 
    2533        </body> 
    2634</html> 
     35 
  • air/TLife/trunk/src/Main.mxml

    r2546 r2589  
    116116                                Logger.errorLevel = Logger.INFO; 
    117117                                Logger.dumpLimDepth = 999; 
    118                               Logger.logging = new FilePutLogging(CommonData.FILE_LOG); 
    119 //                            Logger.logging = new TraceLogging(); 
     118//                            Logger.logging = new FilePutLogging(CommonData.FILE_LOG); 
     119                              Logger.logging = new TraceLogging(); 
    120120 
    121121                                postarea.text = ""; 
     
    425425         
    426426        <mx:VBox id="vbox0" x="0" y="0" width="100%" height="100%" verticalGap="0" verticalScrollPolicy="off"> 
    427                 <mx:VDividedBox id="vdbox00" width="100%" height="100%" dividerThickness="2"
     427                <mx:VDividedBox id="vdbox00" width="100%" height="100%" dividerThickness="2" horizontalScrollPolicy="off"
    428428                        <mx:VBox id="vbox000" width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" verticalGap="0"> 
    429429                                <uwi:DataGridEx id="datagrid" width="100%" height="100%" dataProvider="{timeline}" 
  • air/TLife/trunk/src/uwi/search/Searcher.as

    r2546 r2589  
    188188                                        postid : -1, 
    189189                                        newestid : -1, 
    190                                         rule : " where " + conds.join(" and "), 
     190                                        rule : conds.join(" and "), 
    191191                                        type : 1, 
    192192                                        unread : {}, 
  • air/TLife/trunk/src/uwi/thread/InitialMovementThread.as

    r2533 r2589  
    77        import org.libspark.thread.utils.SerialExecutor; 
    88        import uwi.twitter.TwitterLoginThread; 
     9        import uwi.twitter.TwitterMobileLoginThread; 
    910        import uwi.util.CommonData; 
    1011        import uwi.util.TimerThread; 
     
    2425                } 
    2526                 
    26                 private var tlt : TwitterLoginThread = null; 
     27                private var tlt : TwitterMobileLoginThread = null; 
    2728                 
    2829                protected override function finalize() : void 
     
    3031                        tlt = null; 
    3132                } 
     33                 
     34                private var s : int; 
    3235                 
    3336                protected override function run() : void 
     
    4750                        URLRequestDefaults.setLoginCredentialsForHost("twitter.com", CommonData.configxml.login.userid, password); 
    4851                         
    49                         tlt = new TwitterLoginThread(CommonData.configxml.login.userid, password); 
     52                        s = getTimer(); 
     53                        tlt = new TwitterMobileLoginThread(CommonData.configxml.login.userid, password); 
    5054                        CommonData.state = 10; 
    5155                        tlt.start(); 
     
    5660                private function onLogin() : void 
    5761                { 
     62                        var t : int = getTimer(); 
     63                        trace((t - s) + "ms"); 
    5864                        if (tlt.result == 0) { 
    5965                                // ログイン成功時 
  • air/TLife/trunk/src/uwi/thread/LinkResolveThread.as

    r2546 r2589  
    55        import org.libspark.thread.Thread; 
    66        import org.libspark.thread.utils.ParallelExecutor; 
     7        import uwi.shortening.URLExpandThread; 
    78        import uwi.util.CommonData; 
    89        import uwi.util.StringUtility; 
     
    1415        public class LinkResolveThread extends Thread 
    1516        { 
    16                 private static const PREFIX_TINYURL : String = "http://tinyurl.com/"; 
    1717                 
    1818                private var src : String; 
     
    6363                                var href : String = StringUtility.pinch(inner, "href=\"", "\""); 
    6464                                var text : String = inner.substr(inner.indexOf(">") + 1); 
    65                                 if (href.substring(0, PREFIX_TINYURL.length) == PREFIX_TINYURL) { 
    66                                         // tinyurlだったらデコード 
    67                                         var cache : String = CommonData.urlcache[href]; 
    68                                         if (cache == null) { 
    69                                                 pe.addThread(new TinyURLDecodeThread(href)); 
    70                                                 dst += "{" + ct + "}"; // 代替テキスト 
    71                                                 ct++; 
    72                                         }else { 
    73                                                 dst += "<a href=\"" + cache + "\">" + cache + "</a>"; 
     65                                if (href.substring(0, 7) == "http://") { 
     66                                        // ドメインを取り出す 
     67                                        var slash : int = href.indexOf("/", 7); 
     68                                        if (slash != -1) { 
     69                                                var domain : String = href.substring(7, slash); 
     70                                                if (CommonData.MAP_SHORTENEDDOMAIN[domain]) { 
     71                                                        var cache : String = CommonData.urlcache[href]; 
     72                                                        if(cache == null){ 
     73                                                                // 伸長 
     74                                                                pe.addThread(new URLExpandThread(href, CommonData.configxml.timeout)); 
     75                                                                dst += "{" + ct + "}"; 
     76                                                                ct++; 
     77                                                        }else { 
     78                                                                dst += "<a href=\"" + cache + "\">" + cache + "</a>"; 
     79                                                        } 
     80                                                }else { 
     81                                                        // 普通のリンクでもテキスト部分が省略されている可能性があるため。 
     82                                                        dst += "<a href=\"" + href + "\">" + href + "</a>"; 
     83                                                } 
    7484                                        } 
    7585                                }else if (href.substring(0, 1) == "/") { 
     
    7787                                        var hrefstart : int = inner.indexOf("href=\"") + 6; 
    7888                                        dst += src.substr(start, startquery.length) + inner.substring(0, hrefstart) + "https://twitter.com" + inner.substring(hrefstart) + endquery; 
    79         //                      }else if (text == "...") { 
    80                                         // ...は何もしない 
    81                                 }else{ 
    82                                         // 普通のリンクでもテキスト部分が省略されている可能性があるため。 
    83                                         dst += "<a href=\"" + href + "\">" + href + "</a>"; 
    8489                                } 
     90                                 
    8591                                p = end + endquery.length; 
    8692                        } 
     
    9399                private function decodeCompleted() : void 
    94100                { 
    95                         // tinyurl分を補充 
     101                        // 伸長分を補充 
    96102                        var decodeds : Array = [dst]; 
    97103                        for (var i : int = 0; i < pe.numThreads; i++) { 
    98                                 var tudt : TinyURLDecodeThread = pe.getThreadAt(i) as TinyURLDecodeThread; 
    99                                 if(tudt.decoded != null){ 
    100                                         decodeds.push("<a href=\"" + tudt.decoded + "\">" + tudt.url + "</a>"); 
    101                                         CommonData.urlcache[tudt.url] = tudt.decoded; 
     104                                var uet : URLExpandThread = pe.getThreadAt(i) as URLExpandThread; 
     105                                if(uet.expanded != null){ 
     106                                        decodeds.push("<a href=\"" + uet.expanded + "\">" + uet.expanded + "</a>"); 
     107                                        CommonData.urlcache[uet.url] = uet.expanded; 
    102108                                }else { 
    103                                         decodeds.push("<a href=\"" + tudt.url + "\">" + tudt.url + "</a>"); 
     109                                        decodeds.push("<a href=\"" + uet.url + "\">" + uet.url + "</a>"); 
    104110                                } 
    105111                        } 
  • air/TLife/trunk/src/uwi/thread/MainThread.as

    r2546 r2589  
    3030        import uwi.thread.event.UndoThread; 
    3131        import uwi.thread.ReloadTimerThread; 
     32        import uwi.twitter.TwitterMobileLogoutThread; 
    3233        import uwi.ui.multipletabbar.MultipleTabBarDragEventThread; 
    3334        import uwi.util.CommonData; 
     
    3536        import uwi.ui.globalconfig.GlobalConfig; 
    3637        import uwi.util.TabRuleUtility; 
    37  
    3838 
    3939        /** 
     
    4545                } 
    4646                 
     47                protected override function finalize() : void 
     48                { 
     49                } 
     50                 
    4751                protected override function run() : void 
    4852                { 
    4953                        this.name = "Main"; 
    50 //                      event(NativeApplication.nativeApplication, Event.EXITING, onExit); 
    51                         NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit); 
     54                        event(NativeApplication.nativeApplication, Event.EXITING, onExit); 
    5255                         
    5356                        // GlobalConfig後XMLの順序がぐちゃぐちゃになるのでコメントは残せない 
     
    5760                        CommonData.mainstatusbar = Application.application.statusBar; 
    5861                        CommonData.searcher = new Searcher(); 
     62                        CommonData.protectedpostidcache = { }; 
    5963                         
    6064                        // configxmlの読み込み 
     
    226230                } 
    227231                 
    228                 private function onExit(event : Event) : void 
    229                 { 
     232                private function onExit(e : Event) : void 
     233                { 
     234                        e.preventDefault(); 
     235                         
    230236                        // DBのクローズ 
    231237                        if(CommonData.migemo != null)CommonData.migemo.close(); 
     
    233239                        CommonData.db_disk.close(); 
    234240                         
    235                         // dateformatの保存 
    236                         CommonData.configxml.main.datagrid.dateformat = CommonData.dateformatter_timeline.formatString; 
    237                          
    238                         saveTabRules(); 
    239                          
    240                         // configxmlの保存 
    241                         FileIO.writeAll(CommonData.FILE_CONFIGXML, CommonData.configxml.toXMLString(), "UTF-8"); 
     241                        if(CommonData.configxml.saveconfig == "true"){ 
     242                                // dateformatの保存 
     243                                CommonData.configxml.main.datagrid.dateformat = CommonData.dateformatter_timeline.formatString; 
     244                                 
     245                                saveTabRules(); 
     246                                 
     247                                // configxmlの保存 
     248                                FileIO.writeAll(CommonData.FILE_CONFIGXML, CommonData.configxml.toXMLString(), "UTF-8"); 
     249                        } 
     250                         
     251                        // ログアウト 
     252                        var tmlt : TwitterMobileLogoutThread = new TwitterMobileLogoutThread(); 
     253                        tmlt.start(); 
     254                        tmlt.join(); 
     255                        next(onLogout); 
     256                } 
     257                 
     258                private function onLogout() : void 
     259                { 
     260                        NativeApplication.nativeApplication.exit(); 
    242261                } 
    243262                 
  • air/TLife/trunk/src/uwi/thread/NotifyNewThread.as

    r2546 r2589  
    5959                                                        CommonData.TABLE_FOLLOWING +  
    6060                                                        " where userid = '" + StringUtility.escapeSQL(CommonData.configxml.login.userid) + "')" + 
    61                                                         " and " + condnewer + sqlsuffix; 
     61                                                        " and " + condnewer +  
     62                                                        (tabinfo.rule != "" ? (" and (" + tabinfo.rule + ")") : "") +  
     63                                                        sqlsuffix; 
    6264                                                break; 
    6365                                        case CommonData.LABEL_REPLY: 
    64                                                 sql = sqlprefix + " where content glob '*@" + StringUtility.escapeSQLForLike(CommonData.configxml.login.userid) + "*' and " + condnewer + sqlsuffix; 
     66                                                sql = sqlprefix + " where content glob '*@" + StringUtility.escapeSQLForLike(CommonData.configxml.login.userid) + "*' and " + condnewer +  
     67                                                        (tabinfo.rule != "" ? (" and (" + tabinfo.rule + ")") : "") +  
     68                                                        sqlsuffix; 
     69                                                break; 
     70                                        case CommonData.LABEL_FAVORITES: 
     71                                                sql = sqlprefix + " where fav = true and " + condnewer +  
     72                                                        (tabinfo.rule != "" ? (" and (" + tabinfo.rule + ")") : "") +  
     73                                                        sqlsuffix; 
    6574                                                break; 
    6675                                        default: 
    67                                                 if(tabinfo.rule != null && tabinfo.rule != ""){ 
    68                                                         sql = sqlprefix + tabinfo.rule + " and " + condnewer + sqlsuffix; 
     76                                                if(tabinfo.rule != ""){ 
     77                                                        sql = sqlprefix + " where (" + tabinfo.rule + ") and " +  
     78                                                        condnewer + sqlsuffix; 
    6979                                                } 
    7080                                                break; 
  • air/TLife/trunk/src/uwi/thread/ReplyGetThread.as

    r2546 r2589  
    4040                protected override function run() : void 
    4141                { 
    42                         replyname.text = "取得中"; 
     42                        replyname.text = posterid; 
     43                         
     44                        // protectedキャッシュを調べる 
     45                        if (CommonData.protectedpostidcache[postid]) { 
     46                                replypost.text = "protected"; 
     47                                replypost.setStyle("color", CommonData.configxml.main.fontcolor.replypost.protected); 
     48                                return; 
     49                        } 
     50                         
    4351                        replypost.text = "取得中"; 
    4452                        replypost.setStyle("color", CommonData.configxml.main.fontcolor.replypost.getting); 
    4553                         
     54                        // DBから取得。失敗の場合はwebで補う。 
    4655                        dbst2 = new DBSupplyThread( 
    4756                                CommonData.db_memory.conn, 
     
    5968                        var data : Object = dbst2.data; 
    6069                        if(data != null){ 
    61                                 replyname.text = posterid; 
    62                                  
    6370                                CommonData.RPATagData = StringUtility.enumerateHTMLATag(data.content); 
    6471                                CommonData.RPprevpos = -1; 
     
    6774                                 
    6875                                dbst = new DBSelectThread(CommonData.db_memory.conn,  
    69                                         "select name, iconurl from " + CommonData.TABLE_POSTER + " where posterid = '" + StringUtility.escapeSQL(posterid) + "'" 
     76                                        "select name from " + CommonData.TABLE_POSTER + " where posterid = '" + StringUtility.escapeSQL(posterid) + "'" 
    7077                                ); 
    7178                                dbst.start(); 
     
    7481                                interrupted(onInterrupted); 
    7582                        }else { 
    76                                 dbst = new DBSelectThread(CommonData.db_memory.conn,  
    77                                         "select protected from " + CommonData.TABLE_POSTER + " where posterid = '" + StringUtility.escapeSQL(posterid) + "'" 
    78                                 ); 
    79                                 dbst.start(); 
    80                                 dbst.join(); 
    81                                 next(onProtectedCheckComplete); 
     83                                // 失敗の場合、protectedキャッシュをもう一度調べる。 
     84                                if (CommonData.protectedpostidcache[postid]) { 
     85                                        replypost.text = "protected"; 
     86                                        replypost.setStyle("color", CommonData.configxml.main.fontcolor.replypost.protected); 
     87                                }else { 
     88                                        replypost.text = "Unknown Error"; 
     89                                        replypost.setStyle("color", CommonData.configxml.main.fontcolor.replypost.error); 
     90                                } 
    8291                        } 
    8392                } 
     
    95104                } 
    96105                 
    97                 private function onProtectedCheckComplete() : void 
    98                 { 
    99                         var ret : SQLResult = dbst.Result; 
    100                         var ar : Array = ret.data; 
    101                         if (ar != null) { 
    102                                 if (ar.protected == true) { 
    103                                         replypost.text = "protected"; 
    104                                         replypost.setStyle("color", CommonData.configxml.main.fontcolor.replypost.protected); 
    105                                         return; 
    106                                 } 
    107                         } 
    108                         replypost.text = "Unknown Error"; 
    109                         replypost.setStyle("color", CommonData.configxml.main.fontcolor.replypost.error); 
    110                 } 
    111                  
    112106                private function onInterrupted() : void 
    113107                { 
  • air/TLife/trunk/src/uwi/thread/TimelineThread.as

    r2546 r2589  
    4141                private var tabinfo : Object; 
    4242                 
     43                private var conn : SQLConnection; 
     44                 
    4345                public function TimelineThread(prefetch : int = -1) { 
    4446                        this.name = "Timeline"; 
     
    7476                        } 
    7577                         
     78                        conn = tabinfo.type == 1 ? CommonData.db_disk.conn : CommonData.db_memory.conn; 
     79                         
     80                        // SQL文の作成 
    7681                        var sqlprefix : String = "select postid, posterid, content, rawcontent, postedtime, replyid, fav from " +  
    7782                                                                        CommonData.TABLE_STATUS; 
     
    8489                                        CommonData.TABLE_FOLLOWING +  
    8590                                        " where userid = '" + StringUtility.escapeSQL(CommonData.configxml.login.userid) + "')" + 
     91                                        (tabinfo.rule != "" ? (" and (" + tabinfo.rule + ")") : "") +  
    8692                                        sqlsuffix; 
    8793                                break; 
    8894                        case CommonData.LABEL_REPLY: 
    89                                 sql = sqlprefix + " where content glob '*@" + StringUtility.escapeSQLForLike(CommonData.configxml.login.userid) + "*'" + sqlsuffix; 
     95                                sql = sqlprefix + " where content glob '*@" + StringUtility.escapeSQLForLike(CommonData.configxml.login.userid) + "*'" +  
     96                                        (tabinfo.rule != "" ? (" and (" + tabinfo.rule + ")") : "") +  
     97                                        sqlsuffix; 
     98                                break; 
     99                        case CommonData.LABEL_FAVORITES: 
     100                                sql = sqlprefix + " where fav = true" +  
     101                                        (tabinfo.rule != "" ? (" and (" + tabinfo.rule + ")") : "") +  
     102                                        sqlsuffix; 
    90103                                break; 
    91104                        default: 
    92                                 if(tabinfo.rule != null && tabinfo.rule != ""){ 
    93                                         sql = sqlprefix + tabinfo.rule + sqlsuffix; 
     105                                if(tabinfo.rule != ""){ 
     106                                        sql = sqlprefix + " where (" + tabinfo.rule + ")" + sqlsuffix; 
    94107                                } 
    95108                                break; 
     
    97110                        Logger.debug("TimelineThread sql : " + sql); 
    98111                        if (sql == null) { 
     112                                // 不適切な場合は処理しない 
    99113                                clearDataGrid(); 
    100114                                timeline.removeAll(); 
     
    102116                        } 
    103117                         
    104                         dbst = new DBSelectThread(CommonData.db_memory.conn, sql); 
     118                        dbst = new DBSelectThread(conn, sql); 
    105119                        dbst.start(); 
    106120                        dbst.join(); 
     
    115129                        clearDataGrid(); 
    116130                         
     131                        // タイムラインの更新 
    117132                        timeline.disableAutoUpdate(); 
    118133                        timeline.removeAll(); 
     
    176191                                for (var posterid : String in tempdbstmap) { 
    177192                                        var sql : String = "select name, iconurl from " + CommonData.TABLE_POSTER + " where posterid = '" + StringUtility.escapeSQL(posterid) + "'"; 
    178                                         var ddbst : DBSelectThread = new DBSelectThread(CommonData.db_memory.conn, sql); 
     193                                        var ddbst : DBSelectThread = new DBSelectThread(conn, sql); 
    179194                                        dbstmap[posterid] = ddbst; 
    180195                                        pe.addThread(ddbst); 
  • air/TLife/trunk/src/uwi/thread/event/ContextMenuItemEventThread.as

    r2538 r2589  
    380380                                if (ind + 1 >= tabbar.titles.length) ind = tabbar.titles.length - 1; 
    381381                                tabbar.titles.addItemAt(newtabname, ind + 1); 
    382                                 tabbar.changeLayout(); 
    383                                 tabbar.SelectedIndex = ind + 1; 
     382                                tabbar.changeLayout(ind + 1); 
    384383                                 
    385384                                CommonData.tabmap[newtabname] = { 
     
    388387                                        scrollposid : -1, 
    389388                                        newestid : -1,  
    390                                         rule : null
     389                                        rule : ""
    391390                                        unread : {}, 
    392391                                        numnotify : -1, 
     
    452451                                tabbar.titles.removeItemAt(index); 
    453452                                delete CommonData.tabmap[label]; 
    454                                 tabbar.changeLayout(); 
    455                                  
     453                                 
     454                                var ind : int; 
    456455                                // タブのフォーカスの移動 
    457456                                // 選択されていた場合は左側のタブを選択する。 
    458457                                if (sel >= index) { 
    459458                                        if (sel == 0 && index == 0) { 
    460                                                 tabbar.SelectedIndex = tabbar.titles.length > 0 ? 0 : -1; 
     459                                                ind = tabbar.titles.length > 0 ? 0 : -1; 
    461460                                        }else{ 
    462                                                 tabbar.SelectedIndex = sel - 1; 
     461                                                ind = sel - 1; 
    463462                                        } 
    464463                                }else { 
    465                                         tabbar.SelectedIndex = sel; 
    466                                 } 
     464                                        ind = sel; 
     465                                } 
     466                                tabbar.changeLayout(ind); 
     467                                 
    467468                                CommonData.tabrules = TabRuleUtility.optimizeTabRules(tabbar.titles, CommonData.tabrules); 
    468469                        } 
  • air/TLife/trunk/src/uwi/thread/event/IncrementalSearchThread.as

    r2497 r2589  
    118118                                case 2: 
    119119                                        switch(e.keyCode) { 
    120                                                 case Keyboard.ENTER: 
    121                                                         eraseQuery(); 
    122                                                         mode = 0; 
    123                                                         break; 
    124120                                                case Keyboard.ESCAPE: 
    125121                                                        eraseQuery(); 
    126122                                                        Application.application.timeline.filterFunction = null; 
     123                                                        Application.application.timeline.refresh(); 
    127124                                                        mode = 0; 
    128125                                                        break; 
    129126                                                case Keyboard.BACKSPACE: 
    130127                                                        if (query.length <= 1) { 
     128                                                                eraseQuery(); 
    131129                                                                Application.application.timeline.filterFunction = null; 
    132                                                                 eraseQuery(); 
     130                                                                Application.application.timeline.refresh(); 
    133131                                                                mode = 0; 
    134132                                                        }else{ 
     
    157155                                case 3: 
    158156                                        switch(e.keyCode) { 
    159                                                 case Keyboard.ENTER: 
    160                                                         eraseQuery(); 
    161                                                         mode = 0; 
    162                                                         break; 
    163157                                                case Keyboard.ESCAPE: 
    164158                                                        eraseQuery(); 
    165159                                                        Application.application.timeline.filterFunction = null; 
     160                                                        Application.application.timeline.refresh(); 
    166161                                                        mode = 0; 
    167162                                                        break; 
    168163                                                case Keyboard.BACKSPACE: 
    169164                                                        if (query.length <= 1) { 
     165                                                                eraseQuery(); 
    170166                                                                Application.application.timeline.filterFunction = null; 
    171                                                                 eraseQuery(); 
     167                                                                Application.application.timeline.refresh(); 
    172168                                                                mode = 0; 
    173169                                                        }else{ 
  • air/TLife/trunk/src/uwi/thread/event/PostEventThread.as

    r2492 r2589  
    66        import flash.events.TextEvent; 
    77        import flash.ui.Keyboard; 
     8        import ken39arg.logging.Logger; 
    89        import mx.controls.Button; 
    910        import mx.controls.Label; 
     
    1415        import mx.validators.StringValidator; 
    1516        import org.libspark.thread.Thread; 
     17        import org.libspark.thread.utils.ParallelExecutor; 
     18        import uwi.shortening.URLShortenThread; 
    1619        import uwi.twitter.TwitterPostThread; 
    1720        import uwi.twitter.TwitterScrapeThread; 
     
    3336                private var sub : EventThread; 
    3437                private var uict : UserIDCompleteThread; 
     38                private var postedtext : String; 
    3539                 
    3640                private static const EVENT_CHANGE : Event = new Event(Event.CHANGE); 
     
    8993                private function onSubmit(e : Event) : void 
    9094                { 
    91                         if (postarea.text.length > CommonData.LIMLEN_POST) { 
     95                        postedtext = postarea.text; 
     96                         
     97                        if (postedtext.length > CommonData.LIMLEN_POST) { 
    9298                                return; 
    9399                        } 
    94                         if (postarea.text.length == 0) { 
     100                        if (postedtext.length == 0) { 
    95101                                return; 
    96102                        } 
    97103                         
     104                        post(); 
     105                        /* 
     106                        // ポスト直前に短縮する 
     107                        if (CommonData.configxml.shortening != "") { 
     108                                shorten(); 
     109                        }else { 
     110                                post(); 
     111                        } 
     112                        */ 
     113                } 
     114                 
     115                private static const PTN_URL : RegExp = /https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#]+/g; 
     116                 
     117                        /* 
     118                private function shorten() : void 
     119                { 
     120                        var pe : ParallelExecutor = new ParallelExecutor(); 
     121                         
     122                        var temp : String = postedtext; 
     123                        // 発言からURLを抽出 
     124                        var ret : Object; 
     125                        while (ret = PTN_URL.exec(postedtext)) { 
     126                                var href : String = ret[0]; 
     127                                if (href.substring(0, 7) == "http://") { 
     128                                        // ドメインを取り出す 
     129                                        var slash : int = href.indexOf("/", 7); 
     130                                        if (slash != -1) { 
     131                                                var domain : String = href.substring(7, slash); 
     132                                                if (!CommonData.MAP_SHORTENEDDOMAIN[domain]) { 
     133                                                        // 短縮されていない場合短縮する 
     134                                                        pe.addThread(new URLShortenThread( 
     135                                                } 
     136                                        } 
     137                                } 
     138                        } 
     139                } 
     140                        */ 
     141                 
     142                private function post() : void 
     143                { 
    98144                        postbtn.enabled = false; 
    99                         var footer : String = CommonData.configxml.footer.toString()
     145                        var footer : String = CommonData.configxml.footer
    100146                        if (footer != "") footer = " " + footer; 
    101147                         
     148                        // TODO 複数reply時のin_reply_to_status_idのとりかた 
    102149                        var tpt : TwitterPostThread = new TwitterPostThread( 
    103150                                "http://twitter.com/statuses/update.xml", 
     
    107154                                , "GET"); 
    108155                        tpt.start(); 
    109                         tpt.join(); 
     156                        tpt.join(CommonData.configxml.timeout); 
    110157                        error(Error, onError); 
     158                        timeout(onTimeout); 
    111159                        next(onPostCompleted); 
    112160                }  
     
    114162                private function onPostCompleted() : void 
    115163                { 
     164                        Logger.debug("PostEventThread Successed"); 
     165                         
    116166                        CommonData.in_reply_to_status_id = ""; 
    117167                        postarea.text = ""; 
    118168                        Application.application.changeCharLeft(); 
    119169                         
    120                         new TwitterScrapeThread().start(); 
    121170                        postbtn.enabled = true; 
    122171                        next(waitEvents); 
     
    125174                private function onError(e : Error, t : Thread) : void 
    126175                { 
     176                        Logger.warn("PostEventThread Error"); 
     177                        Logger.stacktrace(e); 
    127178                        CommonData.in_reply_to_status_id = ""; 
     179                        postbtn.enabled = true; 
     180                        next(waitEvents); 
     181                } 
     182                 
     183                private function onTimeout() : void 
     184                { 
     185                        Logger.warn("PostEventThread Timeout"); 
    128186                        postbtn.enabled = true; 
    129187                        next(waitEvents); 
  • air/TLife/trunk/src/uwi/twitter/TwitterBitScrapeThread.as

    r2546 r2589  
    99        import org.libspark.thread.utils.ParallelExecutor; 
    1010        import uwi.bean.Status; 
     11        import uwi.db.DBSelectThread; 
    1112        import uwi.db.SimpleTransactionThread; 
    1213        import uwi.thread.FollowingCheckThread; 
     
    2930                 
    3031                public var posterid : String; 
     32                public var postid : String; 
    3133                 
    3234                public function TwitterBitScrapeThread(posterid : String, postid : String)  
     
    3436                        this.name = "TwitterBitScrape"; 
    3537                        this.posterid = posterid; 
     38                        this.postid = postid; 
     39                } 
     40                 
     41                protected override function run() : void 
     42                { 
    3643                        var req : URLRequest = new URLRequest("https://twitter.com/" + posterid + "/status/" + postid); 
    3744                        Logger.debug("TwitterBitScrapeThraed url : " + req.url); 
    3845                        req.followRedirects = true; 
    3946                        ult = new URLLoaderThread(req); 
    40                 } 
    41                  
    42                 protected override function run() : void 
    43                 { 
    4447                        ult.start(); 
    4548                        waitEvents(); 
     
    6063                        if (e.status == 403) { 
    6164                                // protected 
    62                                 pe = new ParallelExecutor(); 
    63                                 var sql : String = "replace into " + CommonData.TABLE_POSTER + " (posterid, protected, lastupdated) values (:posterid, true, :lastupdated)"; 
    64                                 var args : Array = [ { posterid : posterid, lastupdated : new Date()} ]; 
    65                                 pe.addThread(new SimpleTransactionThread(CommonData.db_memory.conn, sql, args)); 
    66                                 pe.addThread(new SimpleTransactionThread(CommonData.db_disk.conn, sql, args)); 
    67                                  
    68                                 pe.start(); 
    69                                 pe.join(); 
    70                                 interrupted(onInterrupted); 
     65                                CommonData.protectedpostidcache[postid] = 0; 
    7166                        }else { 
    7267                                next(waitEvents); 
     
    8075                         
    8176                        pe = new ParallelExecutor(); 
    82                          
    83                         /* 
    84                         if(ret.code == 0 || ret.code == 1){ 
    85                                 var sql : String = "replace into " + CommonData.TABLE_POSTER + " (posterid, protected, lastupdated) values (:posterid, :protected_, :lastupdated)"; 
    86                                 var args : Array = [ { protected_ : ret.code == 1, posterid : posterid, lastupdated : new Date()} ]; 
    87                                 pe.addThread(new SimpleTransactionThread(CommonData.db_memory.conn, sql, args)); 
    88                                 pe.addThread(new SimpleTransactionThread(CommonData.db_disk.conn, sql, args)); 
    89                         }*/ 
    9077                         
    9178                        switch(ret.code) { 
  • air/TLife/trunk/src/uwi/twitter/TwitterLoginThread.as

    r2546 r2589  
    4242                        CommonData.mainstatusbar.write("ログイン中.."); 
    4343                         
    44                         ult = new URLLoaderThread(new URLRequest("http://twitter.com/home")); 
     44                        ult = new URLLoaderThread(new URLRequest("https://twitter.com/home")); 
    4545                        ult.start(); 
    4646                        ult.join(CommonData.configxml.timeout); 
     
    7676                        ult = new URLLoaderThread(req); 
    7777                        ult.start(); 
     78                        trace("timeout : " + int(CommonData.configxml.timeout)); 
    7879                        ult.join(CommonData.configxml.timeout); 
    7980                        event(ult.loader, HTTPStatusEvent.HTTP_RESPONSE_STATUS, onResponse); 
     
    104105                         
    105106                        if (event.status == 200) { 
    106                                 if (event.responseURL == "https://twitter.com/home" || event.responseURL == "http://twitter.com/home") { 
     107                                if (event.responseURL == "https://twitter.com/") { 
    107108                                        Logger.info("TwitterLoginThread Login Succeeded"); 
    108109                                        CommonData.mainstatusbar.write("ログイン成功!"); 
  • air/TLife/trunk/src/uwi/ui/complete/CompleteThread.as

    r2546 r2589  
    101101                private function onKeyDown(e : KeyboardEvent) : void 
    102102                { 
    103                         trace("onKeyDown " + invalidflag); 
    104103                        if (list.isPopUp) { 
    105104                                switch(e.keyCode) { 
  • air/TLife/trunk/src/uwi/ui/multipletabbar/MultipleTabBar.as

    r2546 r2589  
    2828                 * 領域に収まるようにTabBarの項目を調節する。 
    2929                 */ 
    30                 public function changeLayout(silent : Boolean = false) : void 
     30                public function changeLayout(index : int = -1) : void 
    3131                { 
    3232                        clear(); 
    33 //                      trace("きたー"); 
    3433                         
    3534                        var tab : TabBar = new TabBar(); // カレントタブバー 
     
    4140                        tablist.push(tab); 
    4241                         
    43                                trace(this.width); 
     42                        // TODO タブ幅をキャッシュ化 
    4443                        for (var i : int = 0; i < titles.length; i++) { 
    4544                                var str : String = titles[i]; 
     
    4847                                tab.validateSize(true); 
    4948                                // strを加えた時点でカレントタブバーの長さが全体を上回ったら 
    50                                 if (tab.measuredWidth >= this.width) { 
     49                                if (tab.measuredWidth >= this.owner.width) { 
    5150                                        // カレントタブバーの要素数が1個より大きい場合、strを除いて巻き戻す 
    5251                                        if (tabdp.length > 1) { 
     
    6564                        } 
    6665                        this.height = tabheight * tablist.length; 
    67                         if(!silent)SelectedIndex = selectedIndex
     66                        this.validateNow()
    6867                         
     68                        var ind : int = index != -1 ? index : selectedIndex; 
     69                        setSelectedIndexCore(ind); 
    6970                        this.validateNow(); 
    7071                } 
     
    113114                         
    114115                        dispatchEvent(EVENT_CHANGE); 
    115                         selectedIndex = ind; 
     116                        setSelectedIndexCore(ind); 
     117                } 
     118                 
     119                private function setSelectedIndexCore(ind : int) : void 
     120                { 
     121                        this.selectedIndex = ind; 
    116122                         
    117123                        var targ : TabBar = null; 
     
    120126                                for each (targ in tablist) { 
    121127                                        sum -= targ.numChildren; 
    122                                         if (sum <= 0) { 
     128                                        if (sum < 0) { 
    123129                                                targ.selectedIndex = sum + targ.numChildren; 
    124130                                                break; 
  • air/TLife/trunk/src/uwi/ui/multipletabbar/MultipleTabBarDragEventThread.as

    r2531 r2589  
    6363        //                              toind -= fromind < toind ? 1 : 0; 
    6464                                        mtb.titles.addItemAt(mtb.titles.removeItemAt(fromind), toind); 
    65                                         mtb.SelectedIndex = toind; 
    66                                         mtb.changeLayout(); 
     65                                        mtb.changeLayout(toind); 
    6766                                } 
    6867                        } 
  • air/TLife/trunk/src/uwi/ui/multipletabbar/MultipleTabBarEventThread.as

    r2546 r2589  
    33        import flash.events.Event; 
    44        import mx.controls.TabBar; 
     5        import mx.core.Application; 
    56        import mx.events.CollectionEvent; 
    67        import mx.events.ItemClickEvent; 
     
    3637                { 
    3738                        event(mtb.titles, CollectionEvent.COLLECTION_CHANGE, onResize); 
    38                         event(mtb, Event.RESIZE, onResize); 
     39                        event(mtb.owner, Event.RESIZE, onResize); 
    3940                        for each(var tab : TabBar in mtb.tablist) { 
    4041                                event(tab, ItemClickEvent.ITEM_CLICK, onItemClick); 
     
    4445                private function onResize(e : Event) : void 
    4546                { 
    46                         trace("RESIZE"); 
    47                         mtb.changeLayout(true); 
     47                        mtb.changeLayout(); 
    4848                        next(waitEvents); 
    4949                } 
  • air/TLife/trunk/src/uwi/ui/tabconfig/TabConfigEventThread.as

    r2546 r2589  
    125125                                scrollposid : -1, 
    126126                                newestid : -1,  
    127                                 rule : null
     127                                rule : ""
    128128                                unread : {}, 
    129129                                numnotify : -1, 
  • air/TLife/trunk/src/uwi/util/CommonData.as

    r2546 r2589  
    116116                public static var balloons : Dictionary = new Dictionary(true); 
    117117                 
     118                public static var protectedpostidcache : Object; 
     119                 
    118120                public static var searcher : Searcher; 
    119121                 
     
    142144                        "postedtime" : uwi.ui.TimelineRenderer 
    143145                } 
     146                 
     147                public static const MAP_SHORTENEDDOMAIN : Object = { 
     148                        "tinyurl.com" : "http://tinyurl.com/api-create.php?url={0}", 
     149                        "is.gd" : "http://is.gd/api.php?longurl={0}", 
     150                        "snipurl.com" : "http://snipurl.com/site/snip?r=simple&link={0}", // deprecated? (snipr.com) 
     151                        "snurl.com" : "http://snurl.com/site/snip?r=simple&link={0}", // deprecated? 
     152                        "nsfw.in" : "", 
     153                        "qurlyq.com" : "", 
     154                        "dwarfurl.com" : "", 
     155                        "icanhaz.com" : "", 
     156                        "tiny.cc" : "", 
     157                        "urlenco.de" : "", 
     158                        "bit.ly" : "http://api.bit.ly/?url={0}", // nonstandard? 
     159                        "piurl.com" : "", 
     160                        "traceurl.com" : "", 
     161                        "twurl.nl" : "", 
     162                        "cli.gs" : "", 
     163                        "rubyurl.com" : "", 
     164                        "budurl.com" : "", 
     165                        "friendfeed.com" : "" 
     166                } 
    144167        } 
    145168         
  • air/TLife/trunk/src/uwi/util/StatusScraper.as

    r2501 r2589  
    7979                                        // replyid 
    8080                                        var replyid : String = ""; 
     81                                        var objReply : Object = PTN_REPLYTO.exec(str); 
     82                                        if (objReply) replyid = objReply[1]; 
     83                                        /* 
     84                                        var replyid : String = ""; 
    8185                                        var replytobase : int = str.indexOf(">in reply to"); 
    8286                                        if (replytobase != -1) { 
    8387                                                replyid = StringUtility.pinch(str.substr(replytobase - 30, 30), "status/", "\""); 
    8488                                        } 
     89                                        */ 
    8590                                         
    8691                                        // postedtime 
     
    102107                                        var fav : Boolean = (str.indexOf("<a class=\"fav-action non-fav\"") == -1); 
    103108                                         
    104 //                                    Logger.debug(new Status(postid, postername, posterid, content, replyid, postedtime, iconurl, fav)); 
     109                                      Logger.debug(new Status(postid, postername, posterid, content, replyid, postedtime, iconurl, fav)); 
    105110                                        ret.push(new Status(postid, postername, posterid, content, replyid, postedtime, iconurl, fav)); 
    106111                                } 
     
    116121                private static const ptnNum : RegExp = /[0-9]+/; 
    117122                 
     123                // 5秒以内前  
     124                // 30秒前後前 
     125                // 1分未満前 
     126                // 2分前 
     127                // 約2時間前 
     128                // 5:12 AM May 6th 
    118129                private static function implyTime(datestr : String) : Date 
    119130                { 
    120131                        var result : Object; 
    121132                        var now : Date = new Date(); 
    122                         if (datestr.lastIndexOf("ago") != -1) { 
     133                        if (datestr.lastIndexOf("") != -1) { 
    123134                                result = ptnNum.exec(datestr); 
    124135                                if (result != null) { 
    125136                                        var num : int = result[0]; 
    126137                                        if (datestr.indexOf("時間") != -1) { 
    127                                                 // 約n時間 ago 
     138                                                // 約n時間 
    128139                                                now.setTime(now.getTime() - num * 60 * 60 * 1000); 
    129140                                        }else { 
    130141                                                if (datestr.indexOf("秒") != -1) { 
    131                                                         // n秒前後 ago 
     142                                                        // n秒以内前  
     143                                                        // n秒前後前 
    132144                                                        now.setTime(now.getTime() - num * 1000); 
    133145                                                }else { 
    134                                                         // 1分未満 ago 
    135                                                         // n分 ago 
     146                                                        // 1分未満 
     147                                                        // n分 
    136148                                                        now.setTime(now.getTime() - num * 60 * 1000); 
    137149                                                } 
     
    151163                } 
    152164                 
     165                private static const PTN_REPLYTO : RegExp = /([0-9]+)\">[A-Za-z0-9_]*宛</; 
    153166                 
    154167                /** 
     
    173186                                return { status : null, code : 1 }; 
    174187                        } 
    175                         var title : String = StringUtility.pinch(src, "<title>", " on Twitter</title>"); 
     188                        var title : String = StringUtility.pinch(src, "<title>Twitter / ", ":"); 
    176189                        if (title == "?") { 
    177190                                return { status : null, code : 2 }; 
     
    191204                                 
    192205                                // posterid 
    193                                 var posterid : String = StringUtility.pinch(thumb, "a href=\"https://twitter.com/", "\">"); 
     206                                var posterid : String = StringUtility.pinch(thumb, "twitter.com/", "\""); 
    194207                                 
    195208                                // postername 
     
    198211                                 
    199212                                var entrymeta : String = StringUtility.pinch(src, "<span class=\"meta entry-meta\">", "</span></span>"); 
     213                                 
    200214                                // postid 
    201215                                var postid : String = StringUtility.pinch(entrymeta, posterid + "/status/", "\""); 
     
    215229                                // replyid 
    216230                                var replyid : String = ""; 
     231                                var objReply : Object = PTN_REPLYTO.exec(entrymeta); 
     232                                if (objReply) replyid = objReply[1]; 
     233                                /* 
    217234                                var replytobase : int = entrymeta.indexOf(">in reply to"); 
    218235                                if (replytobase != -1) { 
    219236                                        replyid = StringUtility.pinch(entrymeta.substr(replytobase - 30, 30), "status/", "\""); 
    220237                                } 
     238                                */ 
    221239                                 
    222240                                // fav 
     
    227245                        } 
    228246                         
    229 //                    Logger.debug(new Status(postid, postername, posterid, content, replyid, postedtime, iconurl, fav)); 
     247                      Logger.debug(new Status(postid, postername, posterid, content, replyid, postedtime, iconurl, fav)); 
    230248                        return { status : new Status(postid, postername, posterid, content, replyid, postedtime, iconurl, fav), code : 0 }; 
    231249                } 
  • air/TLife/trunk/src/uwi/util/TabRuleUtility.as

    r2538 r2589  
    8686                        } 
    8787                        if (sql == "") { 
    88                                 sql = " where (" + conds.join(" and ") + ")"; 
     88                                sql = "(" + conds.join(" and ") + ")"; 
    8989                        }else { 
    9090                                sql += " or (" + conds.join(" and ") + ")"; 
  • air/TLife/trunk/src/uwi/util/URLPostThread.as

    r2501 r2589  
    6060                protected function onTimeout() : void 
    6161                { 
     62                        ult.interrupt(); 
     63                        ult = null; 
    6264                        Logger.debug("URLPostThread timeout"); 
    6365                }