Commits

Shrikant Sharat Kandula  committed 8a00a76

Updated list timeline function to json. Removed timline showing function that uses xml.

  • Participants
  • Parent commits d8bb690

Comments (0)

Files changed (1)

File plugin/twitvim.vim

     return 0
 endfunction
 
-" Show a timeline from XML stream data.
-function! s:show_timeline_xml(timeline, tline_name, username, page)
-    let text = []
-
-    let s:curbuffer.dmids = []
-
-    " Construct page title.
-
-    let title = substitute(a:tline_name, '^.', '\u&', '')." timeline"
-    if a:username != ''
-        let title .= " for ".a:username
-    endif
-
-    " Special case titles for Retweets and Mentions.
-    if a:tline_name == "retweeted_to_me"
-        let title = "Retweets by others"
-    elseif a:tline_name == "retweeted_by_me"
-        let title = "Retweets by you"
-    elseif a:tline_name == "replies"
-        let title = "Mentions timeline"
-    endif
-
-    if a:page > 1
-        let title .= ' (page '.a:page.')'
-    endif
-
-    let s:curbuffer.showheader = s:get_show_header()
-    if s:curbuffer.showheader
-        " Index of first status will be 2 to match line numbers in timeline
-        " display.
-        let s:curbuffer.statuses = [0, 0]
-        let s:curbuffer.inreplyto = [0, 0]
-
-        " The extra stars at the end are for the syntax highlighter to
-        " recognize the title. Then the syntax highlighter hides the stars by
-        " coloring them the same as the background. It is a bad hack.
-        call add(text, title.'*')
-    else
-        " Index of first status will be 1 to match line numbers in timeline
-        " display.
-        let s:curbuffer.statuses = [0]
-        let s:curbuffer.inreplyto = [0]
-    endif
-
-    for item in s:xml_get_all(a:timeline, 'status')
-        if !s:check_filter(item)
-            let lines = s:format_status_xml(item)
-            call extend(text, lines)
-
-            " Add reference lines.length times, so all the lines of this item
-            " will refer to the same tweet reference.
-            let item_id = s:xml_get_element(item, 'id')
-            let reply_to = s:get_in_reply_to(item)
-            for l in lines
-                call add(s:curbuffer.statuses, item_id)
-                call add(s:curbuffer.inreplyto, reply_to)
-            endfor
-        endif
-    endfor
-
-    call s:twitter_wintext(text, "timeline")
-    let s:curbuffer.buffer = text
-endfunction
-
 " Show a timeline from JSON stream data.
+" show_timeline_xml used to be here, but no longer.
 function! s:show_timeline_json(timeline, tline_name, username, page)
     let text = []
 
 function! s:get_list_timeline(username, listname, page)
 
     let user = a:username
-    if user == ''
+    if empty(user)
         let user = s:get_twitvim_username()
-        if user == ''
+        if empty(user)
             call s:errormsg('Twitter login not set. Please specify a username.')
-            return -1
+            return
         endif
     endif
 
-    let url = s:get_api_root().'/lists/statuses.xml?slug='.a:listname.'&owner_screen_name='.user
+    let url = s:get_api_root() . '/lists/statuses.json?slug=' . a:listname . '&owner_screen_name=' . user
 
     " Support pagination.
     if a:page > 1
-        let url = s:add_to_url(url, 'page='.a:page)
+        let url = s:add_to_url(url, 'page=' . a:page)
     endif
 
     " Support count parameter.
     let tcount = s:get_count()
     if tcount > 0
-        let url = s:add_to_url(url, 'per_page='.tcount)
-        let url = s:add_to_url(url, 'count='.tcount)
+        let url = s:add_to_url(url, 'per_page=' . tcount)
+        let url = s:add_to_url(url, 'count=' . tcount)
     endif
 
     " Include entities to get URL expansions for t.co.
 
     let [error, output] = s:run_curl_oauth(url, s:ologin, s:get_proxy(), s:get_proxy_login(), {})
 
-    if error != ''
+    if !empty(error)
         let errormsg = s:xml_get_element(output, 'error')
         call s:errormsg("Error getting Twitter list timeline: ".(errormsg != '' ? errormsg : error))
         return
 
     call s:save_buffer(0)
     let s:curbuffer = {}
-    call s:show_timeline_xml(output, "list", user."/".a:listname, a:page)
+    call s:show_timeline_json(output, "list", user."/".a:listname, a:page)
     let s:curbuffer.buftype = "list"
     let s:curbuffer.user = user
     let s:curbuffer.list = a:listname