mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge pull request #1572 from profanity-im/fix/spamreporting
Fix spamreporting
This commit is contained in:
commit
516fd7d909
@ -3017,8 +3017,6 @@ cmd_blocked(ProfWin* window, const char* const command, gchar** args)
|
|||||||
if (g_strcmp0(args[0], "add") == 0) {
|
if (g_strcmp0(args[0], "add") == 0) {
|
||||||
char* jid = args[1];
|
char* jid = args[1];
|
||||||
|
|
||||||
// /blocked add jid or /blocked add (in window)
|
|
||||||
if (g_strv_length(args) < 3) {
|
|
||||||
if (jid == NULL && (window->type == WIN_CHAT)) {
|
if (jid == NULL && (window->type == WIN_CHAT)) {
|
||||||
ProfChatWin* chatwin = (ProfChatWin*)window;
|
ProfChatWin* chatwin = (ProfChatWin*)window;
|
||||||
jid = chatwin->barejid;
|
jid = chatwin->barejid;
|
||||||
@ -3028,7 +3026,6 @@ cmd_blocked(ProfWin* window, const char* const command, gchar** args)
|
|||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gboolean res = blocked_add(jid, br, NULL);
|
gboolean res = blocked_add(jid, br, NULL);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
@ -3053,6 +3050,20 @@ cmd_blocked(ProfWin* window, const char* const command, gchar** args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(args[0], "report-", 7) == 0) {
|
if (strncmp(args[0], "report-", 7) == 0) {
|
||||||
|
char *jid;
|
||||||
|
char *msg = NULL;
|
||||||
|
guint argn = g_strv_length(args);
|
||||||
|
|
||||||
|
if (argn >= 2) {
|
||||||
|
jid = args[1];
|
||||||
|
} else {
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argn >= 3) {
|
||||||
|
msg = args[2];
|
||||||
|
}
|
||||||
|
|
||||||
if (args[1] && g_strcmp0(args[0], "report-abuse") == 0) {
|
if (args[1] && g_strcmp0(args[0], "report-abuse") == 0) {
|
||||||
br = BLOCKED_REPORT_ABUSE;
|
br = BLOCKED_REPORT_ABUSE;
|
||||||
} else if (args[1] && g_strcmp0(args[0], "report-spam") == 0) {
|
} else if (args[1] && g_strcmp0(args[0], "report-spam") == 0) {
|
||||||
@ -3067,11 +3078,11 @@ cmd_blocked(ProfWin* window, const char* const command, gchar** args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// args[3] is an optional message
|
gboolean res = blocked_add(jid, br, msg);
|
||||||
gboolean res = blocked_add(args[1], br, args[3]);
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
cons_show("User %s already blocked.", args[1]);
|
cons_show("User %s already blocked.", args[1]);
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GList* blocked = blocked_list();
|
GList* blocked = blocked_list();
|
||||||
|
@ -132,6 +132,7 @@ blocked_add(char* jid, blocked_report reportkind, const char* const message)
|
|||||||
if (reportkind != BLOCKED_NO_REPORT) {
|
if (reportkind != BLOCKED_NO_REPORT) {
|
||||||
xmpp_stanza_t* report = xmpp_stanza_new(ctx);
|
xmpp_stanza_t* report = xmpp_stanza_new(ctx);
|
||||||
xmpp_stanza_set_name(report, STANZA_NAME_REPORT);
|
xmpp_stanza_set_name(report, STANZA_NAME_REPORT);
|
||||||
|
xmpp_stanza_set_ns(report, STANZA_NS_REPORTING);
|
||||||
if (reportkind == BLOCKED_REPORT_ABUSE) {
|
if (reportkind == BLOCKED_REPORT_ABUSE) {
|
||||||
xmpp_stanza_set_attribute(report, STANZA_ATTR_REASON, STANZA_REPORTING_ABUSE);
|
xmpp_stanza_set_attribute(report, STANZA_ATTR_REASON, STANZA_REPORTING_ABUSE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -243,6 +243,7 @@
|
|||||||
#define STANZA_NS_VOICEREQUEST "http://jabber.org/protocol/muc#request"
|
#define STANZA_NS_VOICEREQUEST "http://jabber.org/protocol/muc#request"
|
||||||
#define STANZA_NS_JINGLE_MESSAGE "urn:xmpp:jingle-message:0"
|
#define STANZA_NS_JINGLE_MESSAGE "urn:xmpp:jingle-message:0"
|
||||||
#define STANZA_NS_JINGLE_RTP "urn:xmpp:jingle:apps:rtp:1"
|
#define STANZA_NS_JINGLE_RTP "urn:xmpp:jingle:apps:rtp:1"
|
||||||
|
#define STANZA_NS_REPORTING "urn:xmpp:reporting:1"
|
||||||
|
|
||||||
#define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo"
|
#define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user