Mercurial > pidgin
comparison libpurple/protocols/silc/silc.c @ 17570:b142c090eaf7
Remove the following SILC account options, as suggested by Pekka Riikonen
on devel@pidgin.im:
Reject watching by other users (and not reject by default)
Reject online status attribute reqs (and not reject by default)
Block invites (and not block by default)
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 09 Jun 2007 17:58:26 +0000 |
parents | 980a104267da |
children | 9a96d8711303 bb2e5f6ff2b4 |
comparison
equal
deleted
inserted
replaced
17569:b5fdfb305f20 | 17570:b142c090eaf7 |
---|---|
141 SilcClientConnectionStatus status, SilcStatus error, | 141 SilcClientConnectionStatus status, SilcStatus error, |
142 const char *message, void *context) | 142 const char *message, void *context) |
143 { | 143 { |
144 PurpleConnection *gc = context; | 144 PurpleConnection *gc = context; |
145 SilcPurple sg; | 145 SilcPurple sg; |
146 gboolean reject_watch, block_invites, block_ims; | 146 SilcUInt32 mask; |
147 char tz[16]; | |
148 #ifdef SILC_ATTRIBUTE_USER_ICON | |
149 PurpleStoredImage *img; | |
150 #endif | |
151 #ifdef HAVE_SYS_UTSNAME_H | |
152 struct utsname u; | |
153 #endif | |
147 | 154 |
148 sg = gc->proto_data; | 155 sg = gc->proto_data; |
149 | 156 |
150 switch (status) { | 157 switch (status) { |
151 case SILC_CLIENT_CONN_SUCCESS: | 158 case SILC_CLIENT_CONN_SUCCESS: |
159 silcpurple_send_buddylist(gc); | 166 silcpurple_send_buddylist(gc); |
160 | 167 |
161 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); | 168 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
162 | 169 |
163 /* Send any UMODEs configured for account */ | 170 /* Send any UMODEs configured for account */ |
164 reject_watch = purple_account_get_bool(sg->account, "reject-watch", FALSE); | 171 if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { |
165 block_invites = purple_account_get_bool(sg->account, "block-invites", FALSE); | |
166 block_ims = purple_account_get_bool(sg->account, "block-ims", FALSE); | |
167 if (reject_watch || block_invites || block_ims) { | |
168 char m[5]; | |
169 g_snprintf(m, sizeof(m), "+%s%s%s", | |
170 reject_watch ? "w" : "", | |
171 block_invites ? "I" : "", | |
172 block_ims ? "P" : ""); | |
173 silc_client_command_call(sg->client, sg->conn, NULL, | 172 silc_client_command_call(sg->client, sg->conn, NULL, |
174 "UMODE", m, NULL); | 173 "UMODE", "+P", NULL); |
175 } | 174 } |
176 | 175 |
177 /* Set default attributes */ | 176 /* Set default attributes */ |
178 if (!purple_account_get_bool(sg->account, "reject-attrs", FALSE)) { | 177 mask = SILC_ATTRIBUTE_MOOD_NORMAL; |
179 SilcUInt32 mask; | 178 silc_client_attribute_add(client, conn, |
180 char tz[16]; | 179 SILC_ATTRIBUTE_STATUS_MOOD, |
181 #ifdef SILC_ATTRIBUTE_USER_ICON | 180 SILC_32_TO_PTR(mask), |
182 PurpleStoredImage *img; | 181 sizeof(SilcUInt32)); |
183 #endif | 182 mask = SILC_ATTRIBUTE_CONTACT_CHAT; |
183 silc_client_attribute_add(client, conn, | |
184 SILC_ATTRIBUTE_PREFERRED_CONTACT, | |
185 SILC_32_TO_PTR(mask), | |
186 sizeof(SilcUInt32)); | |
184 #ifdef HAVE_SYS_UTSNAME_H | 187 #ifdef HAVE_SYS_UTSNAME_H |
185 struct utsname u; | 188 if (!uname(&u)) { |
186 #endif | |
187 | |
188 mask = SILC_ATTRIBUTE_MOOD_NORMAL; | |
189 silc_client_attribute_add(client, conn, | |
190 SILC_ATTRIBUTE_STATUS_MOOD, | |
191 SILC_32_TO_PTR(mask), | |
192 sizeof(SilcUInt32)); | |
193 mask = SILC_ATTRIBUTE_CONTACT_CHAT; | |
194 silc_client_attribute_add(client, conn, | |
195 SILC_ATTRIBUTE_PREFERRED_CONTACT, | |
196 SILC_32_TO_PTR(mask), | |
197 sizeof(SilcUInt32)); | |
198 #ifdef HAVE_SYS_UTSNAME_H | |
199 if (!uname(&u)) { | |
200 SilcAttributeObjDevice dev; | 189 SilcAttributeObjDevice dev; |
201 memset(&dev, 0, sizeof(dev)); | 190 memset(&dev, 0, sizeof(dev)); |
202 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; | 191 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; |
203 dev.version = u.release; | 192 dev.version = u.release; |
204 dev.model = u.sysname; | 193 dev.model = u.sysname; |
205 silc_client_attribute_add(client, conn, | 194 silc_client_attribute_add(client, conn, |
206 SILC_ATTRIBUTE_DEVICE_INFO, | 195 SILC_ATTRIBUTE_DEVICE_INFO, |
207 (void *)&dev, sizeof(dev)); | 196 (void *)&dev, sizeof(dev)); |
208 } | 197 } |
209 #endif | 198 #endif |
210 silc_timezone(tz, sizeof(tz)); | 199 silc_timezone(tz, sizeof(tz)); |
211 silc_client_attribute_add(client, conn, | 200 silc_client_attribute_add(client, conn, |
212 SILC_ATTRIBUTE_TIMEZONE, | 201 SILC_ATTRIBUTE_TIMEZONE, |
213 (void *)tz, strlen(tz)); | 202 (void *)tz, strlen(tz)); |
214 | 203 |
215 #ifdef SILC_ATTRIBUTE_USER_ICON | 204 #ifdef SILC_ATTRIBUTE_USER_ICON |
216 /* Set our buddy icon */ | 205 /* Set our buddy icon */ |
217 img = purple_buddy_icons_find_account_icon(sg->account); | 206 img = purple_buddy_icons_find_account_icon(sg->account); |
218 silcpurple_buddy_set_icon(gc, img); | 207 silcpurple_buddy_set_icon(gc, img); |
219 purple_imgstore_unref(img); | 208 purple_imgstore_unref(img); |
220 #endif | 209 #endif |
221 } | |
222 | 210 |
223 return; | 211 return; |
224 break; | 212 break; |
225 | 213 |
226 case SILC_CLIENT_CONN_DISCONNECTED: | 214 case SILC_CLIENT_CONN_DISCONNECTED: |
300 memset(¶ms, 0, sizeof(params)); | 288 memset(¶ms, 0, sizeof(params)); |
301 dfile = silcpurple_session_file(purple_account_get_username(sg->account)); | 289 dfile = silcpurple_session_file(purple_account_get_username(sg->account)); |
302 params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); | 290 params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); |
303 if (params.detach_data) | 291 if (params.detach_data) |
304 params.detach_data[params.detach_data_len] = 0; | 292 params.detach_data[params.detach_data_len] = 0; |
305 params.ignore_requested_attributes = | 293 params.ignore_requested_attributes = FALSE; |
306 purple_account_get_bool(sg->account, "reject-attrs", FALSE); | |
307 params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE); | 294 params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE); |
308 | 295 |
309 /* Perform SILC Key Exchange. */ | 296 /* Perform SILC Key Exchange. */ |
310 silc_client_key_exchange(sg->client, ¶ms, sg->public_key, | 297 silc_client_key_exchange(sg->client, ¶ms, sg->public_key, |
311 sg->private_key, stream, SILC_CONN_SERVER, | 298 sg->private_key, stream, SILC_CONN_SERVER, |
1084 } | 1071 } |
1085 | 1072 |
1086 static GList * | 1073 static GList * |
1087 silcpurple_actions(PurplePlugin *plugin, gpointer context) | 1074 silcpurple_actions(PurplePlugin *plugin, gpointer context) |
1088 { | 1075 { |
1089 PurpleConnection *gc = context; | |
1090 GList *list = NULL; | 1076 GList *list = NULL; |
1091 PurplePluginAction *act; | 1077 PurplePluginAction *act; |
1092 | 1078 |
1093 if (!purple_account_get_bool(gc->account, "reject-attrs", FALSE)) { | 1079 act = purple_plugin_action_new(_("Online Status"), |
1094 act = purple_plugin_action_new(_("Online Status"), | 1080 silcpurple_attrs); |
1095 silcpurple_attrs); | 1081 list = g_list_append(list, act); |
1096 list = g_list_append(list, act); | |
1097 } | |
1098 | 1082 |
1099 act = purple_plugin_action_new(_("Detach From Server"), | 1083 act = purple_plugin_action_new(_("Detach From Server"), |
1100 silcpurple_detach); | 1084 silcpurple_detach); |
1101 list = g_list_append(list, act); | 1085 list = g_list_append(list, act); |
1102 | 1086 |
1992 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 1976 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
1993 | 1977 |
1994 option = purple_account_option_bool_new(_("Public key authentication"), | 1978 option = purple_account_option_bool_new(_("Public key authentication"), |
1995 "pubkey-auth", FALSE); | 1979 "pubkey-auth", FALSE); |
1996 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 1980 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
1997 option = purple_account_option_bool_new(_("Reject watching by other users"), | |
1998 "reject-watch", FALSE); | |
1999 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
2000 option = purple_account_option_bool_new(_("Block invites"), | |
2001 "block-invites", FALSE); | |
2002 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
2003 option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), | 1981 option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), |
2004 "block-ims", FALSE); | 1982 "block-ims", FALSE); |
2005 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
2006 option = purple_account_option_bool_new(_("Reject online status attribute requests"), | |
2007 "reject-attrs", FALSE); | |
2008 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 1983 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
2009 option = purple_account_option_bool_new(_("Block messages to whiteboard"), | 1984 option = purple_account_option_bool_new(_("Block messages to whiteboard"), |
2010 "block-wb", FALSE); | 1985 "block-wb", FALSE); |
2011 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 1986 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
2012 option = purple_account_option_bool_new(_("Automatically open whiteboard"), | 1987 option = purple_account_option_bool_new(_("Automatically open whiteboard"), |