| 355 static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b) |
355 static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b) |
| 356 { |
356 { |
| 357 return "irc"; |
357 return "irc"; |
| 358 } |
358 } |
| 359 |
359 |
| |
360 static GList * |
| |
361 irc_protocol_get_account_options(PurpleProtocol *protocol) { |
| |
362 PurpleAccountOption *option; |
| |
363 GList *opts = NULL; |
| |
364 |
| |
365 option = purple_account_option_int_new(_("Port"), "port", |
| |
366 IRC_DEFAULT_PORT); |
| |
367 opts = g_list_append(opts, option); |
| |
368 |
| |
369 option = purple_account_option_string_new(_("Encodings"), "encoding", |
| |
370 IRC_DEFAULT_CHARSET); |
| |
371 opts = g_list_append(opts, option); |
| |
372 |
| |
373 option = purple_account_option_bool_new(_("Auto-detect incoming UTF-8"), |
| |
374 "autodetect_utf8", |
| |
375 IRC_DEFAULT_AUTODETECT); |
| |
376 opts = g_list_append(opts, option); |
| |
377 |
| |
378 option = purple_account_option_string_new(_("Ident name"), "username", ""); |
| |
379 opts = g_list_append(opts, option); |
| |
380 |
| |
381 option = purple_account_option_string_new(_("Real name"), "realname", ""); |
| |
382 opts = g_list_append(opts, option); |
| |
383 |
| |
384 /* |
| |
385 option = purple_account_option_string_new(_("Quit message"), "quitmsg", |
| |
386 IRC_DEFAULT_QUIT); |
| |
387 opts = g_list_append(opts, option); |
| |
388 */ |
| |
389 |
| |
390 option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); |
| |
391 opts = g_list_append(opts, option); |
| |
392 |
| |
393 #ifdef HAVE_CYRUS_SASL |
| |
394 option = purple_account_option_bool_new(_("Authenticate with SASL"), |
| |
395 "sasl", FALSE); |
| |
396 opts = g_list_append(opts, option); |
| |
397 |
| |
398 option = purple_account_option_bool_new(_("Allow plaintext SASL auth over " |
| |
399 "unencrypted connection"), |
| |
400 "auth_plain_in_clear", FALSE); |
| |
401 opts = g_list_append(opts, option); |
| |
402 #endif |
| |
403 |
| |
404 return opts; |
| |
405 } |
| |
406 |
| |
407 static GList * |
| |
408 irc_protocol_get_user_splits(PurpleProtocol *protocol) { |
| |
409 PurpleAccountUserSplit *split; |
| |
410 |
| |
411 split = purple_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, |
| |
412 '@'); |
| |
413 |
| |
414 return g_list_append(NULL, split); |
| |
415 } |
| |
416 |
| 360 static GList *irc_status_types(PurpleAccount *account) |
417 static GList *irc_status_types(PurpleAccount *account) |
| 361 { |
418 { |
| 362 PurpleStatusType *type; |
419 PurpleStatusType *type; |
| 363 GList *types = NULL; |
420 GList *types = NULL; |
| 364 |
421 |
| 970 } |
1027 } |
| 971 |
1028 |
| 972 static void |
1029 static void |
| 973 irc_protocol_init(IRCProtocol *self) |
1030 irc_protocol_init(IRCProtocol *self) |
| 974 { |
1031 { |
| 975 PurpleProtocol *protocol = PURPLE_PROTOCOL(self); |
|
| 976 PurpleAccountUserSplit *split; |
|
| 977 PurpleAccountOption *option; |
|
| 978 |
|
| 979 protocol->id = "prpl-irc"; |
|
| 980 protocol->name = "IRC"; |
|
| 981 protocol->options = OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | |
|
| 982 OPT_PROTO_SLASH_COMMANDS_NATIVE; |
|
| 983 |
|
| 984 split = purple_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); |
|
| 985 protocol->user_splits = g_list_append(protocol->user_splits, split); |
|
| 986 |
|
| 987 option = purple_account_option_int_new(_("Port"), "port", IRC_DEFAULT_PORT); |
|
| 988 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 989 |
|
| 990 option = purple_account_option_string_new(_("Encodings"), "encoding", IRC_DEFAULT_CHARSET); |
|
| 991 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 992 |
|
| 993 option = purple_account_option_bool_new(_("Auto-detect incoming UTF-8"), "autodetect_utf8", IRC_DEFAULT_AUTODETECT); |
|
| 994 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 995 |
|
| 996 option = purple_account_option_string_new(_("Ident name"), "username", ""); |
|
| 997 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 998 |
|
| 999 option = purple_account_option_string_new(_("Real name"), "realname", ""); |
|
| 1000 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 1001 |
|
| 1002 /* |
|
| 1003 option = purple_account_option_string_new(_("Quit message"), "quitmsg", IRC_DEFAULT_QUIT); |
|
| 1004 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 1005 */ |
|
| 1006 |
|
| 1007 option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); |
|
| 1008 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 1009 |
|
| 1010 #ifdef HAVE_CYRUS_SASL |
|
| 1011 option = purple_account_option_bool_new(_("Authenticate with SASL"), "sasl", FALSE); |
|
| 1012 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 1013 |
|
| 1014 option = purple_account_option_bool_new( |
|
| 1015 _("Allow plaintext SASL auth over unencrypted connection"), |
|
| 1016 "auth_plain_in_clear", FALSE); |
|
| 1017 protocol->account_options = g_list_append(protocol->account_options, option); |
|
| 1018 #endif |
|
| 1019 } |
1032 } |
| 1020 |
1033 |
| 1021 static void |
1034 static void |
| 1022 irc_protocol_class_init(IRCProtocolClass *klass) |
1035 irc_protocol_class_init(IRCProtocolClass *klass) |
| 1023 { |
1036 { |
| 1025 |
1038 |
| 1026 protocol_class->login = irc_login; |
1039 protocol_class->login = irc_login; |
| 1027 protocol_class->close = irc_close; |
1040 protocol_class->close = irc_close; |
| 1028 protocol_class->status_types = irc_status_types; |
1041 protocol_class->status_types = irc_status_types; |
| 1029 protocol_class->list_icon = irc_blist_icon; |
1042 protocol_class->list_icon = irc_blist_icon; |
| |
1043 |
| |
1044 protocol_class->get_account_options = irc_protocol_get_account_options; |
| |
1045 protocol_class->get_user_splits = irc_protocol_get_user_splits; |
| 1030 } |
1046 } |
| 1031 |
1047 |
| 1032 static void |
1048 static void |
| 1033 irc_protocol_class_finalize(G_GNUC_UNUSED IRCProtocolClass *klass) |
1049 irc_protocol_class_finalize(G_GNUC_UNUSED IRCProtocolClass *klass) |
| 1034 { |
1050 { |
| 1104 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_ROOMLIST, |
1120 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_ROOMLIST, |
| 1105 irc_protocol_roomlist_iface_init) |
1121 irc_protocol_roomlist_iface_init) |
| 1106 |
1122 |
| 1107 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_XFER, |
1123 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_XFER, |
| 1108 irc_protocol_xfer_iface_init)); |
1124 irc_protocol_xfer_iface_init)); |
| |
1125 |
| |
1126 static PurpleProtocol * |
| |
1127 irc_protocol_new(void) { |
| |
1128 return PURPLE_PROTOCOL(g_object_new( |
| |
1129 IRC_TYPE_PROTOCOL, |
| |
1130 "id", "prpl-irc", |
| |
1131 "name", "IRC", |
| |
1132 "options", OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | |
| |
1133 OPT_PROTO_SLASH_COMMANDS_NATIVE, |
| |
1134 NULL)); |
| |
1135 } |
| 1109 |
1136 |
| 1110 static PurplePluginInfo * |
1137 static PurplePluginInfo * |
| 1111 plugin_query(GError **error) |
1138 plugin_query(GError **error) |
| 1112 { |
1139 { |
| 1113 return purple_plugin_info_new( |
1140 return purple_plugin_info_new( |
| 1132 |
1159 |
| 1133 irc_protocol_register_type(G_TYPE_MODULE(plugin)); |
1160 irc_protocol_register_type(G_TYPE_MODULE(plugin)); |
| 1134 |
1161 |
| 1135 irc_xfer_register(G_TYPE_MODULE(plugin)); |
1162 irc_xfer_register(G_TYPE_MODULE(plugin)); |
| 1136 |
1163 |
| 1137 _irc_protocol = g_object_new(IRC_TYPE_PROTOCOL, NULL); |
1164 _irc_protocol = irc_protocol_new(); |
| 1138 if(!purple_protocol_manager_register(manager, _irc_protocol, error)) { |
1165 if(!purple_protocol_manager_register(manager, _irc_protocol, error)) { |
| 1139 g_clear_object(&_irc_protocol); |
1166 g_clear_object(&_irc_protocol); |
| 1140 |
1167 |
| 1141 return FALSE; |
1168 return FALSE; |
| 1142 } |
1169 } |