diff --git a/include/mastodont_account.h b/include/mastodont_account.h
index 517f7bc..d0ab056 100644
--- a/include/mastodont_account.h
+++ b/include/mastodont_account.h
@@ -76,7 +76,7 @@ struct mstdnt_account_args
int with_relationships; // mastodont_get_mutes
};
-int mstdnt_account_action(mastodont_t* data,
+int mstdnt_account_action(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_relationship* rel,
@@ -86,7 +86,7 @@ int mstdnt_accounts_json(struct mstdnt_account* accounts[],
size_t* size,
cJSON* js);
-#define MSTDNT_ACCOUNT_ACTION_DECL(type) int mastodont_##type##_account(mastodont_t* data, char* id, struct mstdnt_storage* storage, struct mstdnt_relationship* relationship)
+#define MSTDNT_ACCOUNT_ACTION_DECL(type) int mastodont_##type##_account(mastodont_t* data, struct mstdnt_args* args, char* id, struct mstdnt_storage* storage, struct mstdnt_relationship* relationship)
#define MSTDNT_ACCOUNT_ACTION_FUNC_URL(action) { \
return mstdnt_account_action(data, id, storage, relationship, "api/v1/accounts/%s/" action); \
}
@@ -100,35 +100,35 @@ MSTDNT_ACCOUNT_ACTION_DECL(unblock);
MSTDNT_ACCOUNT_ACTION_DECL(subscribe);
MSTDNT_ACCOUNT_ACTION_DECL(unsubscribe);
-int mastodont_verify_credentials(mastodont_t* data,
+int mastodont_verify_credentials(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_account* acct,
struct mstdnt_storage* storage);
-int mastodont_get_account(mastodont_t* data,
+int mastodont_get_account(mastodont_t* data, struct mstdnt_args* args,
int lookup_type,
char* id,
struct mstdnt_account* acct,
struct mstdnt_storage* storage);
-int mastodont_get_blocks(mastodont_t* data,
+int mastodont_get_blocks(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len);
-int mastodont_get_mutes(mastodont_t* data,
+int mastodont_get_mutes(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len);
-int mastodont_get_followers(mastodont_t* data,
+int mastodont_get_followers(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len);
-int mastodont_get_following(mastodont_t* data,
+int mastodont_get_following(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
diff --git a/include/mastodont_application.h b/include/mastodont_application.h
index 9405e6c..cd80923 100644
--- a/include/mastodont_application.h
+++ b/include/mastodont_application.h
@@ -48,12 +48,12 @@ struct mstdnt_oauth_token
time_t time;
};
-int mastodont_register_app(mastodont_t* data,
+int mastodont_register_app(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_args* args,
struct mstdnt_storage* storage,
struct mstdnt_app* app);
-int mastodont_obtain_oauth_token(mastodont_t* data,
+int mastodont_obtain_oauth_token(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_args* args,
struct mstdnt_storage* storage,
struct mstdnt_oauth_token* app);
diff --git a/include/mastodont_args.h b/include/mastodont_args.h
deleted file mode 100644
index 6f5136e..0000000
--- a/include/mastodont_args.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- */
-
-#ifndef MASTODONT_ARGUMENTS_H
-#define MASTODONT_ARGUMENTS_H
-#include "mastodont_notif_types.h"
-
-/*
- * TODO undo this shit, it's actually just gross i'll duplicate the code i do not care
- */
-
-struct mstdnt_args
-{
- char* client_name;
- char* redirect_uris;
- char* scopes;
- char* website;
- char* grant_type;
- char* client_id;
- char* client_secret;
- char* redirect_uri;
- char* scope;
- char* code;
- char* username;
- char* password;
- int pinned;
- char* tagged;
- int with_muted;
- int exclude_reblogs;
- int exclude_replies;
- int offset;
- int only_media;
- char* max_id;
- char* since_id;
- char* min_id;
- int limit;
- char* content_type;
- int expires_in;
- char* in_reply_to_conversation_id;
- char* in_reply_to_id;
- char* language;
- char** media_ids;
- void* poll; /* TODO */
- int preview;
- char* scheduled_at;
- int sensitive;
- char* spoiler_text;
- char* status;
- char* visibility;
- int media_ids_len;
- int remote;
- int local;
- char** exclude_types;
- size_t exclude_types_len;
- char* account_id;
- char** exclude_visibilities;
- size_t exclude_visibilities_len;
- enum mstdnt_notification_type* include_types;
-};
-
-#endif /* MASTODONT_ARGUMENTS_H */
diff --git a/include/mastodont_attachment.h b/include/mastodont_attachment.h
index d93d377..ec0a9cf 100644
--- a/include/mastodont_attachment.h
+++ b/include/mastodont_attachment.h
@@ -51,7 +51,7 @@ int mstdnt_attachment_json(cJSON* att_json, struct mstdnt_attachment* att);
void _mstdnt_val_attachments_call(cJSON* v, void* _type);
-int mastodont_upload_media(mastodont_t* api,
+int mastodont_upload_media(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_upload_media_args* args,
struct mstdnt_storage* storage,
struct mstdnt_attachment* attachment);
diff --git a/include/mastodont_instance.h b/include/mastodont_instance.h
index 9e2e460..aea1139 100644
--- a/include/mastodont_instance.h
+++ b/include/mastodont_instance.h
@@ -23,7 +23,7 @@ struct mstdnt_instance
};
// TODO
-int mastodont_instance(mastodont_t* api,
+int mastodont_instance(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_instance* inst);
#endif /* MASTODONT_INSTANCE_H */
diff --git a/include/mastodont_list.h b/include/mastodont_list.h
index 1833bbd..b20bb75 100644
--- a/include/mastodont_list.h
+++ b/include/mastodont_list.h
@@ -49,45 +49,45 @@ int mstdnt_lists_json(struct mstdnt_list* lists[],
size_t* size,
cJSON* json);
-int mastodont_get_lists(mastodont_t* api,
+int mastodont_get_lists(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_storage* storage,
struct mstdnt_list* lists[],
size_t* size);
-int mastodont_get_list(mastodont_t* api,
+int mastodont_get_list(mastodont_t* api, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_list* lists);
-int mastodont_create_list(mastodont_t* api,
+int mastodont_create_list(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_list_args* args,
struct mstdnt_storage* storage,
struct mstdnt_list* list);
-int mastodont_update_list(mastodont_t* api,
+int mastodont_update_list(mastodont_t* api, struct mstdnt_args* args,
char* id,
struct mstdnt_list_args* args,
struct mstdnt_storage* storage,
struct mstdnt_list* list);
-int mastodont_delete_list(mastodont_t* api,
+int mastodont_delete_list(mastodont_t* api, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage);
-int mastodont_list_get_accounts(mastodont_t* data,
+int mastodont_list_get_accounts(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len);
-int mastodont_list_add_accounts(mastodont_t* api,
+int mastodont_list_add_accounts(mastodont_t* api, struct mstdnt_args* args,
char* id,
char** account_ids,
size_t account_ids_len,
struct mstdnt_storage* storage);
-int mastodont_list_remove_accounts(mastodont_t* api,
+int mastodont_list_remove_accounts(mastodont_t* api, struct mstdnt_args* args,
char* id,
char** account_ids,
size_t account_ids_len,
diff --git a/include/mastodont_nodeinfo.h b/include/mastodont_nodeinfo.h
index bd77a6f..77568b3 100644
--- a/include/mastodont_nodeinfo.h
+++ b/include/mastodont_nodeinfo.h
@@ -41,7 +41,7 @@ int mstdnt_nodeinfo_json(struct mstdnt_nodeinfo* nodeinfo, cJSON* js);
int mstdnt_nodeinfo_json_callback(cJSON* json, void* nodeinfo);
-int mastodont_get_nodeinfo(mastodont_t* api,
+int mastodont_get_nodeinfo(mastodont_t* api, struct mstdnt_args* args,
char* version,
struct mstdnt_storage* storage,
struct mstdnt_nodeinfo* nodeinfo);
diff --git a/include/mastodont_notification.h b/include/mastodont_notification.h
index 6ec2f08..bceb3d2 100644
--- a/include/mastodont_notification.h
+++ b/include/mastodont_notification.h
@@ -57,7 +57,7 @@ struct _mstdnt_notifications_result_cb_args
int mstdnt_notifications_json_callback(cJSON* json, void* _args);
-int mastodont_get_notifications(mastodont_t* data,
+int mastodont_get_notifications(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_get_notifications_args* args,
struct mstdnt_storage* storage,
struct mstdnt_notification** notifs,
diff --git a/include/mastodont_query.h b/include/mastodont_query.h
index 7624272..36ced15 100644
--- a/include/mastodont_query.h
+++ b/include/mastodont_query.h
@@ -44,7 +44,7 @@ struct _mstdnt_query_param
} value;
};
-char* _mstdnt_query_string(mastodont_t* data,
+char* _mstdnt_query_string(mastodont_t* data,
struct mstdnt_args* args,
char* src,
struct _mstdnt_query_param* params,
diff --git a/include/mastodont_relationship.h b/include/mastodont_relationship.h
index f83d756..b0c2154 100644
--- a/include/mastodont_relationship.h
+++ b/include/mastodont_relationship.h
@@ -52,7 +52,7 @@ int mstdnt_relationships_json(struct mstdnt_relationship* relationships[],
int mstdnt_relationships_json_callback(cJSON* json, void* _args);
-int mastodont_get_relationships(mastodont_t* data,
+int mastodont_get_relationships(mastodont_t* data, struct mstdnt_args* args,
char** ids,
size_t ids_len,
struct mstdnt_storage* storage,
diff --git a/include/mastodont_scrobbles.h b/include/mastodont_scrobbles.h
index 0230960..695f997 100644
--- a/include/mastodont_scrobbles.h
+++ b/include/mastodont_scrobbles.h
@@ -46,7 +46,7 @@ struct _mstdnt_scrobbles_cb_args
size_t* size;
};
-int mastodont_get_scrobbles(mastodont_t* data,
+int mastodont_get_scrobbles(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_get_scrobbles_args* args,
struct mstdnt_storage* storage,
diff --git a/include/mastodont_search.h b/include/mastodont_search.h
index 826fd26..db3323f 100644
--- a/include/mastodont_search.h
+++ b/include/mastodont_search.h
@@ -54,7 +54,7 @@ int mstdnt_search_json_callback(cJSON* json, void* _args);
int mstdnt_search_json(struct mstdnt_search_results* search_results, cJSON* json);
-int mastodont_search(mastodont_t* data,
+int mastodont_search(mastodont_t* data, struct mstdnt_args* args,
char* query,
struct mstdnt_storage* storage,
struct mstdnt_search_args* args,
diff --git a/include/mastodont_static.h b/include/mastodont_static.h
index c3ee481..f8667d7 100644
--- a/include/mastodont_static.h
+++ b/include/mastodont_static.h
@@ -18,10 +18,10 @@
#include "mastodont_types.h"
#include "mastodont_fetch.h"
-int mastodont_instance_panel(mastodont_t* api,
+int mastodont_instance_panel(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_fetch_results* html);
-int mastodont_terms_of_service(mastodont_t* api,
+int mastodont_terms_of_service(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_fetch_results* html);
#endif /* MSTDNT_STATIC_H */
diff --git a/include/mastodont_status.h b/include/mastodont_status.h
index 5364306..3a87b4a 100644
--- a/include/mastodont_status.h
+++ b/include/mastodont_status.h
@@ -96,7 +96,7 @@ void mstdnt_cleanup_statuses(struct mstdnt_status* statuses, size_t s);
void mstdnt_cleanup_status(struct mstdnt_status* status);
int mstdnt_status_json(struct mstdnt_status* status, cJSON* js);
-int mastodont_status_emoji_react(mastodont_t* api, char* id, char* emoji,
+int mastodont_status_emoji_react(mastodont_t* api, struct mstdnt_args* args, char* id, char* emoji,
struct mstdnt_storage* storage, struct mstdnt_status* status);
// Generated function
@@ -113,19 +113,19 @@ int mstdnt_status_context_json(struct mstdnt_status* statuses_before[],
size_t* size_after,
cJSON* js);
-int mastodont_get_account_statuses(mastodont_t* data,
+int mastodont_get_account_statuses(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_account_statuses_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
-int mastodont_get_status(mastodont_t* data,
+int mastodont_get_status(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status);
-int mastodont_get_status_context(mastodont_t* data,
+int mastodont_get_status_context(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses_before[],
@@ -133,24 +133,24 @@ int mastodont_get_status_context(mastodont_t* data,
size_t* size_before,
size_t* size_after);
-int mastodont_status_favourited_by(mastodont_t* data,
+int mastodont_status_favourited_by(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_account* accounts[],
size_t* accts);
-int mastodont_status_reblogged_by(mastodont_t* data,
+int mastodont_status_reblogged_by(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_account* accounts[],
size_t* accts);
-int mastodont_create_status(mastodont_t* data,
+int mastodont_create_status(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_args* args,
struct mstdnt_storage* storage);
/* Generates do and undo functions */
-#define MSTDNT_STATUS_ACTION_DECL(type) int mastodont_##type##_status(mastodont_t* data, char* id, struct mstdnt_storage* storage, struct mstdnt_status* status)
+#define MSTDNT_STATUS_ACTION_DECL(type) int mastodont_##type##_status(mastodont_t* data, struct mstdnt_args* args, char* id, struct mstdnt_storage* storage, struct mstdnt_status* status)
#define MSTDNT_STATUS_ACTION_FUNC_URL(action) { \
return mstdnt_status_action(data, id, storage, status, "api/v1/statuses/%s/" action); \
}
@@ -165,12 +165,12 @@ MSTDNT_STATUS_ACTION_DECL(bookmark);
MSTDNT_STATUS_ACTION_DECL(unbookmark);
MSTDNT_STATUS_ACTION_DECL(delete);
-int mastodont_mute_conversation(mastodont_t* data,
+int mastodont_mute_conversation(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status);
-int mastodont_unmute_conversation(mastodont_t* data,
+int mastodont_unmute_conversation(mastodont_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status);
@@ -205,13 +205,13 @@ struct mstdnt_favourites_args
int limit;
};
-int mastodont_get_bookmarks(mastodont_t* data,
+int mastodont_get_bookmarks(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_bookmarks_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
-int mastodont_get_favourites(mastodont_t* data,
+int mastodont_get_favourites(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_favourites_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
diff --git a/include/mastodont_timeline.h b/include/mastodont_timeline.h
index d58036f..6663322 100644
--- a/include/mastodont_timeline.h
+++ b/include/mastodont_timeline.h
@@ -40,32 +40,32 @@ struct mstdnt_timeline_args
int with_muted;
};
-int mastodont_timeline_home(mastodont_t* data,
+int mastodont_timeline_home(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
-int mastodont_timeline_list(mastodont_t* data,
+int mastodont_timeline_list(mastodont_t* data, struct mstdnt_args* args,
char* list_id,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
-int mastodont_timeline_public(mastodont_t* data,
+int mastodont_timeline_public(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* statuses_size);
-int mastodont_timeline_direct(mastodont_t* data,
+int mastodont_timeline_direct(mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* statuses_size);
-int mastodont_timeline_tag(mastodont_t* data,
+int mastodont_timeline_tag(mastodont_t* data, struct mstdnt_args* args,
char* hashtag,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
diff --git a/src/account.c b/src/account.c
index 94da72b..a87666d 100644
--- a/src/account.c
+++ b/src/account.c
@@ -54,7 +54,7 @@ int mstdnt_accounts_json_callback(cJSON* json, void* _args)
}
static int mastodont_get_accounts_query(char* url,
- mastodont_t* data,
+ mastodont_t* data, struct mstdnt_args* args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
@@ -85,10 +85,10 @@ static int mastodont_get_accounts_query(char* url,
mstdnt_accounts_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_get_followers(mastodont_t* data,
+int mastodont_get_followers(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
@@ -100,7 +100,7 @@ int mastodont_get_followers(mastodont_t* data,
return mastodont_get_accounts_query(url, data, args, storage, accts, accts_len);
}
-int mastodont_get_following(mastodont_t* data,
+int mastodont_get_following(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
@@ -112,7 +112,7 @@ int mastodont_get_following(mastodont_t* data,
return mastodont_get_accounts_query(url, data, args, storage, accts, accts_len);
}
-int mastodont_get_blocks(mastodont_t* data,
+int mastodont_get_blocks(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
@@ -121,7 +121,7 @@ int mastodont_get_blocks(mastodont_t* data,
return mastodont_get_accounts_query("api/v1/blocks", data, args, storage, accts, accts_len);
}
-int mastodont_get_mutes(mastodont_t* data,
+int mastodont_get_mutes(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
@@ -130,7 +130,7 @@ int mastodont_get_mutes(mastodont_t* data,
return mastodont_get_accounts_query("api/v1/mutes", data, args, storage, accts, accts_len);
}
-int mastodont_get_account(mastodont_t* data,
+int mastodont_get_account(mastodont_t* data, struct mstdnt_args* m_args,
int lookup, /* TODO move into separate function for consistancy */
char* id,
struct mstdnt_account* acct,
@@ -153,10 +153,10 @@ int mastodont_get_account(mastodont_t* data,
mstdnt_account_json_callback, /* callback */
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_verify_credentials(mastodont_t* data,
+int mastodont_verify_credentials(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_account* acct,
struct mstdnt_storage* storage)
{
@@ -171,7 +171,7 @@ int mastodont_verify_credentials(mastodont_t* data,
mstdnt_account_json_callback, /* callback */
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
int mstdnt_account_json(struct mstdnt_account* acct, cJSON* js)
@@ -217,7 +217,7 @@ int mstdnt_account_json(struct mstdnt_account* acct, cJSON* js)
}
-int mstdnt_account_action(mastodont_t* data,
+int mstdnt_account_action(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_relationship* rel,
@@ -237,7 +237,7 @@ int mstdnt_account_action(mastodont_t* data,
mstdnt_relationship_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
/* These are all the same */
diff --git a/src/application.c b/src/application.c
index f34f226..973d658 100644
--- a/src/application.c
+++ b/src/application.c
@@ -69,7 +69,7 @@ static int mstdnt_token_json_callback(cJSON* json, void* args)
return mstdnt_token_json(json, args);
}
-int mastodont_register_app(mastodont_t* data,
+int mastodont_register_app(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_args* args,
struct mstdnt_storage* storage,
struct mstdnt_app* app)
@@ -92,11 +92,11 @@ int mastodont_register_app(mastodont_t* data,
mstdnt_app_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_obtain_oauth_token(mastodont_t* data,
+int mastodont_obtain_oauth_token(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_args* args,
struct mstdnt_storage* storage,
struct mstdnt_oauth_token* token)
@@ -125,6 +125,6 @@ int mastodont_obtain_oauth_token(mastodont_t* data,
mstdnt_token_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
diff --git a/src/attachment.c b/src/attachment.c
index b535d39..e3568ad 100644
--- a/src/attachment.c
+++ b/src/attachment.c
@@ -98,7 +98,7 @@ static int mstdnt_attachment_json_callback(cJSON* json, void* _args)
return mstdnt_attachment_json(json, _args);
}
-int mastodont_upload_media(mastodont_t* api,
+int mastodont_upload_media(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_upload_media_args* args,
struct mstdnt_storage* storage,
struct mstdnt_attachment* attachment)
diff --git a/src/instance.c b/src/instance.c
index b022e84..1c750cf 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -15,7 +15,7 @@
#include
-int mastodont_instance(mastodont_t* api,
+int mastodont_instance(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_instance* inst)
{
return -1;
diff --git a/src/list.c b/src/list.c
index 7fa66cb..e5d39f3 100644
--- a/src/list.c
+++ b/src/list.c
@@ -72,7 +72,7 @@ static int mstdnt_lists_json_callback(cJSON* json, void* _args)
return mstdnt_lists_json(args->lists, args->size, json);
}
-int mastodont_get_lists(mastodont_t* data,
+int mastodont_get_lists(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_storage* storage,
struct mstdnt_list* lists[],
size_t* size)
@@ -93,10 +93,10 @@ int mastodont_get_lists(mastodont_t* data,
mstdnt_lists_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_get_list(mastodont_t* data,
+int mastodont_get_list(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_list* list)
@@ -115,7 +115,7 @@ int mastodont_get_list(mastodont_t* data,
mstdnt_list_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
static const char* replies_policy_str(enum mstdnt_list_replies_policy pol)
@@ -132,7 +132,7 @@ static const char* replies_policy_str(enum mstdnt_list_replies_policy pol)
}
}
-int mastodont_create_list(mastodont_t* data,
+int mastodont_create_list(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_list_args* args,
struct mstdnt_storage* storage,
struct mstdnt_list* list)
@@ -153,10 +153,10 @@ int mastodont_create_list(mastodont_t* data,
mstdnt_list_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_update_list(mastodont_t* data,
+int mastodont_update_list(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_list_args* args,
struct mstdnt_storage* storage,
@@ -181,10 +181,10 @@ int mastodont_update_list(mastodont_t* data,
mstdnt_list_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_delete_list(mastodont_t* api,
+int mastodont_delete_list(mastodont_t* api, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage)
{
@@ -205,7 +205,7 @@ int mastodont_delete_list(mastodont_t* api,
return mastodont_request(api, &req_args);
}
-int mastodont_list_add_accounts(mastodont_t* api,
+int mastodont_list_add_accounts(mastodont_t* api, struct mstdnt_args* args,
char* id,
char** account_ids,
size_t account_ids_len,
@@ -237,7 +237,7 @@ int mastodont_list_add_accounts(mastodont_t* api,
return mastodont_request(api, &req_args);
}
-int mastodont_list_remove_accounts(mastodont_t* api,
+int mastodont_list_remove_accounts(mastodont_t* api, struct mstdnt_args* args,
char* id,
char** account_ids,
size_t account_ids_len,
@@ -269,7 +269,7 @@ int mastodont_list_remove_accounts(mastodont_t* api,
return mastodont_request(api, &req_args);
}
-int mastodont_list_get_accounts(mastodont_t* data,
+int mastodont_list_get_accounts(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
@@ -303,7 +303,7 @@ int mastodont_list_get_accounts(mastodont_t* data,
mstdnt_accounts_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
void mstdnt_cleanup_lists(struct mstdnt_list* lists)
diff --git a/src/mastodont.c b/src/mastodont.c
index 55ecb79..45e1af4 100644
--- a/src/mastodont.c
+++ b/src/mastodont.c
@@ -13,31 +13,15 @@ void mastodont_global_curl_cleanup()
curl_global_cleanup();
}
-int mastodont_init(mastodont_t* data, uint16_t flags)
+int mastodont_init(mastodont_t* data, struct mstdnt_args* m_args, uint16_t flags)
{
data->curl = curl_easy_init();
- data->token = NULL;
- data->token_heap = 0;
- data->flags = flags;
return data->curl == NULL;
}
-int mastodont_set_token(mastodont_t* data, char* token)
-{
- char* mtoken = malloc(strlen(token)+1);
- if (!mtoken)
- return 1;
- data->token_heap = 1;
- strcpy(mtoken, token);
- data->token = mtoken;
- return 0;
-}
-
void mastodont_cleanup(mastodont_t* data)
{
curl_easy_cleanup(data->curl);
- if (data->token_heap)
- free(data->token);
}
void mastodont_free(void* ptr)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index a234a42..60a0c8a 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -94,7 +94,7 @@ int mstdnt_nodeinfo_json_callback(cJSON* json, void* nodeinfo)
return mstdnt_nodeinfo_json(nodeinfo, json);
}
-int mastodont_get_nodeinfo(mastodont_t* api,
+int mastodont_get_nodeinfo(mastodont_t* api, struct mstdnt_args* args,
char* version,
struct mstdnt_storage* storage,
struct mstdnt_nodeinfo* nodeinfo)
diff --git a/src/notification.c b/src/notification.c
index 169b568..6486369 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -75,7 +75,7 @@ int mstdnt_notifications_json_callback(cJSON* json, void* _args)
return mstdnt_notifications_json(args->notif, args->size, json);
}
-int mastodont_get_notifications(mastodont_t* data,
+int mastodont_get_notifications(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_get_notifications_args* args,
struct mstdnt_storage* storage,
struct mstdnt_notification** notifs,
@@ -116,7 +116,7 @@ int mastodont_get_notifications(mastodont_t* data,
mstdnt_notifications_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
void mstdnt_cleanup_notifications(struct mstdnt_notification* notifs, size_t notifs_len)
diff --git a/src/relationship.c b/src/relationship.c
index a0d7b29..a360ed9 100644
--- a/src/relationship.c
+++ b/src/relationship.c
@@ -96,7 +96,7 @@ int mstdnt_relationships_json_callback(cJSON* json, void* _args)
return mstdnt_relationships_json(args->relationships, args->size, json);
}
-int mastodont_get_relationships(mastodont_t* data,
+int mastodont_get_relationships(mastodont_t* data, struct mstdnt_args* m_args,
char** ids,
size_t ids_len,
struct mstdnt_storage* storage,
@@ -124,7 +124,7 @@ int mastodont_get_relationships(mastodont_t* data,
mstdnt_relationships_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
void mstdnt_cleanup_relationships(struct mstdnt_relationship* rels)
diff --git a/src/scrobbles.c b/src/scrobbles.c
index 58def49..3ce7d71 100644
--- a/src/scrobbles.c
+++ b/src/scrobbles.c
@@ -52,7 +52,7 @@ int mstdnt_scrobbles_json_callback(cJSON* json, void* _args)
return mstdnt_scrobbles_json(args->scrobbles, args->size, json);
}
-int mastodont_get_scrobbles(mastodont_t* data,
+int mastodont_get_scrobbles(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_get_scrobbles_args* args,
struct mstdnt_storage* storage,
@@ -82,6 +82,6 @@ int mastodont_get_scrobbles(mastodont_t* data,
mstdnt_scrobbles_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
diff --git a/src/search.c b/src/search.c
index 2cf3689..515adb4 100644
--- a/src/search.c
+++ b/src/search.c
@@ -61,7 +61,7 @@ int mstdnt_search_json_callback(cJSON* json, void* _args)
return mstdnt_search_json(_args, json);
}
-int mastodont_search(mastodont_t* data,
+int mastodont_search(mastodont_t* data, struct mstdnt_args* m_args,
char* query,
struct mstdnt_storage* storage,
struct mstdnt_search_args* args,
@@ -92,7 +92,7 @@ int mastodont_search(mastodont_t* data,
mstdnt_search_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
void mstdnt_cleanup_search_results(struct mstdnt_search_results* res)
diff --git a/src/static.c b/src/static.c
index 52d6b76..ed81934 100644
--- a/src/static.c
+++ b/src/static.c
@@ -16,13 +16,13 @@
#include
#include
-int mastodont_instance_panel(mastodont_t* api,
+int mastodont_instance_panel(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_fetch_results* html)
{
return mastodont_fetch_curl(api, "instance/panel.html", html, CURLOPT_HTTPGET, NULL);
}
-int mastodont_terms_of_service(mastodont_t* api,
+int mastodont_terms_of_service(mastodont_t* api, struct mstdnt_args* args,
struct mstdnt_fetch_results* html)
{
return mastodont_fetch_curl(api, "static/terms-of-service.html", html, CURLOPT_HTTPGET, NULL);
diff --git a/src/status.c b/src/status.c
index a23c56c..e2db89b 100644
--- a/src/status.c
+++ b/src/status.c
@@ -143,7 +143,7 @@ int mstdnt_statuses_json_callback(cJSON* json, void* _args)
return mstdnt_statuses_json(args->statuses, args->size, json);
}
-int mastodont_get_account_statuses(mastodont_t* data,
+int mastodont_get_account_statuses(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_statuses_args* args,
struct mstdnt_storage* storage,
@@ -179,11 +179,11 @@ int mastodont_get_account_statuses(mastodont_t* data,
mstdnt_statuses_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
/* TODO Populate the arguments! */
-int mastodont_create_status(mastodont_t* data,
+int mastodont_create_status(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_args* args,
struct mstdnt_storage* storage)
{
@@ -212,10 +212,10 @@ int mastodont_create_status(mastodont_t* data,
* (not sure if the api returns it or not) */
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-static int mstdnt_status_action(mastodont_t* data,
+static int mstdnt_status_action(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status,
@@ -235,7 +235,7 @@ static int mstdnt_status_action(mastodont_t* data,
mstdnt_status_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
/* These are all the same */
@@ -280,11 +280,11 @@ MSTDNT_STATUS_ACTION_DECL(delete)
mstdnt_status_json_callback
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
/* TODO Mutes can be timed */
-int mastodont_mute_conversation(mastodont_t* data,
+int mastodont_mute_conversation(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status)
@@ -292,7 +292,7 @@ int mastodont_mute_conversation(mastodont_t* data,
return mstdnt_status_action(data, id, storage, status, "api/v1/statuses/%s/mute");
}
-int mastodont_unmute_conversation(mastodont_t* data,
+int mastodont_unmute_conversation(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status)
@@ -300,7 +300,7 @@ int mastodont_unmute_conversation(mastodont_t* data,
return mstdnt_status_action(data, id, storage, status, "api/v1/statuses/%s/unmute");
}
-int mastodont_get_status(mastodont_t* data,
+int mastodont_get_status(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status)
@@ -319,7 +319,7 @@ int mastodont_get_status(mastodont_t* data,
mstdnt_status_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
int mstdnt_status_context_json(struct mstdnt_status* statuses_before[],
@@ -381,7 +381,7 @@ int mstdnt_status_context_json_callback(cJSON* json, void* _args)
json);
}
-int mastodont_get_status_context(mastodont_t* data,
+int mastodont_get_status_context(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses_before[],
@@ -409,10 +409,10 @@ int mastodont_get_status_context(mastodont_t* data,
mstdnt_status_context_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_status_favourited_by(mastodont_t* data,
+int mastodont_status_favourited_by(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_account* accounts[],
@@ -436,10 +436,10 @@ int mastodont_status_favourited_by(mastodont_t* data,
mstdnt_accounts_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_status_reblogged_by(mastodont_t* data,
+int mastodont_status_reblogged_by(mastodont_t* data, struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_account* accounts[],
@@ -463,11 +463,11 @@ int mastodont_status_reblogged_by(mastodont_t* data,
mstdnt_accounts_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_get_bookmarks(mastodont_t* data,
+int mastodont_get_bookmarks(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_bookmarks_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
@@ -493,10 +493,10 @@ int mastodont_get_bookmarks(mastodont_t* data,
mstdnt_statuses_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_get_favourites(mastodont_t* data,
+int mastodont_get_favourites(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_favourites_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
@@ -521,10 +521,10 @@ int mastodont_get_favourites(mastodont_t* data,
mstdnt_statuses_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_status_emoji_react(mastodont_t* api, char* id, char* emoji,
+int mastodont_status_emoji_react(mastodont_t* api, struct mstdnt_args* args, char* id, char* emoji,
struct mstdnt_storage* storage, struct mstdnt_status* status)
{
char url[MSTDNT_URLSIZE];
diff --git a/src/timeline.c b/src/timeline.c
index 273a31f..45380ea 100644
--- a/src/timeline.c
+++ b/src/timeline.c
@@ -20,7 +20,7 @@
#include
#include
-int mastodont_timeline_list(mastodont_t* data,
+int mastodont_timeline_list(mastodont_t* data, struct mstdnt_args* m_args,
char* list_id,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
@@ -55,10 +55,10 @@ int mastodont_timeline_list(mastodont_t* data,
mstdnt_statuses_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_timeline_tag(mastodont_t* data,
+int mastodont_timeline_tag(mastodont_t* data, struct mstdnt_args* m_args,
char* hashtag,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
@@ -96,7 +96,7 @@ int mastodont_timeline_tag(mastodont_t* data,
mstdnt_statuses_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
static const char* reply_visibility_str(enum mstdnt_reply_visibility vis)
@@ -113,7 +113,7 @@ static const char* reply_visibility_str(enum mstdnt_reply_visibility vis)
}
}
-int mastodont_timeline_public(mastodont_t* data,
+int mastodont_timeline_public(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
@@ -145,11 +145,11 @@ int mastodont_timeline_public(mastodont_t* data,
mstdnt_statuses_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_timeline_direct(mastodont_t* data,
+int mastodont_timeline_direct(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
@@ -177,11 +177,11 @@ int mastodont_timeline_direct(mastodont_t* data,
mstdnt_statuses_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}
-int mastodont_timeline_home(mastodont_t* data,
+int mastodont_timeline_home(mastodont_t* data, struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
@@ -214,6 +214,6 @@ int mastodont_timeline_home(mastodont_t* data,
mstdnt_statuses_json_callback,
};
- return mastodont_request(data, &req_args);
+ return mastodont_request(data, m_args,&req_args);
}