mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge remote-tracking branch 'origin/master' into clear
This commit is contained in:
commit
d3a2119f8b
@ -6,6 +6,8 @@
|
|||||||
0.5.1
|
0.5.1
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
- Add prof.get_room_nick plugins api function
|
||||||
|
- Add main.help.header theme option
|
||||||
- Look for system TLS certificate path by default (/tls certpath)
|
- Look for system TLS certificate path by default (/tls certpath)
|
||||||
- Allow plugins to complete file paths with prof.filepath_completer_add function
|
- Allow plugins to complete file paths with prof.filepath_completer_add function
|
||||||
- Bug fixes: https://github.com/boothj5/profanity/milestone/15?closed=1
|
- Bug fixes: https://github.com/boothj5/profanity/milestone/15?closed=1
|
||||||
|
@ -360,6 +360,7 @@ cmd_ac_init(void)
|
|||||||
autocomplete_add(account_clear_ac, "pgpkeyid");
|
autocomplete_add(account_clear_ac, "pgpkeyid");
|
||||||
autocomplete_add(account_clear_ac, "startscript");
|
autocomplete_add(account_clear_ac, "startscript");
|
||||||
autocomplete_add(account_clear_ac, "theme");
|
autocomplete_add(account_clear_ac, "theme");
|
||||||
|
autocomplete_add(account_clear_ac, "muc");
|
||||||
|
|
||||||
account_default_ac = autocomplete_new();
|
account_default_ac = autocomplete_new();
|
||||||
autocomplete_add(account_default_ac, "set");
|
autocomplete_add(account_default_ac, "set");
|
||||||
|
@ -1989,7 +1989,8 @@ static struct cmd_t command_defs[] =
|
|||||||
"/account clear <account> port",
|
"/account clear <account> port",
|
||||||
"/account clear <account> otr",
|
"/account clear <account> otr",
|
||||||
"/account clear <account> pgpkeyid",
|
"/account clear <account> pgpkeyid",
|
||||||
"/account clear <account> startscript")
|
"/account clear <account> startscript",
|
||||||
|
"/account clean <account> muc")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Commands for creating and managing accounts. "
|
"Commands for creating and managing accounts. "
|
||||||
"Calling with no arguments will display information for the current account.")
|
"Calling with no arguments will display information for the current account.")
|
||||||
@ -2012,7 +2013,7 @@ static struct cmd_t command_defs[] =
|
|||||||
{ "set <account> resource <resource>", "The resource to be used for this account, defaults to 'profanity'." },
|
{ "set <account> resource <resource>", "The resource to be used for this account, defaults to 'profanity'." },
|
||||||
{ "set <account> password <password>", "Password for the account, note this is currently stored in plaintext if set." },
|
{ "set <account> password <password>", "Password for the account, note this is currently stored in plaintext if set." },
|
||||||
{ "set <account> eval_password <command>", "Shell command evaluated to retrieve password for the account. Can be used to retrieve password from keyring." },
|
{ "set <account> eval_password <command>", "Shell command evaluated to retrieve password for the account. Can be used to retrieve password from keyring." },
|
||||||
{ "set <account> muc <service>", "The default MUC chat service to use, defaults to 'conference.<domainpart>' where the domain part is from the account JID." },
|
{ "set <account> muc <service>", "The default MUC chat service to use, defaults to the servers disco info response." },
|
||||||
{ "set <account> nick <nick>", "The default nickname to use when joining chat rooms." },
|
{ "set <account> nick <nick>", "The default nickname to use when joining chat rooms." },
|
||||||
{ "set <account> otr <policy>", "Override global OTR policy for this account, see /otr." },
|
{ "set <account> otr <policy>", "Override global OTR policy for this account, see /otr." },
|
||||||
{ "set <account> pgpkeyid <pgpkeyid>", "Set the ID of the PGP key for this account, see /pgp." },
|
{ "set <account> pgpkeyid <pgpkeyid>", "Set the ID of the PGP key for this account, see /pgp." },
|
||||||
@ -2028,7 +2029,8 @@ static struct cmd_t command_defs[] =
|
|||||||
{ "clear <account> otr", "Remove the OTR policy setting for this account." },
|
{ "clear <account> otr", "Remove the OTR policy setting for this account." },
|
||||||
{ "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." },
|
{ "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." },
|
||||||
{ "clear <account> startscript", "Remove startscript associated with this account." },
|
{ "clear <account> startscript", "Remove startscript associated with this account." },
|
||||||
{ "clear <account> theme", "Clear the theme setting for the account, the global theme will be used." })
|
{ "clear <account> theme", "Clear the theme setting for the account, the global theme will be used." },
|
||||||
|
{ "clear <account> muc", "Remove the default MUC service setting."})
|
||||||
CMD_EXAMPLES(
|
CMD_EXAMPLES(
|
||||||
"/account add me",
|
"/account add me",
|
||||||
"/account set me jid me@chatty",
|
"/account set me jid me@chatty",
|
||||||
|
@ -959,6 +959,10 @@ cmd_account_clear(ProfWin *window, const char *const command, gchar **args)
|
|||||||
accounts_clear_theme(account_name);
|
accounts_clear_theme(account_name);
|
||||||
cons_show("Removed theme for account %s", account_name);
|
cons_show("Removed theme for account %s", account_name);
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
} else if (strcmp(property, "muc") == 0) {
|
||||||
|
accounts_clear_muc(account_name);
|
||||||
|
cons_show("Removed MUC service for account %s", account_name);
|
||||||
|
cons_show("");
|
||||||
} else {
|
} else {
|
||||||
cons_show("Invalid property: %s", property);
|
cons_show("Invalid property: %s", property);
|
||||||
cons_show("");
|
cons_show("");
|
||||||
@ -3426,7 +3430,7 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
if (args[0] == NULL) {
|
if (args[0] == NULL) {
|
||||||
char *account_name = session_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
ProfAccount *account = accounts_get_account(account_name);
|
ProfAccount *account = accounts_get_account(account_name);
|
||||||
|
if (account->muc_service) {
|
||||||
GString *room_str = g_string_new("");
|
GString *room_str = g_string_new("");
|
||||||
char *uuid = connection_create_uuid();
|
char *uuid = connection_create_uuid();
|
||||||
g_string_append_printf(room_str, "private-chat-%s@%s", uuid, account->muc_service);
|
g_string_append_printf(room_str, "private-chat-%s@%s", uuid, account->muc_service);
|
||||||
@ -3437,6 +3441,9 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
|
|
||||||
g_string_free(room_str, TRUE);
|
g_string_free(room_str, TRUE);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
|
} else {
|
||||||
|
cons_show("Account MUC service property not found.");
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -3451,7 +3458,6 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
char *room = NULL;
|
char *room = NULL;
|
||||||
char *nick = NULL;
|
char *nick = NULL;
|
||||||
char *passwd = NULL;
|
char *passwd = NULL;
|
||||||
GString *room_str = g_string_new("");
|
|
||||||
char *account_name = session_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
ProfAccount *account = accounts_get_account(account_name);
|
ProfAccount *account = accounts_get_account(account_name);
|
||||||
|
|
||||||
@ -3460,11 +3466,18 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
room = args[0];
|
room = args[0];
|
||||||
|
|
||||||
// server not supplied (room), use account preference
|
// server not supplied (room), use account preference
|
||||||
} else {
|
} else if (account->muc_service) {
|
||||||
|
GString *room_str = g_string_new("");
|
||||||
g_string_append(room_str, args[0]);
|
g_string_append(room_str, args[0]);
|
||||||
g_string_append(room_str, "@");
|
g_string_append(room_str, "@");
|
||||||
g_string_append(room_str, account->muc_service);
|
g_string_append(room_str, account->muc_service);
|
||||||
room = room_str->str;
|
room = room_str->str;
|
||||||
|
g_string_free(room_str, FALSE);
|
||||||
|
|
||||||
|
// no account preference
|
||||||
|
} else {
|
||||||
|
cons_show("Account MUC service property not found.");
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional args supplied
|
// Additional args supplied
|
||||||
@ -3502,7 +3515,6 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jid_destroy(room_arg);
|
jid_destroy(room_arg);
|
||||||
g_string_free(room_str, TRUE);
|
|
||||||
account_free(account);
|
account_free(account);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4307,14 +4319,19 @@ cmd_rooms(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0] == NULL) {
|
if (args[0]) {
|
||||||
ProfAccount *account = accounts_get_account(session_get_account_name());
|
|
||||||
iq_room_list_request(account->muc_service);
|
|
||||||
account_free(account);
|
|
||||||
} else {
|
|
||||||
iq_room_list_request(args[0]);
|
iq_room_list_request(args[0]);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfAccount *account = accounts_get_account(session_get_account_name());
|
||||||
|
if (account->muc_service) {
|
||||||
|
iq_room_list_request(account->muc_service);
|
||||||
|
} else {
|
||||||
|
cons_show("Account MUC service property not found.");
|
||||||
|
}
|
||||||
|
account_free(account);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,17 +115,10 @@ account_new(const gchar *const name, const gchar *const jid,
|
|||||||
new_account->priority_xa = priority_xa;
|
new_account->priority_xa = priority_xa;
|
||||||
new_account->priority_dnd = priority_dnd;
|
new_account->priority_dnd = priority_dnd;
|
||||||
|
|
||||||
if (muc_service == NULL) {
|
if (muc_service) {
|
||||||
GString *g_muc_service = g_string_new("conference.");
|
|
||||||
Jid *jidp = jid_create(new_account->jid);
|
|
||||||
g_string_append(g_muc_service, jidp->domainpart);
|
|
||||||
|
|
||||||
new_account->muc_service = g_muc_service->str;
|
|
||||||
|
|
||||||
g_string_free(g_muc_service, FALSE);
|
|
||||||
jid_destroy(jidp);
|
|
||||||
} else {
|
|
||||||
new_account->muc_service = strdup(muc_service);
|
new_account->muc_service = strdup(muc_service);
|
||||||
|
} else {
|
||||||
|
new_account->muc_service = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (muc_nick == NULL) {
|
if (muc_nick == NULL) {
|
||||||
@ -224,7 +217,10 @@ account_eval_password(ProfAccount *account)
|
|||||||
void
|
void
|
||||||
account_free(ProfAccount *account)
|
account_free(ProfAccount *account)
|
||||||
{
|
{
|
||||||
if (account) {
|
if (account == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
free(account->name);
|
free(account->name);
|
||||||
free(account->jid);
|
free(account->jid);
|
||||||
free(account->password);
|
free(account->password);
|
||||||
@ -244,5 +240,4 @@ account_free(ProfAccount *account)
|
|||||||
g_list_free_full(account->otr_opportunistic, g_free);
|
g_list_free_full(account->otr_opportunistic, g_free);
|
||||||
g_list_free_full(account->otr_always, g_free);
|
g_list_free_full(account->otr_always, g_free);
|
||||||
free(account);
|
free(account);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,11 @@ accounts_add(const char *account_name, const char *altdomain, const int port, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// doesn't yet exist
|
if (g_key_file_has_group(accounts, account_name)) {
|
||||||
if (!g_key_file_has_group(accounts, account_name)) {
|
jid_destroy(jid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
g_key_file_set_boolean(accounts, account_name, "enabled", TRUE);
|
g_key_file_set_boolean(accounts, account_name, "enabled", TRUE);
|
||||||
g_key_file_set_string(accounts, account_name, "jid", barejid);
|
g_key_file_set_string(accounts, account_name, "jid", barejid);
|
||||||
g_key_file_set_string(accounts, account_name, "resource", resource);
|
g_key_file_set_string(accounts, account_name, "resource", resource);
|
||||||
@ -149,15 +152,13 @@ accounts_add(const char *account_name, const char *altdomain, const int port, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
Jid *jidp = jid_create(barejid);
|
Jid *jidp = jid_create(barejid);
|
||||||
GString *muc_service = g_string_new("conference.");
|
|
||||||
g_string_append(muc_service, jidp->domainpart);
|
|
||||||
g_key_file_set_string(accounts, account_name, "muc.service", muc_service->str);
|
|
||||||
g_string_free(muc_service, TRUE);
|
|
||||||
if (jidp->localpart == NULL) {
|
if (jidp->localpart == NULL) {
|
||||||
g_key_file_set_string(accounts, account_name, "muc.nick", jidp->domainpart);
|
g_key_file_set_string(accounts, account_name, "muc.nick", jidp->domainpart);
|
||||||
} else {
|
} else {
|
||||||
g_key_file_set_string(accounts, account_name, "muc.nick", jidp->localpart);
|
g_key_file_set_string(accounts, account_name, "muc.nick", jidp->localpart);
|
||||||
}
|
}
|
||||||
|
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
|
|
||||||
g_key_file_set_string(accounts, account_name, "presence.last", "online");
|
g_key_file_set_string(accounts, account_name, "presence.last", "online");
|
||||||
@ -171,7 +172,6 @@ accounts_add(const char *account_name, const char *altdomain, const int port, co
|
|||||||
_save_accounts();
|
_save_accounts();
|
||||||
autocomplete_add(all_ac, account_name);
|
autocomplete_add(all_ac, account_name);
|
||||||
autocomplete_add(enabled_ac, account_name);
|
autocomplete_add(enabled_ac, account_name);
|
||||||
}
|
|
||||||
|
|
||||||
jid_destroy(jid);
|
jid_destroy(jid);
|
||||||
}
|
}
|
||||||
@ -223,7 +223,18 @@ accounts_get_account(const char *const name)
|
|||||||
int priority_xa = g_key_file_get_integer(accounts, name, "priority.xa", NULL);
|
int priority_xa = g_key_file_get_integer(accounts, name, "priority.xa", NULL);
|
||||||
int priority_dnd = g_key_file_get_integer(accounts, name, "priority.dnd", NULL);
|
int priority_dnd = g_key_file_get_integer(accounts, name, "priority.dnd", NULL);
|
||||||
|
|
||||||
gchar *muc_service = g_key_file_get_string(accounts, name, "muc.service", NULL);
|
gchar *muc_service = NULL;
|
||||||
|
if (g_key_file_has_key(accounts, name, "muc.service", NULL)) {
|
||||||
|
muc_service = g_key_file_get_string(accounts, name, "muc.service", NULL);
|
||||||
|
} else {
|
||||||
|
jabber_conn_status_t conn_status = connection_get_status();
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
|
char* conf_jid = connection_jid_for_feature(XMPP_FEATURE_MUC);
|
||||||
|
if (conf_jid) {
|
||||||
|
muc_service = strdup(conf_jid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
gchar *muc_nick = g_key_file_get_string(accounts, name, "muc.nick", NULL);
|
gchar *muc_nick = g_key_file_get_string(accounts, name, "muc.nick", NULL);
|
||||||
|
|
||||||
gchar *otr_policy = NULL;
|
gchar *otr_policy = NULL;
|
||||||
@ -416,10 +427,6 @@ accounts_set_jid(const char *const account_name, const char *const value)
|
|||||||
g_key_file_set_string(accounts, account_name, "resource", jid->resourcepart);
|
g_key_file_set_string(accounts, account_name, "resource", jid->resourcepart);
|
||||||
}
|
}
|
||||||
|
|
||||||
GString *muc_service = g_string_new("conference.");
|
|
||||||
g_string_append(muc_service, jid->domainpart);
|
|
||||||
g_key_file_set_string(accounts, account_name, "muc.service", muc_service->str);
|
|
||||||
g_string_free(muc_service, TRUE);
|
|
||||||
if (jid->localpart == NULL) {
|
if (jid->localpart == NULL) {
|
||||||
g_key_file_set_string(accounts, account_name, "muc.nick", jid->domainpart);
|
g_key_file_set_string(accounts, account_name, "muc.nick", jid->domainpart);
|
||||||
} else {
|
} else {
|
||||||
@ -568,6 +575,15 @@ accounts_clear_theme(const char *const account_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
accounts_clear_muc(const char *const account_name)
|
||||||
|
{
|
||||||
|
if (accounts_account_exists(account_name)) {
|
||||||
|
g_key_file_remove_key(accounts, account_name, "muc.service", NULL);
|
||||||
|
_save_accounts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
accounts_clear_otr(const char *const account_name)
|
accounts_clear_otr(const char *const account_name)
|
||||||
{
|
{
|
||||||
|
@ -93,6 +93,7 @@ void accounts_clear_otr(const char *const account_name);
|
|||||||
void accounts_clear_pgp_keyid(const char *const account_name);
|
void accounts_clear_pgp_keyid(const char *const account_name);
|
||||||
void accounts_clear_script_start(const char *const account_name);
|
void accounts_clear_script_start(const char *const account_name);
|
||||||
void accounts_clear_theme(const char *const account_name);
|
void accounts_clear_theme(const char *const account_name);
|
||||||
|
void accounts_clear_muc(const char *const account_name);
|
||||||
void accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy);
|
void accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -270,6 +270,12 @@ api_current_win_is_console(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char*
|
||||||
|
api_get_room_nick(const char *barejid)
|
||||||
|
{
|
||||||
|
return muc_nick(barejid);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
api_log_debug(const char *message)
|
api_log_debug(const char *message)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,8 @@ gboolean api_current_win_is_console(void);
|
|||||||
char* api_get_current_nick(void);
|
char* api_get_current_nick(void);
|
||||||
char** api_get_current_occupants(void);
|
char** api_get_current_occupants(void);
|
||||||
|
|
||||||
|
char* api_get_room_nick(const char *barejid);
|
||||||
|
|
||||||
void api_register_command(const char *const plugin_name, const char *command_name, int min_args, int max_args,
|
void api_register_command(const char *const plugin_name, const char *command_name, int min_args, int max_args,
|
||||||
char **synopsis, const char *description, char *arguments[][2], char **examples,
|
char **synopsis, const char *description, char *arguments[][2], char **examples,
|
||||||
void *callback, void(*callback_func)(PluginCommand *command, gchar **args), void(*callback_destroy)(void *callback));
|
void *callback, void(*callback_func)(PluginCommand *command, gchar **args), void(*callback_destroy)(void *callback));
|
||||||
|
@ -195,6 +195,12 @@ c_api_get_current_occupants(void)
|
|||||||
return api_get_current_occupants();
|
return api_get_current_occupants();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char*
|
||||||
|
c_api_get_room_nick(const char *barejid)
|
||||||
|
{
|
||||||
|
return api_get_room_nick(barejid);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
c_api_log_debug(const char *message)
|
c_api_log_debug(const char *message)
|
||||||
{
|
{
|
||||||
@ -380,6 +386,7 @@ c_api_init(void)
|
|||||||
prof_current_win_is_console = c_api_current_win_is_console;
|
prof_current_win_is_console = c_api_current_win_is_console;
|
||||||
prof_get_current_nick = c_api_get_current_nick;
|
prof_get_current_nick = c_api_get_current_nick;
|
||||||
prof_get_current_occupants = c_api_get_current_occupants;
|
prof_get_current_occupants = c_api_get_current_occupants;
|
||||||
|
prof_get_room_nick = c_api_get_room_nick;
|
||||||
prof_log_debug = c_api_log_debug;
|
prof_log_debug = c_api_log_debug;
|
||||||
prof_log_info = c_api_log_info;
|
prof_log_info = c_api_log_info;
|
||||||
prof_log_warning = c_api_log_warning;
|
prof_log_warning = c_api_log_warning;
|
||||||
|
@ -63,6 +63,8 @@ int (*prof_current_win_is_console)(void) = NULL;
|
|||||||
char* (*prof_get_current_nick)(void) = NULL;
|
char* (*prof_get_current_nick)(void) = NULL;
|
||||||
char** (*prof_get_current_occupants)(void) = NULL;
|
char** (*prof_get_current_occupants)(void) = NULL;
|
||||||
|
|
||||||
|
char* (*prof_get_room_nick)(const char *barejid) = NULL;
|
||||||
|
|
||||||
void (*prof_log_debug)(const char *message) = NULL;
|
void (*prof_log_debug)(const char *message) = NULL;
|
||||||
void (*prof_log_info)(const char *message) = NULL;
|
void (*prof_log_info)(const char *message) = NULL;
|
||||||
void (*prof_log_warning)(const char *message) = NULL;
|
void (*prof_log_warning)(const char *message) = NULL;
|
||||||
|
@ -75,6 +75,8 @@ int (*prof_current_win_is_console)(void);
|
|||||||
char* (*prof_get_current_nick)(void);
|
char* (*prof_get_current_nick)(void);
|
||||||
char** (*prof_get_current_occupants)(void);
|
char** (*prof_get_current_occupants)(void);
|
||||||
|
|
||||||
|
char* (*prof_get_room_nick)(const char *barejid);
|
||||||
|
|
||||||
void (*prof_log_debug)(const char *message);
|
void (*prof_log_debug)(const char *message);
|
||||||
void (*prof_log_info)(const char *message);
|
void (*prof_log_info)(const char *message);
|
||||||
void (*prof_log_warning)(const char *message);
|
void (*prof_log_warning)(const char *message);
|
||||||
|
@ -475,6 +475,27 @@ python_api_current_win_is_console(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
python_api_get_room_nick(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
PyObject *barejid = NULL;
|
||||||
|
if (!PyArg_ParseTuple(args, "O", &barejid)) {
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *barejid_str = python_str_or_unicode_to_string(barejid);
|
||||||
|
|
||||||
|
allow_python_threads();
|
||||||
|
char *nick = api_get_room_nick(barejid_str);
|
||||||
|
free(barejid_str);
|
||||||
|
disable_python_threads();
|
||||||
|
if (nick) {
|
||||||
|
return Py_BuildValue("s", nick);
|
||||||
|
} else {
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
python_api_log_debug(PyObject *self, PyObject *args)
|
python_api_log_debug(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
@ -1095,6 +1116,7 @@ static PyMethodDef apiMethods[] = {
|
|||||||
{ "get_current_nick", python_api_get_current_nick, METH_VARARGS, "Return nickname in current room." },
|
{ "get_current_nick", python_api_get_current_nick, METH_VARARGS, "Return nickname in current room." },
|
||||||
{ "get_current_occupants", python_api_get_current_occupants, METH_VARARGS, "Return list of occupants in current room." },
|
{ "get_current_occupants", python_api_get_current_occupants, METH_VARARGS, "Return list of occupants in current room." },
|
||||||
{ "current_win_is_console", python_api_current_win_is_console, METH_VARARGS, "Returns whether the current window is the console." },
|
{ "current_win_is_console", python_api_current_win_is_console, METH_VARARGS, "Returns whether the current window is the console." },
|
||||||
|
{ "get_room_nick", python_api_get_room_nick, METH_VARARGS, "Return the nickname used in the specified room, or None if not in the room." },
|
||||||
{ "log_debug", python_api_log_debug, METH_VARARGS, "Log a debug message" },
|
{ "log_debug", python_api_log_debug, METH_VARARGS, "Log a debug message" },
|
||||||
{ "log_info", python_api_log_info, METH_VARARGS, "Log an info message" },
|
{ "log_info", python_api_log_info, METH_VARARGS, "Log an info message" },
|
||||||
{ "log_warning", python_api_log_warning, METH_VARARGS, "Log a warning message" },
|
{ "log_warning", python_api_log_warning, METH_VARARGS, "Log a warning message" },
|
||||||
|
@ -290,6 +290,10 @@ connection_supports(const char *const feature)
|
|||||||
char*
|
char*
|
||||||
connection_jid_for_feature(const char *const feature)
|
connection_jid_for_feature(const char *const feature)
|
||||||
{
|
{
|
||||||
|
if (conn.features_by_jid == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
GList *jids = g_hash_table_get_keys(conn.features_by_jid);
|
GList *jids = g_hash_table_get_keys(conn.features_by_jid);
|
||||||
|
|
||||||
GList *curr = jids;
|
GList *curr = jids;
|
||||||
|
@ -54,7 +54,6 @@ void connection_set_disco_items(GSList *items);
|
|||||||
xmpp_conn_t* connection_get_conn(void);
|
xmpp_conn_t* connection_get_conn(void);
|
||||||
xmpp_ctx_t* connection_get_ctx(void);
|
xmpp_ctx_t* connection_get_ctx(void);
|
||||||
char *connection_get_domain(void);
|
char *connection_get_domain(void);
|
||||||
char* connection_jid_for_feature(const char *const feature);
|
|
||||||
GHashTable* connection_get_features(const char *const jid);
|
GHashTable* connection_get_features(const char *const jid);
|
||||||
|
|
||||||
void connection_clear_data(void);
|
void connection_clear_data(void);
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
#define XMPP_FEATURE_BLOCKING "urn:xmpp:blocking"
|
#define XMPP_FEATURE_BLOCKING "urn:xmpp:blocking"
|
||||||
#define XMPP_FEATURE_RECEIPTS "urn:xmpp:receipts"
|
#define XMPP_FEATURE_RECEIPTS "urn:xmpp:receipts"
|
||||||
#define XMPP_FEATURE_LASTACTIVITY "jabber:iq:last"
|
#define XMPP_FEATURE_LASTACTIVITY "jabber:iq:last"
|
||||||
|
#define XMPP_FEATURE_MUC "http://jabber.org/protocol/muc"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JABBER_CONNECTING,
|
JABBER_CONNECTING,
|
||||||
@ -129,6 +130,7 @@ gboolean connection_is_secured(void);
|
|||||||
gboolean connection_send_stanza(const char *const stanza);
|
gboolean connection_send_stanza(const char *const stanza);
|
||||||
GList* connection_get_available_resources(void);
|
GList* connection_get_available_resources(void);
|
||||||
gboolean connection_supports(const char *const feature);
|
gboolean connection_supports(const char *const feature);
|
||||||
|
char* connection_jid_for_feature(const char *const feature);
|
||||||
|
|
||||||
char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url,
|
char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url,
|
||||||
gboolean request_receipt);
|
gboolean request_receipt);
|
||||||
|
@ -89,7 +89,6 @@ int main(int argc, char* argv[]) {
|
|||||||
PROF_FUNC_TEST(display_software_version_result_in_chat),
|
PROF_FUNC_TEST(display_software_version_result_in_chat),
|
||||||
|
|
||||||
PROF_FUNC_TEST(sends_room_join),
|
PROF_FUNC_TEST(sends_room_join),
|
||||||
PROF_FUNC_TEST(sends_room_join_with_default_muc_service),
|
|
||||||
PROF_FUNC_TEST(sends_room_join_with_nick),
|
PROF_FUNC_TEST(sends_room_join_with_nick),
|
||||||
PROF_FUNC_TEST(sends_room_join_with_password),
|
PROF_FUNC_TEST(sends_room_join_with_password),
|
||||||
PROF_FUNC_TEST(sends_room_join_with_nick_and_password),
|
PROF_FUNC_TEST(sends_room_join_with_nick_and_password),
|
||||||
|
@ -26,21 +26,6 @@ sends_room_join(void **state)
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
sends_room_join_with_default_muc_service(void **state)
|
|
||||||
{
|
|
||||||
prof_connect();
|
|
||||||
|
|
||||||
prof_input("/join testroom");
|
|
||||||
|
|
||||||
assert_true(stbbr_last_received(
|
|
||||||
"<presence id='*' to='testroom@conference.localhost/stabber'>"
|
|
||||||
"<x xmlns='http://jabber.org/protocol/muc'/>"
|
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
|
|
||||||
"</presence>"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_room_join_with_nick(void **state)
|
sends_room_join_with_nick(void **state)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
void sends_room_join(void **state);
|
void sends_room_join(void **state);
|
||||||
void sends_room_join_with_default_muc_service(void **state);
|
|
||||||
void sends_room_join_with_nick(void **state);
|
void sends_room_join_with_nick(void **state);
|
||||||
void sends_room_join_with_password(void **state);
|
void sends_room_join_with_password(void **state);
|
||||||
void sends_room_join_with_nick_and_password(void **state);
|
void sends_room_join_with_nick_and_password(void **state);
|
||||||
|
@ -25,7 +25,7 @@ rooms_query(void **state)
|
|||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
prof_input("/rooms");
|
prof_input("/rooms conference.localhost");
|
||||||
|
|
||||||
assert_true(prof_output_exact("chatroom@conference.localhost, (A chat room)"));
|
assert_true(prof_output_exact("chatroom@conference.localhost, (A chat room)"));
|
||||||
assert_true(prof_output_exact("hangout@conference.localhost, (Another chat room)"));
|
assert_true(prof_output_exact("hangout@conference.localhost, (Another chat room)"));
|
||||||
|
@ -196,6 +196,7 @@ void accounts_clear_otr(const char * const account_name) {}
|
|||||||
void accounts_clear_pgp_keyid(const char * const account_name) {}
|
void accounts_clear_pgp_keyid(const char * const account_name) {}
|
||||||
void accounts_clear_script_start(const char * const account_name) {}
|
void accounts_clear_script_start(const char * const account_name) {}
|
||||||
void accounts_clear_theme(const char * const account_name) {}
|
void accounts_clear_theme(const char * const account_name) {}
|
||||||
|
void accounts_clear_muc(const char * const account_name) {}
|
||||||
void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy) {}
|
void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy) {}
|
||||||
char* accounts_get_last_activity(const char *const account_name)
|
char* accounts_get_last_activity(const char *const account_name)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user