Mercurial > ~mikael > mcabber > hg
diff mcabber/src/jabglue.c @ 472:75442262c082
Disable some commands when not connected
Disable status/status_to, add, rawxml, room, say/msay when not connected,
as these commands could be called with an empty buddylist.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 02 Oct 2005 18:05:34 +0200 |
parents | eaa2ad773192 |
children | c024d1d5d350 |
line wrap: on
line diff
--- a/mcabber/src/jabglue.c Sun Oct 02 10:57:09 2005 +0200 +++ b/mcabber/src/jabglue.c Sun Oct 02 18:05:34 2005 +0200 @@ -43,7 +43,7 @@ static int s_id; static int regmode, regdone; static enum imstatus mystatus = offline; -unsigned char online; +static unsigned char online; char imstatus2char[imstatus_size+1] = { '_', 'o', 'i', 'f', 'd', 'n', 'a', '\0' @@ -120,6 +120,11 @@ return jid; } +inline unsigned char jb_getonline(void) +{ + return online; +} + jconn jb_connect(const char *jid, const char *server, unsigned int port, int ssl, const char *pass) { @@ -340,6 +345,8 @@ gchar *strtype; gchar *buffer = to_utf8(text); + if (!online) return; + if (type == ROSTER_TYPE_ROOM) strtype = TMSG_GROUPCHAT; else @@ -477,7 +484,8 @@ xmlnode x, y; gchar *roomid, *utf8_nickname; - if (!online || !room || !nickname) return; + if (!online || !room) return; + if (!nickname) return; utf8_nickname = to_utf8(nickname); roomid = g_strdup_printf("%s/%s", room, utf8_nickname); @@ -508,8 +516,7 @@ { xmlnode x, y, z; - if (!online) return; - if (!room) return; + if (!online || !room) return; x = jutil_iqnew(JPACKET__SET, "http://jabber.org/protocol/muc#owner"); xmlnode_put_attrib(x, "id", "unlock1"); // XXX