Stub (almost) a bunch of endpoints the free-but-official tapatalk client hits
This commit is contained in:
@@ -315,6 +315,11 @@ helpers do
|
||||
respond_xmlrpc( 'result' => true )
|
||||
end
|
||||
|
||||
def xmlrpc_get_inbox_stat
|
||||
# TODO: get real numbers instead...
|
||||
respond_xmlrpc( 'inbox_read_count' => 0 )
|
||||
end
|
||||
|
||||
# Ignore forum_id for now. Naughty naughty.
|
||||
def xmlrpc_get_forum( return_description = nil, forum_id = nil)
|
||||
|
||||
@@ -330,34 +335,53 @@ helpers do
|
||||
'sub_only' => false,
|
||||
# 'child' => [], # Don't return this if we have no children
|
||||
# 'is_protected' => false, # ?
|
||||
'is_subscribed' => false, # TODO
|
||||
'is_subscribed' => true, # TODO - we pretend all forums are subscribed for now
|
||||
'can_subscribe' => false, # TODO
|
||||
'can_post' => !!category_list["can_create_topic"] # FIXME: this may not be correct!
|
||||
'can_post' => !!category_list["can_create_topic"], # FIXME: this may not be correct!
|
||||
'new_post' => true, # TODO
|
||||
"is_protected" => false, # Not required, apparently
|
||||
'description' => binary_xmlrpc( hsh['description'].to_s ),
|
||||
"child" => []
|
||||
}
|
||||
|
||||
# FIXME: may not be right?
|
||||
# if return_description
|
||||
# tmp['description'] = binary_xmlrpc( hsh['description'].to_s )
|
||||
#
|
||||
# end
|
||||
|
||||
tmp
|
||||
}
|
||||
|
||||
pp result
|
||||
|
||||
respond_xmlrpc( result )
|
||||
end
|
||||
|
||||
def xmlrpc_get_subscribed_forum
|
||||
xmlrpc_get_forum
|
||||
end
|
||||
|
||||
def xmlrpc_get_subscribed_topic
|
||||
xmlrpc_get_latest_topic
|
||||
end
|
||||
|
||||
def xmlrpc_get_new_topic
|
||||
xmlrpc_get_latest_topic
|
||||
end
|
||||
|
||||
# FIXME: STUB.
|
||||
# In API level 4, we can say this doesn't exist and force tapatalk to use get_topic
|
||||
def xmlrpc_get_unread_topic( start_num = 0, last_num = 0, search_id = nil, filters = nil )
|
||||
result = {
|
||||
'result' => true,
|
||||
# optional
|
||||
# 'result_text' => binary_xmlrpc( '' ),
|
||||
# 'search_id' => '',
|
||||
}
|
||||
result = { 'result' => true }
|
||||
|
||||
unread_topics = discourse.topics_unread({})
|
||||
topic_list = unread_topics.fetch( "topic_list" )
|
||||
topics = topic_list.fetch( "topics" )
|
||||
|
||||
result['topics'] = [].collect {|hsh| build_tapatalk_topic( hsh ) }
|
||||
result['total_topic_num'] = result['topics'].count
|
||||
result['topics'] = topics.collect {|hsh|
|
||||
build_tapatalk_topic( hsh, :users => latest_topics["users"], :categories => latest_topics["categories"] )
|
||||
}
|
||||
result['total_topic_num'] = result['topics'].count # api level 4
|
||||
|
||||
respond_xmlrpc( result )
|
||||
end
|
||||
|
Reference in New Issue
Block a user