comparison mcabber/mcabber/xmpp_muc.c @ 1684:95df4ea512c8

Provide xmpp_is_online()
author Myhailo Danylenko <isbear@ukrpost.net>
date Tue, 19 Jan 2010 19:16:38 +0200
parents d1e8fb14ce2d
children 1342df44c814
comparison
equal deleted inserted replaced
1683:b09f82f61745 1684:95df4ea512c8
111 LmMessage *x; 111 LmMessage *x;
112 LmMessageNode *y; 112 LmMessageNode *y;
113 gchar *roomid; 113 gchar *roomid;
114 GSList *room_elt; 114 GSList *room_elt;
115 115
116 if (!lconnection || !lm_connection_is_authenticated(lconnection) || !room) 116 if (!xmpp_is_online() || !room)
117 return; 117 return;
118 if (!nickname) return; 118 if (!nickname) return;
119 119
120 roomid = g_strdup_printf("%s/%s", room, nickname); 120 roomid = g_strdup_printf("%s/%s", room, nickname);
121 if (check_jid_syntax(roomid)) { 121 if (check_jid_syntax(roomid)) {
160 void xmpp_room_invite(const char *room, const char *fjid, const char *reason) 160 void xmpp_room_invite(const char *room, const char *fjid, const char *reason)
161 { 161 {
162 LmMessage *msg; 162 LmMessage *msg;
163 LmMessageNode *x, *y; 163 LmMessageNode *x, *y;
164 164
165 if (!lconnection || !lm_connection_is_authenticated(lconnection) || !room || !fjid) 165 if (!xmpp_is_online() || !room || !fjid)
166 return; 166 return;
167 167
168 msg = lm_message_new(room, LM_MESSAGE_TYPE_MESSAGE); 168 msg = lm_message_new(room, LM_MESSAGE_TYPE_MESSAGE);
169 169
170 x = lm_message_node_add_child(msg->node, "x", NULL); 170 x = lm_message_node_add_child(msg->node, "x", NULL);
186 const char *reason) 186 const char *reason)
187 { 187 {
188 LmMessage *iq; 188 LmMessage *iq;
189 LmMessageNode *query, *x; 189 LmMessageNode *query, *x;
190 190
191 if (!lconnection || !lm_connection_is_authenticated(lconnection) || !roomid) 191 if (!xmpp_is_online() || !roomid)
192 return 1; 192 return 1;
193 if (!fjid && !nick) return 1; 193 if (!fjid && !nick) return 1;
194 194
195 if (check_jid_syntax((char*)roomid)) { 195 if (check_jid_syntax((char*)roomid)) {
196 scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", roomid); 196 scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", roomid);
236 void xmpp_room_unlock(const char *room) 236 void xmpp_room_unlock(const char *room)
237 { 237 {
238 LmMessageNode *node; 238 LmMessageNode *node;
239 LmMessage *iq; 239 LmMessage *iq;
240 240
241 if (!lconnection || !lm_connection_is_authenticated(lconnection) || !room) 241 if (!xmpp_is_online() || !room)
242 return; 242 return;
243 243
244 iq = lm_message_new_with_sub_type(room, LM_MESSAGE_TYPE_IQ, 244 iq = lm_message_new_with_sub_type(room, LM_MESSAGE_TYPE_IQ,
245 LM_MESSAGE_SUB_TYPE_SET); 245 LM_MESSAGE_SUB_TYPE_SET);
246 246
260 void xmpp_room_destroy(const char *room, const char *venue, const char *reason) 260 void xmpp_room_destroy(const char *room, const char *venue, const char *reason)
261 { 261 {
262 LmMessage *iq; 262 LmMessage *iq;
263 LmMessageNode *query, *x; 263 LmMessageNode *query, *x;
264 264
265 if (!lconnection || !lm_connection_is_authenticated(lconnection) || !room) 265 if (!xmpp_is_online() || !room)
266 return; 266 return;
267 267
268 iq = lm_message_new_with_sub_type(room, LM_MESSAGE_TYPE_IQ, 268 iq = lm_message_new_with_sub_type(room, LM_MESSAGE_TYPE_IQ,
269 LM_MESSAGE_SUB_TYPE_SET); 269 LM_MESSAGE_SUB_TYPE_SET);
270 query = lm_message_node_add_child(iq->node, "query", NULL); 270 query = lm_message_node_add_child(iq->node, "query", NULL);