~ubuntu-branches/ubuntu/trusty/irssi-plugin-xmpp/trusty

« back to all changes in this revision

Viewing changes to src/fe-common/fe-xmpp-queries.c

  • Committer: Bazaar Package Importer
  • Author(s): David Ammouial
  • Date: 2008-06-23 16:03:33 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080623160333-3wwbzgtzwznjjvrf
Tags: 0.13+cvs20080610-1
* New CVS snapshot:
  - New features and bugfixes.
  - Fix ignoring of messages without a type attribute (Closes: #477989).
* Depend on irssi >=0.8.12 (Closes: #469923).
* Add FAQ and MUC to documentation files (Closes: #485595).
* debian/rules: install help files in irssi help directory.
* debian/rules: Remove useless "make -n" command in build-stamp rule.
* Bump Standards-Version to 3.8.0 (no changes needed). 
* debian/control: Add "Enhances: irssi".

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: fe-xmpp-queries.c,v 1.12 2007/11/26 12:55:08 errtu Exp $
 
2
 * $Id: fe-xmpp-queries.c,v 1.15 2008/04/05 20:50:45 errtu Exp $
3
3
 *
4
4
 * Copyright (C) 2007 Colin DIDIER
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or
9
 
 * (at your option) any later version.
 
7
 * it under the terms of the GNU General Public License version 2 as
 
8
 * published by the Free Software Foundation.
10
9
 *        
11
10
 * This program is distributed in the hope that it will be useful,
12
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35
34
    int show, const char *status)
36
35
{
37
36
        XMPP_QUERY_REC *rec;
 
37
        XMPP_ROSTER_USER_REC *user;
38
38
        const char *msg;
 
39
        char *name;
39
40
 
40
41
        g_return_if_fail(server != NULL);
41
42
        g_return_if_fail(full_jid != NULL);
47
48
 
48
49
        msg = fe_xmpp_presence_show[show];
49
50
 
 
51
        user = xmpp_rosters_find_user(server->roster, full_jid, NULL, NULL);
 
52
        name = user != NULL && user->name != NULL ?
 
53
            format_get_text(MODULE_NAME, NULL, server, NULL,
 
54
                XMPPTXT_FORMAT_NAME, user->name, full_jid) :
 
55
            format_get_text(MODULE_NAME, NULL, server, NULL,
 
56
                XMPPTXT_FORMAT_JID, full_jid);
 
57
 
50
58
        if (status != NULL)
51
59
                printformat_module(MODULE_NAME, server, full_jid, MSGLEVEL_CRAP,
52
 
                    XMPPTXT_PRESENCE_CHANGE_REASON, full_jid, msg, status);
 
60
                    XMPPTXT_PRESENCE_CHANGE_REASON, name, msg, status);
53
61
        else
54
62
                printformat_module(MODULE_NAME, server, full_jid, MSGLEVEL_CRAP,
55
 
                    XMPPTXT_PRESENCE_CHANGE, full_jid, msg);
 
63
                    XMPPTXT_PRESENCE_CHANGE, name, msg);
56
64
}
57
65
 
58
66
static void
78
86
        if (!IS_XMPP_QUERY(query))
79
87
                return;
80
88
 
81
 
        user = xmpp_rosters_find_user(query->server->roster, query->name, NULL);
 
89
        user = xmpp_rosters_find_user(query->server->roster, query->name, NULL,
 
90
            NULL);
82
91
        if (user == NULL || user->name == NULL)
83
92
                return;
84
93