Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Commit

Permalink
document upload done
Browse files Browse the repository at this point in the history
  • Loading branch information
h4child committed Mar 30, 2018
1 parent 1ad80a4 commit f5574a7
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 601 deletions.
2 changes: 1 addition & 1 deletion include/framebot/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ void mem_store_free(MemStore * memStore);
size_t mem_write_callback(void *content, size_t size, size_t nmemb, void *userp);
MemStore *call_method(const char *token, char *method);
int call_method_download(const char * token, char * namefile, File * ofile);
MemStore * call_method_input_file(const char * token, IFile ifile);
MemStore * call_method_upload(const char * token, IFile ifile);

#endif
14 changes: 7 additions & 7 deletions src/framebot.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ int set_chat_photo(Bot *bot, char * chat_id, char *filename){
MemStore * input;
refjson *s_json;

input = call_method_input_file(bot->token, ifile);
input = call_method_upload(bot->token, ifile);

s_json = start_json(input->content);
mem_store_free(input);
Expand Down Expand Up @@ -885,7 +885,7 @@ Message * send_photo(Bot * bot, char * chat_id, char * filename,
MemStore * input;
refjson *s_json;

input = call_method_input_file(bot->token, ifile);
input = call_method_upload(bot->token, ifile);

s_json = start_json(input->content);

Expand Down Expand Up @@ -969,7 +969,7 @@ Message * send_audio(Bot *bot, char * chat_id, char * filename, char * caption,
MemStore * input;
refjson *s_json;

input = call_method_input_file(bot->token, ifile);
input = call_method_upload(bot->token, ifile);

s_json = start_json(input->content);
if(!s_json)
Expand Down Expand Up @@ -1044,7 +1044,7 @@ Message * send_document(Bot * bot, char * chat_id, char * filename, char * capti
MemStore * input;
refjson *s_json;

input = call_method_input_file(bot->token, ifile);
input = call_method_upload(bot->token, ifile);

s_json = start_json(input->content);
if(!s_json)
Expand Down Expand Up @@ -1121,7 +1121,7 @@ Message * send_video(Bot * bot, char * chat_id, char * filename, long int durati
MemStore * input;
refjson *s_json;

input = call_method_input_file(bot->token, ifile);
input = call_method_upload(bot->token, ifile);

s_json = start_json(input->content);
if(!s_json)
Expand Down Expand Up @@ -1197,7 +1197,7 @@ Message * send_voice(Bot *bot, char * chat_id, char * filename, char * caption,
MemStore * input;
refjson *s_json;

input = call_method_input_file(bot->token, ifile);
input = call_method_upload(bot->token, ifile);

s_json = start_json(input->content);
if(!s_json)
Expand Down Expand Up @@ -1272,7 +1272,7 @@ Message * send_video_note(Bot * bot, char * chat_id, char * filename, long int d
MemStore * input;
refjson *s_json;

input = call_method_input_file(bot->token, ifile);
input = call_method_upload(bot->token, ifile);

s_json = start_json(input->content);
if(!s_json)
Expand Down
2 changes: 1 addition & 1 deletion src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int call_method_download(const char * token, char * namefile, File *ofile){
return 0;
}

MemStore * call_method_input_file(const char * token, IFile ifile){
MemStore * call_method_upload(const char * token, IFile ifile){
char method[25];
CURL * curl;
CURLcode res;
Expand Down
11 changes: 1 addition & 10 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ include_directories (${PROJECT_SOURCE_DIR}/../include)

add_definitions("-g")

add_executable(test_lib test_lib.c)
add_executable(libtest test_framebot.c)
add_executable(update test_update.c)
add_executable(file test_file.c)
add_executable(userprofilephotos test_userprofilephotos.c)
Expand All @@ -26,11 +24,8 @@ add_executable(sendvideo test_sendvideo.c)
add_executable(sendvoice test_sendvoice.c)
add_executable(sendvideonote test_sendvideonote.c)
add_executable(sendmessage test_sendmessage.c)
add_executable(all_api test_api.c)

if (CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_libraries(test_lib jansson libcurl.so framebot)
target_link_libraries(libtest jansson libcurl.so framebot)
target_link_libraries(update jansson libcurl.so framebot)
target_link_libraries(file jansson libcurl.so framebot)
target_link_libraries(userprofilephotos jansson libcurl.so framebot)
Expand All @@ -41,12 +36,9 @@ if (CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_libraries(sendvoice jansson libcurl.so framebot)
target_link_libraries(sendvideonote jansson libcurl.so framebot)
target_link_libraries(sendmessage jansson libcurl.so framebot)
target_link_libraries(all_api jansson libcurl.so framebot)
endif (CMAKE_SYSTEM_NAME STREQUAL Linux)

if (WIN32)
target_link_libraries(test_lib jansson libcurl_a framebot)
target_link_libraries(libtest jansson libcurl_a framebot)
target_link_libraries(update jansson libcurl_a framebot)
target_link_libraries(file jansson libcurl_a framebot)
target_link_libraries(userprofilephotos jansson libcurl_a framebot)
Expand All @@ -56,6 +48,5 @@ if (WIN32)
target_link_libraries(senddocument jansson libcurl_a framebot)
target_link_libraries(sendvideo jansson libcurl_a framebot)
target_link_libraries(sendvideonote jansson libcurl_a framebot)
target_link_libraries(sendmessage jansson libcurl.so framebot)
target_link_libraries(all_api jansson libcurl.so framebot)
target_link_libraries(sendmessage jansson libcurl_a framebot)
endif (WIN32)
45 changes: 0 additions & 45 deletions test/test_api.c

This file was deleted.

70 changes: 0 additions & 70 deletions test/test_framebot.c

This file was deleted.

42 changes: 0 additions & 42 deletions test/test_lib.c

This file was deleted.

0 comments on commit f5574a7

Please sign in to comment.