Mercurial > pidgin.yaz
comparison libpurple/protocols/silc/silc.c @ 17811:9a96d8711303
We now depend on SILC Toolkit 1.1 for this copy of this prpl so we can
lose a whole bunch of "#ifdef SILC_ATTRIBUTE_USER_ICON" and
"#ifdef HAVE_SILCMIME_H" because they will always be true
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 10 Jun 2007 01:54:40 +0000 |
parents | b142c090eaf7 |
children | 73b2053c8303 |
comparison
equal
deleted
inserted
replaced
17810:d74d716f814d | 17811:9a96d8711303 |
---|---|
143 { | 143 { |
144 PurpleConnection *gc = context; | 144 PurpleConnection *gc = context; |
145 SilcPurple sg; | 145 SilcPurple sg; |
146 SilcUInt32 mask; | 146 SilcUInt32 mask; |
147 char tz[16]; | 147 char tz[16]; |
148 #ifdef SILC_ATTRIBUTE_USER_ICON | |
149 PurpleStoredImage *img; | 148 PurpleStoredImage *img; |
150 #endif | |
151 #ifdef HAVE_SYS_UTSNAME_H | 149 #ifdef HAVE_SYS_UTSNAME_H |
152 struct utsname u; | 150 struct utsname u; |
153 #endif | 151 #endif |
154 | 152 |
155 sg = gc->proto_data; | 153 sg = gc->proto_data; |
199 silc_timezone(tz, sizeof(tz)); | 197 silc_timezone(tz, sizeof(tz)); |
200 silc_client_attribute_add(client, conn, | 198 silc_client_attribute_add(client, conn, |
201 SILC_ATTRIBUTE_TIMEZONE, | 199 SILC_ATTRIBUTE_TIMEZONE, |
202 (void *)tz, strlen(tz)); | 200 (void *)tz, strlen(tz)); |
203 | 201 |
204 #ifdef SILC_ATTRIBUTE_USER_ICON | |
205 /* Set our buddy icon */ | 202 /* Set our buddy icon */ |
206 img = purple_buddy_icons_find_account_icon(sg->account); | 203 img = purple_buddy_icons_find_account_icon(sg->account); |
207 silcpurple_buddy_set_icon(gc, img); | 204 silcpurple_buddy_set_icon(gc, img); |
208 purple_imgstore_unref(img); | 205 purple_imgstore_unref(img); |
209 #endif | |
210 | 206 |
211 return; | 207 return; |
212 break; | 208 break; |
213 | 209 |
214 case SILC_CLIENT_CONN_DISCONNECTED: | 210 case SILC_CLIENT_CONN_DISCONNECTED: |
459 silcpurple_close_final(gpointer *context) | 455 silcpurple_close_final(gpointer *context) |
460 { | 456 { |
461 SilcPurple sg = (SilcPurple)context; | 457 SilcPurple sg = (SilcPurple)context; |
462 silc_client_stop(sg->client, NULL, NULL); | 458 silc_client_stop(sg->client, NULL, NULL); |
463 silc_client_free(sg->client); | 459 silc_client_free(sg->client); |
464 #ifdef HAVE_SILCMIME_H | |
465 if (sg->mimeass) | 460 if (sg->mimeass) |
466 silc_mime_assembler_free(sg->mimeass); | 461 silc_mime_assembler_free(sg->mimeass); |
467 #endif | |
468 silc_free(sg); | 462 silc_free(sg); |
469 return 0; | 463 return 0; |
470 } | 464 } |
471 | 465 |
472 static void | 466 static void |
1125 SilcPurple sg = gc->proto_data; | 1119 SilcPurple sg = gc->proto_data; |
1126 SilcPurpleIM im = context; | 1120 SilcPurpleIM im = context; |
1127 PurpleConversation *convo; | 1121 PurpleConversation *convo; |
1128 char tmp[256]; | 1122 char tmp[256]; |
1129 SilcClientEntry client_entry; | 1123 SilcClientEntry client_entry; |
1130 #ifdef HAVE_SILCMIME_H | |
1131 SilcDList list; | 1124 SilcDList list; |
1132 #endif | |
1133 | 1125 |
1134 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, | 1126 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, |
1135 sg->account); | 1127 sg->account); |
1136 if (!convo) | 1128 if (!convo) |
1137 return; | 1129 return; |
1149 } | 1141 } |
1150 | 1142 |
1151 silc_dlist_start(clients); | 1143 silc_dlist_start(clients); |
1152 client_entry = silc_dlist_get(clients); | 1144 client_entry = silc_dlist_get(clients); |
1153 | 1145 |
1154 #ifdef HAVE_SILCMIME_H | |
1155 /* Check for images */ | 1146 /* Check for images */ |
1156 if (im->gflags & PURPLE_MESSAGE_IMAGES) { | 1147 if (im->gflags & PURPLE_MESSAGE_IMAGES) { |
1157 list = silcpurple_image_message(im->message, | 1148 list = silcpurple_image_message(im->message, |
1158 (SilcUInt32 *)(void *)&im->flags); | 1149 (SilcUInt32 *)(void *)&im->flags); |
1159 if (list) { | 1150 if (list) { |
1171 purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, | 1162 purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, |
1172 im->message, 0, time(NULL)); | 1163 im->message, 0, time(NULL)); |
1173 goto out; | 1164 goto out; |
1174 } | 1165 } |
1175 } | 1166 } |
1176 #endif | |
1177 | 1167 |
1178 /* Send the message */ | 1168 /* Send the message */ |
1179 silc_client_send_private_message(client, conn, client_entry, im->flags, | 1169 silc_client_send_private_message(client, conn, client_entry, im->flags, |
1180 NULL, (unsigned char *)im->message, im->message_len); | 1170 NULL, (unsigned char *)im->message, im->message_len); |
1181 purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, | 1171 purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, |
1204 SilcClientEntry client_entry; | 1194 SilcClientEntry client_entry; |
1205 SilcUInt32 mflags; | 1195 SilcUInt32 mflags; |
1206 char *msg, *tmp; | 1196 char *msg, *tmp; |
1207 int ret = 0; | 1197 int ret = 0; |
1208 gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); | 1198 gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); |
1209 #ifdef HAVE_SILCMIME_H | |
1210 SilcDList list; | 1199 SilcDList list; |
1211 #endif | |
1212 | 1200 |
1213 if (!who || !message) | 1201 if (!who || !message) |
1214 return 0; | 1202 return 0; |
1215 | 1203 |
1216 mflags = SILC_MESSAGE_FLAG_UTF8; | 1204 mflags = SILC_MESSAGE_FLAG_UTF8; |
1257 } | 1245 } |
1258 | 1246 |
1259 silc_dlist_start(clients); | 1247 silc_dlist_start(clients); |
1260 client_entry = silc_dlist_get(clients); | 1248 client_entry = silc_dlist_get(clients); |
1261 | 1249 |
1262 #ifdef HAVE_SILCMIME_H | |
1263 /* Check for images */ | 1250 /* Check for images */ |
1264 if (flags & PURPLE_MESSAGE_IMAGES) { | 1251 if (flags & PURPLE_MESSAGE_IMAGES) { |
1265 list = silcpurple_image_message(message, &mflags); | 1252 list = silcpurple_image_message(message, &mflags); |
1266 if (list) { | 1253 if (list) { |
1267 /* Send one or more MIME message. If more than one, they | 1254 /* Send one or more MIME message. If more than one, they |
1279 g_free(tmp); | 1266 g_free(tmp); |
1280 silc_client_list_free(client, conn, clients); | 1267 silc_client_list_free(client, conn, clients); |
1281 return ret; | 1268 return ret; |
1282 } | 1269 } |
1283 } | 1270 } |
1284 #endif | |
1285 | 1271 |
1286 /* Send private message directly */ | 1272 /* Send private message directly */ |
1287 ret = silc_client_send_private_message(client, conn, client_entry, | 1273 ret = silc_client_send_private_message(client, conn, client_entry, |
1288 mflags, NULL, | 1274 mflags, NULL, |
1289 (unsigned char *)msg, | 1275 (unsigned char *)msg, |
1798 NULL | 1784 NULL |
1799 }; | 1785 }; |
1800 | 1786 |
1801 static PurplePluginProtocolInfo prpl_info = | 1787 static PurplePluginProtocolInfo prpl_info = |
1802 { | 1788 { |
1803 #ifdef HAVE_SILCMIME_H | |
1804 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | | 1789 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | |
1805 OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE, | 1790 OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE, |
1806 #else | |
1807 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | | |
1808 OPT_PROTO_PASSWORD_OPTIONAL, | |
1809 #endif | |
1810 NULL, /* user_splits */ | 1791 NULL, /* user_splits */ |
1811 NULL, /* protocol_options */ | 1792 NULL, /* protocol_options */ |
1812 #ifdef SILC_ATTRIBUTE_USER_ICON | |
1813 {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ | 1793 {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ |
1814 #else | |
1815 NO_BUDDY_ICONS, | |
1816 #endif | |
1817 silcpurple_list_icon, /* list_icon */ | 1794 silcpurple_list_icon, /* list_icon */ |
1818 NULL, /* list_emblems */ | 1795 NULL, /* list_emblems */ |
1819 silcpurple_status_text, /* status_text */ | 1796 silcpurple_status_text, /* status_text */ |
1820 silcpurple_tooltip_text, /* tooltip_text */ | 1797 silcpurple_tooltip_text, /* tooltip_text */ |
1821 silcpurple_away_states, /* away_states */ | 1798 silcpurple_away_states, /* away_states */ |
1855 NULL, /* group_buddy */ | 1832 NULL, /* group_buddy */ |
1856 NULL, /* rename_group */ | 1833 NULL, /* rename_group */ |
1857 NULL, /* buddy_free */ | 1834 NULL, /* buddy_free */ |
1858 NULL, /* convo_closed */ | 1835 NULL, /* convo_closed */ |
1859 NULL, /* normalize */ | 1836 NULL, /* normalize */ |
1860 #ifdef SILC_ATTRIBUTE_USER_ICON | |
1861 silcpurple_buddy_set_icon, /* set_buddy_icon */ | 1837 silcpurple_buddy_set_icon, /* set_buddy_icon */ |
1862 #else | |
1863 NULL, | |
1864 #endif | |
1865 NULL, /* remove_group */ | 1838 NULL, /* remove_group */ |
1866 NULL, /* get_cb_real_name */ | 1839 NULL, /* get_cb_real_name */ |
1867 silcpurple_chat_set_topic, /* set_chat_topic */ | 1840 silcpurple_chat_set_topic, /* set_chat_topic */ |
1868 NULL, /* find_blist_chat */ | 1841 NULL, /* find_blist_chat */ |
1869 silcpurple_roomlist_get_list, /* roomlist_get_list */ | 1842 silcpurple_roomlist_get_list, /* roomlist_get_list */ |