From 0b740bb3557d0c2fc4cc205926b7fe8bd12d1f81 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 3 Feb 2013 18:28:54 +0000 Subject: Added debugging to presence and iq handlers --- src/xmpp/iq.c | 6 +++++- src/xmpp/presence.c | 28 +++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'src/xmpp') diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index e4bcecb4..fc3ef780 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -269,9 +269,11 @@ static int _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { + log_debug("Recieved diso#info response"); const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); if ((id != NULL) && (g_str_has_prefix(id, "disco"))) { + log_debug("Response to query: %s", id); xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE); if (node == NULL) { @@ -290,7 +292,9 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan char *generated_sha1 = caps_create_sha1_str(query); if (g_strcmp0(given_sha1, generated_sha1) != 0) { - log_info("Invalid SHA1 recieved for caps."); + log_info("Generated sha-1 does not match given:"); + log_info("Generated : %s", generated_sha1); + log_info("Given : %s", given_sha1); FREE_SET_NULL(generated_sha1); g_strfreev(split); diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index 7fd58df6..0d50a080 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -273,6 +273,7 @@ _presence_handler(xmpp_conn_t * const conn, // handle regular presence } else { + log_debug("Regular presence received from %s", from); char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE); char *show_str, *status_str; int idle_seconds = stanza_get_idle_time(stanza); @@ -338,38 +339,54 @@ _handle_presence_caps(xmpp_stanza_t * const stanza) char *node = NULL; char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (stanza_contains_caps(stanza)) { + log_debug("Presence contains capabilities."); char *hash_type = stanza_caps_get_hash(stanza); // xep-0115 if (hash_type != NULL) { + log_debug("Hash type: %s", hash_type); // supported hash if (strcmp(hash_type, "sha-1") == 0) { + log_debug("Hash type supported."); node = stanza_get_caps_str(stanza); caps_key = node; - + if (node != NULL) { + log_debug("Node string: %s.", node); if (!caps_contains(caps_key)) { + log_debug("Capabilities not cached for '%s', sending discovery IQ.", caps_key); xmpp_stanza_t *iq = stanza_create_disco_iq(ctx, "disco", from, node); xmpp_send(conn, iq); xmpp_stanza_release(iq); + } else { + log_debug("Capabilities already cached, for %s", caps_key); } + } else { + log_debug("No node string, not sending discovery IQ."); } // unsupported hash } else { + log_debug("Hash type unsupported."); node = stanza_get_caps_str(stanza); caps_key = from; if (node != NULL) { + log_debug("Node string: %s.", node); if (!caps_contains(caps_key)) { + log_debug("Capabilities not cached for '%s', sending discovery IQ.", caps_key); GString *id = g_string_new("disco_"); g_string_append(id, from); xmpp_stanza_t *iq = stanza_create_disco_iq(ctx, id->str, from, node); xmpp_send(conn, iq); xmpp_stanza_release(iq); g_string_free(id, TRUE); + } else { + log_debug("Capabilities already cached, for %s", caps_key); } + } else { + log_debug("No node string, not sending discovery IQ."); } } @@ -377,18 +394,25 @@ _handle_presence_caps(xmpp_stanza_t * const stanza) //ignore or handle legacy caps } else { + log_debug("No hash type, using legacy capabilities."); node = stanza_get_caps_str(stanza); caps_key = from; if (node != NULL) { + log_debug("Node string: %s.", node); if (!caps_contains(caps_key)) { + log_debug("Capabilities not cached for '%s', sending discovery IQ.", caps_key); GString *id = g_string_new("disco_"); g_string_append(id, from); xmpp_stanza_t *iq = stanza_create_disco_iq(ctx, id->str, from, node); xmpp_send(conn, iq); xmpp_stanza_release(iq); g_string_free(id, TRUE); + } else { + log_debug("Capabilities already cached, for %s", caps_key); } + } else { + log_debug("No node string, not sending discovery IQ."); } return caps_key; @@ -439,6 +463,8 @@ _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza) char *show_str, *status_str; char *caps_key = _handle_presence_caps(stanza); + log_debug("Room presence received from %s", jid); + xmpp_stanza_t *status = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_STATUS); if (status != NULL) { status_str = xmpp_stanza_get_text(status); -- cgit 1.4.1-2-gfad0 kartik/mu/blame/035call_ingredient.cc?h=main&id=aa0888459fc2ca41b0ad6bef5bfa72223ca33945'>^
69f04c3f ^
1ead3562 ^
192d59d3 ^

69f04c3f ^
57699011 ^
69f04c3f ^
88be3dbc ^
1ead3562 ^
4be9a93b ^

1ead3562 ^
192d59d3 ^
4be9a93b ^


ca01193d ^
fca0ebbe ^
016599f1 ^
b24eb476 ^
50eab110 ^

69f04c3f ^
3eeea0a2 ^
6c96a437 ^
67573caf ^
3473c63a ^
c9a5a7ba ^
016599f1 ^
78a12c9d ^
1fa53058 ^
69f04c3f ^
1848b18f ^

69f04c3f ^
795f5244 ^
166e3c0d ^
69f04c3f ^
166e3c0d ^
8d72e565 ^
e4630643 ^

166e3c0d ^



31401373 ^
67573caf ^
3473c63a ^
c9a5a7ba ^
3a982057 ^


78c50205 ^
9dcbec39 ^
3a982057 ^
81c87f08 ^

9dcbec39 ^
691b529e ^
1fa53058 ^
0487a30e ^
67573caf ^
ac0e9db5 ^
0487a30e ^
67573caf ^
69f04c3f ^
4be9a93b ^
3e849f11 ^
9dcbec39 ^
75aa3a98 ^
0487a30e ^
75aa3a98 ^
2d29369f ^
0487a30e ^
4be9a93b ^
69f04c3f ^

717ab659 ^
5f98a10c ^

1ead3562 ^
3e849f11 ^

1ead3562 ^
192d59d3 ^
3e849f11 ^
192d59d3 ^
3e849f11 ^
88be3dbc ^
1ead3562 ^
bc643692 ^
717ab659 ^
1ead3562 ^
192d59d3 ^
d52406cc ^
717ab659 ^
d52406cc ^
717ab659 ^








795f5244 ^
166e3c0d ^



717ab659 ^

67573caf ^
717ab659 ^


88be3dbc ^
1ead3562 ^
bc643692 ^
717ab659 ^
1ead3562 ^
192d59d3 ^
d52406cc ^
717ab659 ^






795f5244 ^
166e3c0d ^
717ab659 ^
166e3c0d ^
8d72e565 ^
e4630643 ^

5f98a10c ^
9dcbec39 ^
e4630643 ^

166e3c0d ^



b24eb476 ^
67573caf ^
0487a30e ^
67573caf ^
ac0e9db5 ^
827898fc ^
67573caf ^
717ab659 ^

ac0e9db5 ^
0487a30e ^

827898fc ^
717ab659 ^



c9a5a7ba ^
78c50205 ^
c9a5a7ba ^
78c50205 ^

c9a5a7ba ^
af023b32 ^









c9a5a7ba ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187