~ubuntu-branches/ubuntu/quantal/pidgin/quantal

« back to all changes in this revision

Viewing changes to libpurple/protocols/oscar/authorization.c

  • Committer: Bazaar Package Importer
  • Author(s): Ari Pollak
  • Date: 2011-06-13 21:17:20 UTC
  • mfrom: (1.3.19 upstream)
  • mto: This revision was merged to the branch mainline in revision 73.
  • Revision ID: james.westby@ubuntu.com-20110613211720-ke87vzmdcuaxams7
Tags: 2.8.0-1
* Imported Upstream version 2.8.0 (Closes: #630124)
* Remove SILC support since the library will be orphaned (Closes: #629222)
* Fix typo in libpurple-bin description (Closes: #625462)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "oscar.h"
26
26
#include "request.h"
27
27
 
28
 
static void
29
 
oscar_auth_request(struct name_data *data, char *msg)
 
28
/* When you ask other people for authorization */
 
29
void
 
30
oscar_auth_sendrequest(PurpleConnection *gc, const char *bname, const char *msg)
30
31
{
31
 
        PurpleConnection *gc;
32
32
        OscarData *od;
33
33
        PurpleAccount *account;
34
34
        PurpleBuddy *buddy;
35
35
        PurpleGroup *group;
36
 
        const char *bname, *gname;
 
36
        const char *gname;
37
37
 
38
 
        gc = data->gc;
39
38
        od = purple_connection_get_protocol_data(gc);
40
39
        account = purple_connection_get_account(gc);
41
 
        buddy = purple_find_buddy(account, data->name);
 
40
        buddy = purple_find_buddy(account, bname);
42
41
        if (buddy != NULL)
43
42
                group = purple_buddy_get_group(buddy);
44
43
        else
46
45
 
47
46
        if (group != NULL)
48
47
        {
49
 
                bname = purple_buddy_get_name(buddy);
50
48
                gname = purple_group_get_name(group);
51
49
                purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n",
52
50
                                   bname, gname);
53
 
                aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
 
51
                aim_ssi_sendauthrequest(od, bname, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
54
52
                if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY))
55
53
                {
56
54
                        aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE);
66
64
                        }
67
65
                }
68
66
        }
69
 
 
70
 
        oscar_free_name_data(data);
71
67
}
72
68
 
73
69
static void
105
101
                                           data);
106
102
}
107
103
 
108
 
/* When you ask other people for authorization */
109
 
void
110
 
oscar_auth_sendrequest(PurpleConnection *gc, const char *name)
111
 
{
112
 
        struct name_data *data;
113
 
 
114
 
        data = g_new0(struct name_data, 1);
115
 
        data->gc = gc;
116
 
        data->name = g_strdup(name);
117
 
 
118
 
        purple_request_input(data->gc, NULL, _("Authorization Request Message:"),
119
 
                                           NULL, _("Please authorize me!"), TRUE, FALSE, NULL,
120
 
                                           _("_OK"), G_CALLBACK(oscar_auth_request),
121
 
                                           _("_Cancel"), G_CALLBACK(oscar_free_name_data),
122
 
                                           purple_connection_get_account(gc), name, NULL,
123
 
                                           data);
124
 
}
125
 
 
126
104
void
127
105
oscar_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored)
128
106
{
133
111
 
134
112
        buddy = (PurpleBuddy *) node;
135
113
        gc = purple_account_get_connection(purple_buddy_get_account(buddy));
136
 
        oscar_auth_sendrequest(gc, purple_buddy_get_name(buddy));
 
114
        oscar_auth_sendrequest(gc, purple_buddy_get_name(buddy), NULL);
137
115
}
138
116
 
139
117
/* When other people ask you for authorization */
150
128
        purple_account_request_authorization(account, data->name, NULL, data->nick,
151
129
                reason, purple_find_buddy(account, data->name) != NULL,
152
130
                oscar_auth_grant, oscar_auth_dontgrant_msgprompt, data);
153
 
}
 
 
b'\\ No newline at end of file'
 
131
}