| 1126 } |
1126 } |
| 1127 |
1127 |
| 1128 static gboolean |
1128 static gboolean |
| 1129 plugin_load(PurplePlugin *plugin, GError **error) |
1129 plugin_load(PurplePlugin *plugin, GError **error) |
| 1130 { |
1130 { |
| |
1131 PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
| |
1132 |
| 1131 irc_protocol_register_type(G_TYPE_MODULE(plugin)); |
1133 irc_protocol_register_type(G_TYPE_MODULE(plugin)); |
| 1132 |
1134 |
| 1133 irc_xfer_register(G_TYPE_MODULE(plugin)); |
1135 irc_xfer_register(G_TYPE_MODULE(plugin)); |
| 1134 |
1136 |
| 1135 _irc_protocol = purple_protocols_add(IRC_TYPE_PROTOCOL, error); |
1137 _irc_protocol = g_object_new(IRC_TYPE_PROTOCOL, NULL); |
| 1136 if (!_irc_protocol) |
1138 if(!purple_protocol_manager_register(manager, _irc_protocol, error)) { |
| |
1139 g_clear_object(&_irc_protocol); |
| |
1140 |
| 1137 return FALSE; |
1141 return FALSE; |
| |
1142 } |
| 1138 |
1143 |
| 1139 purple_prefs_remove("/plugins/prpl/irc/quitmsg"); |
1144 purple_prefs_remove("/plugins/prpl/irc/quitmsg"); |
| 1140 purple_prefs_remove("/plugins/prpl/irc"); |
1145 purple_prefs_remove("/plugins/prpl/irc"); |
| 1141 |
1146 |
| 1142 irc_register_commands(); |
1147 irc_register_commands(); |
| 1157 } |
1162 } |
| 1158 |
1163 |
| 1159 static gboolean |
1164 static gboolean |
| 1160 plugin_unload(PurplePlugin *plugin, GError **error) |
1165 plugin_unload(PurplePlugin *plugin, GError **error) |
| 1161 { |
1166 { |
| |
1167 PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
| |
1168 |
| |
1169 if(!purple_protocol_manager_unregister(manager, _irc_protocol, error)) { |
| |
1170 return FALSE; |
| |
1171 } |
| |
1172 |
| 1162 irc_unregister_commands(); |
1173 irc_unregister_commands(); |
| 1163 |
1174 |
| 1164 purple_signal_disconnect(purple_get_core(), "uri-handler", plugin, |
1175 purple_signal_disconnect(purple_get_core(), "uri-handler", plugin, |
| 1165 PURPLE_CALLBACK(irc_uri_handler)); |
1176 PURPLE_CALLBACK(irc_uri_handler)); |
| 1166 |
1177 |
| 1167 if (!purple_protocols_remove(_irc_protocol, error)) |
1178 g_clear_object(&_irc_protocol); |
| 1168 return FALSE; |
|
| 1169 |
1179 |
| 1170 return TRUE; |
1180 return TRUE; |
| 1171 } |
1181 } |
| 1172 |
1182 |
| 1173 PURPLE_PLUGIN_INIT(irc, plugin_query, plugin_load, plugin_unload); |
1183 PURPLE_PLUGIN_INIT(irc, plugin_query, plugin_load, plugin_unload); |