1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Check for self jid on /software

fixed #592
This commit is contained in:
James Booth 2015-07-08 21:05:20 +01:00
parent 9a5fe29caa
commit 051c6ed50e

View File

@ -2109,13 +2109,17 @@ cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help)
case WIN_CHAT: case WIN_CHAT:
case WIN_CONSOLE: case WIN_CONSOLE:
if (args[0]) { if (args[0]) {
Jid *myJid = jid_create(jabber_get_fulljid());
Jid *jid = jid_create(args[0]); Jid *jid = jid_create(args[0]);
if (jid == NULL || jid->fulljid == NULL) { if (jid == NULL || jid->fulljid == NULL) {
cons_show("You must provide a full jid to the /software command."); cons_show("You must provide a full jid to the /software command.");
} else if (g_strcmp0(jid->barejid, myJid->barejid) == 0) {
cons_show("Cannot request software version for yourself.");
} else { } else {
iq_send_software_version(jid->fulljid); iq_send_software_version(jid->fulljid);
} }
jid_destroy(myJid);
jid_destroy(jid); jid_destroy(jid);
} else { } else {
cons_show("You must provide a jid to the /software command."); cons_show("You must provide a jid to the /software command.");