Wed, 12 Dec 2018 16:43:40 -0600
oscar: Remove dead usage of tm.tm_gmtoff and HAVE_TM_GMTOFF config
Oscar at one time used tm.tm_gmtoff in order to offset a timestamp.
Now, the function is always passed 0 for the timestamp, which avoids
this code path. Therefore, this patch removes the timestamp argument
from the function, removes the dead code path which included the only
usage of tm.tm_gmtoff, and gets rid of the check/setting in meson for
HAVE_TM_GMTOFF.
| 13235 | 1 | /* |
| 15884 | 2 | * Purple's oscar protocol plugin |
| 13235 | 3 | * This file is the legal property of its developers. |
| 4 | * Please see the AUTHORS file distributed alongside this file. | |
| 5 | * | |
| 6 | * This library is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU Lesser General Public | |
| 8 | * License as published by the Free Software Foundation; either | |
| 9 | * version 2 of the License, or (at your option) any later version. | |
| 10 | * | |
| 11 | * This library is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | * Lesser General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU Lesser General Public | |
| 17 | * License along with this library; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17443
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 13235 | 19 | */ |
| 20 | ||
| 21 | /* | |
|
15304
515fa9b23236
[gaim-migrate @ 18032]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
22 | * Family 0x0003 (SNAC_FAMILY_BUDDY) - Old-style Buddylist Management (non-SSI). |
| 13235 | 23 | * |
| 24 | */ | |
| 25 | ||
| 26 | #include "oscar.h" | |
| 27 | ||
| 28 | #include <string.h> | |
| 29 | ||
| 30 | /* | |
| 31 | * Subtype 0x0002 - Request rights. | |
| 32 | * | |
| 33 | * Request Buddy List rights. | |
| 34 | * | |
| 35 | */ | |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
36 | void |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
37 | aim_buddylist_reqrights(OscarData *od, FlapConnection *conn) |
| 13235 | 38 | { |
|
15304
515fa9b23236
[gaim-migrate @ 18032]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
39 | aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_REQRIGHTS); |
| 13235 | 40 | } |
| 41 | ||
| 42 | /* | |
| 43 | * Subtype 0x0003 - Rights. | |
| 44 | * | |
| 45 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
46 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
47 | rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 48 | { |
| 49 | aim_rxcallback_t userfunc; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
50 | GSList *tlvlist; |
| 13235 | 51 | guint16 maxbuddies = 0, maxwatchers = 0; |
| 52 | int ret = 0; | |
| 53 | ||
| 54 | /* | |
| 55 | * TLVs follow | |
| 56 | */ | |
| 57 | tlvlist = aim_tlvlist_read(bs); | |
| 58 | ||
| 59 | /* | |
| 60 | * TLV type 0x0001: Maximum number of buddies. | |
| 61 | */ | |
| 62 | if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) | |
| 63 | maxbuddies = aim_tlv_get16(tlvlist, 0x0001, 1); | |
| 64 | ||
| 65 | /* | |
| 66 | * TLV type 0x0002: Maximum number of watchers. | |
| 67 | * | |
| 68 | * Watchers are other users who have you on their buddy | |
| 69 | * list. (This is called the "reverse list" by a certain | |
| 70 | * other IM protocol.) | |
| 71 | * | |
| 72 | */ | |
| 73 | if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) | |
| 74 | maxwatchers = aim_tlv_get16(tlvlist, 0x0002, 1); | |
| 75 | ||
| 76 | /* | |
| 77 | * TLV type 0x0003: Unknown. | |
| 78 | * | |
| 79 | * ICQ only? | |
| 80 | */ | |
| 81 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
82 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
83 | ret = userfunc(od, conn, frame, maxbuddies, maxwatchers); |
| 13235 | 84 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
85 | aim_tlvlist_free(tlvlist); |
| 13235 | 86 | |
| 87 | return ret; | |
| 88 | } | |
| 89 | ||
| 90 | /* | |
|
15304
515fa9b23236
[gaim-migrate @ 18032]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
91 | * Subtypes 0x000b (SNAC_SUBTYPE_BUDDY_ONCOMING) and 0x000c (SNAC_SUBTYPE_BUDDY_OFFGOING) - Change in buddy status |
| 13235 | 92 | * |
| 93 | * Oncoming Buddy notifications contain a subset of the | |
| 94 | * user information structure. It's close enough to run | |
| 95 | * through aim_info_extract() however. | |
| 96 | * | |
| 97 | * Although the offgoing notification contains no information, | |
| 98 | * it is still in a format parsable by aim_info_extract(). | |
| 99 | * | |
| 100 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
101 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
102 | buddychange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 103 | { |
| 104 | int ret = 0; | |
| 105 | aim_userinfo_t userinfo; | |
| 106 | aim_rxcallback_t userfunc; | |
| 107 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
108 | aim_info_extract(od, bs, &userinfo); |
| 13235 | 109 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
110 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
111 | ret = userfunc(od, conn, frame, &userinfo); |
| 13235 | 112 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
113 | if (snac->subtype == SNAC_SUBTYPE_BUDDY_ONCOMING && |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
114 | userinfo.capabilities & OSCAR_CAPABILITY_XTRAZ) { |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
115 | PurpleAccount *account = purple_connection_get_account(od->gc); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
30662
diff
changeset
|
116 | PurpleBuddy *buddy = purple_blist_find_buddy(account, userinfo.bn); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
117 | |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
118 | if (buddy) { |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
119 | PurplePresence *presence = purple_buddy_get_presence(buddy); |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
120 | |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
121 | if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOOD)) |
| 29404 | 122 | icq_im_xstatus_request(od, userinfo.bn); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
123 | } |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24625
diff
changeset
|
124 | } |
| 13235 | 125 | aim_info_free(&userinfo); |
| 126 | ||
| 127 | return ret; | |
| 128 | } | |
| 129 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
130 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
131 | snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 132 | { |
|
15304
515fa9b23236
[gaim-migrate @ 18032]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
133 | if (snac->subtype == SNAC_SUBTYPE_BUDDY_RIGHTSINFO) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
134 | return rights(od, conn, mod, frame, snac, bs); |
|
15304
515fa9b23236
[gaim-migrate @ 18032]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
135 | else if ((snac->subtype == SNAC_SUBTYPE_BUDDY_ONCOMING) || (snac->subtype == SNAC_SUBTYPE_BUDDY_OFFGOING)) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
136 | return buddychange(od, conn, mod, frame, snac, bs); |
| 13235 | 137 | |
| 138 | return 0; | |
| 139 | } | |
| 140 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
141 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
142 | buddylist_modfirst(OscarData *od, aim_module_t *mod) |
| 13235 | 143 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
22860
diff
changeset
|
144 | mod->family = SNAC_FAMILY_BUDDY; |
| 13235 | 145 | mod->version = 0x0001; |
| 146 | mod->toolid = 0x0110; | |
| 147 | mod->toolversion = 0x0629; | |
| 148 | mod->flags = 0; | |
| 149 | strncpy(mod->name, "buddy", sizeof(mod->name)); | |
| 150 | mod->snachandler = snachandler; | |
| 151 | ||
| 152 | return 0; | |
| 153 | } |