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 )
|
respond_xmlrpc( 'result' => true )
|
||||||
end
|
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.
|
# Ignore forum_id for now. Naughty naughty.
|
||||||
def xmlrpc_get_forum( return_description = nil, forum_id = nil)
|
def xmlrpc_get_forum( return_description = nil, forum_id = nil)
|
||||||
|
|
||||||
@@ -330,34 +335,53 @@ helpers do
|
|||||||
'sub_only' => false,
|
'sub_only' => false,
|
||||||
# 'child' => [], # Don't return this if we have no children
|
# 'child' => [], # Don't return this if we have no children
|
||||||
# 'is_protected' => false, # ?
|
# 'is_protected' => false, # ?
|
||||||
'is_subscribed' => false, # TODO
|
'is_subscribed' => true, # TODO - we pretend all forums are subscribed for now
|
||||||
'can_subscribe' => false, # TODO
|
'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?
|
# FIXME: may not be right?
|
||||||
# if return_description
|
# if return_description
|
||||||
# tmp['description'] = binary_xmlrpc( hsh['description'].to_s )
|
#
|
||||||
# end
|
# end
|
||||||
|
|
||||||
tmp
|
tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pp result
|
||||||
|
|
||||||
respond_xmlrpc( result )
|
respond_xmlrpc( result )
|
||||||
end
|
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.
|
# FIXME: STUB.
|
||||||
# In API level 4, we can say this doesn't exist and force tapatalk to use get_topic
|
# 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 )
|
def xmlrpc_get_unread_topic( start_num = 0, last_num = 0, search_id = nil, filters = nil )
|
||||||
result = {
|
result = { 'result' => true }
|
||||||
'result' => true,
|
|
||||||
# optional
|
unread_topics = discourse.topics_unread({})
|
||||||
# 'result_text' => binary_xmlrpc( '' ),
|
topic_list = unread_topics.fetch( "topic_list" )
|
||||||
# 'search_id' => '',
|
topics = topic_list.fetch( "topics" )
|
||||||
}
|
|
||||||
|
|
||||||
result['topics'] = [].collect {|hsh| build_tapatalk_topic( hsh ) }
|
result['topics'] = topics.collect {|hsh|
|
||||||
result['total_topic_num'] = result['topics'].count
|
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 )
|
respond_xmlrpc( result )
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user