1 | /***************************************************************************\ |
---|
2 | * * |
---|
3 | * BitlBee - An IRC to IM gateway * |
---|
4 | * Jabber module - Handling of blocking * |
---|
5 | * * |
---|
6 | * Copyright 2021 / <> * |
---|
7 | * * |
---|
8 | * This program is free software; you can redistribute it and/or modify * |
---|
9 | * it under the terms of the GNU General Public License as published by * |
---|
10 | * the Free Software Foundation; either version 2 of the License, or * |
---|
11 | * (at your option) any later version. * |
---|
12 | * * |
---|
13 | * This program is distributed in the hope that it will be useful, * |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
16 | * GNU General Public License for more details. * |
---|
17 | * * |
---|
18 | * You should have received a copy of the GNU General Public License along * |
---|
19 | * with this program; if not, write to the Free Software Foundation, Inc., * |
---|
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * |
---|
21 | * * |
---|
22 | \***************************************************************************/ |
---|
23 | |
---|
24 | #include "jabber.h" |
---|
25 | |
---|
26 | void jabber_buddy_blockunblock(struct im_connection *ic, char *who, int block) |
---|
27 | { |
---|
28 | struct xt_node *node, *query; |
---|
29 | struct jabber_buddy *bud; |
---|
30 | char *s; |
---|
31 | |
---|
32 | if ((s = strchr(who, '=')) && jabber_chat_by_jid(ic, s + 1)) { |
---|
33 | bud = jabber_buddy_by_ext_jid(ic, who, 0); |
---|
34 | } else { |
---|
35 | bud = jabber_buddy_by_jid(ic, who, GET_BUDDY_BARE_OK); |
---|
36 | } |
---|
37 | |
---|
38 | node = xt_new_node("item", NULL, NULL); |
---|
39 | xt_add_attr(node, "jid", bud ? bud->full_jid : who); |
---|
40 | |
---|
41 | node = xt_new_node(block ? "block" : "unblock", NULL, node); |
---|
42 | xt_add_attr(node, "xmlns", XMLNS_BLOCK); |
---|
43 | |
---|
44 | query = jabber_make_packet("iq", "set", NULL, node); |
---|
45 | |
---|
46 | jabber_write_packet(ic, query); |
---|
47 | xt_free_node(query); |
---|
48 | } |
---|
49 | |
---|
50 | void jabber_buddy_block(struct im_connection *ic, char *who) |
---|
51 | { |
---|
52 | jabber_buddy_blockunblock(ic, who, TRUE); |
---|
53 | } |
---|
54 | |
---|
55 | void jabber_buddy_unblock(struct im_connection *ic, char *who) |
---|
56 | { |
---|
57 | jabber_buddy_blockunblock(ic, who, FALSE); |
---|
58 | } |
---|
59 | |
---|
60 | //jabber doesn't have permit lists so these are empty |
---|
61 | void jabber_buddy_permit(struct im_connection *ic, char *who) |
---|
62 | { |
---|
63 | } |
---|
64 | |
---|
65 | void jabber_buddy_unpermit(struct im_connection *ic, char *who) |
---|
66 | { |
---|
67 | } |
---|