comparison src/protocols/gg/gg.c @ 3572:bdd0bebd2d04

[gaim-migrate @ 3670] Phase II. No longer do you have to worry about protocol plugins. When Gaim probes plugins on load, it will detect protocol plugins and add them to the list of available protocols. When you try to log an account on with one of them, Gaim will automatically load the plugin--when no more accounts need the protocol--Gaim will automatically unload it. Protocol plugins are no longer available in the plugins ui, and no protocols are compiled statically by default. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 30 Sep 2002 01:05:18 +0000
parents 7a3f16a375a5
children ad8d15bbbd2d
comparison
equal deleted inserted replaced
3571:a88c62c5b7da 3572:bdd0bebd2d04
1 /* 1 /*
2 * gaim - Gadu-Gadu Protocol Plugin 2 * gaim - Gadu-Gadu Protocol Plugin
3 * $Id: gg.c 3516 2002-08-29 01:47:15Z seanegan $ 3 * $Id: gg.c 3670 2002-09-30 01:05:18Z seanegan $
4 * 4 *
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> 5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
97 gchar *host; 97 gchar *host;
98 int inpa; 98 int inpa;
99 int type; 99 int type;
100 }; 100 };
101 101
102 static char *agg_name()
103 {
104 return "Gadu-Gadu";
105 }
106 102
107 static gchar *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) 103 static gchar *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst)
108 { 104 {
109 #ifdef HAVE_ICONV 105 #ifdef HAVE_ICONV
110 gchar *result = NULL; 106 gchar *result = NULL;
302 g_snprintf(buf, sizeof(buf), _("Status: %s"), get_away_text(b->uc)); 298 g_snprintf(buf, sizeof(buf), _("Status: %s"), get_away_text(b->uc));
303 pbm->label = buf; 299 pbm->label = buf;
304 pbm->callback = NULL; 300 pbm->callback = NULL;
305 pbm->gc = gc; 301 pbm->gc = gc;
306 m = g_list_append(m, pbm); 302 m = g_list_append(m, pbm);
307
308 return m;
309 }
310
311 static GList *agg_user_opts()
312 {
313 GList *m = NULL;
314 struct proto_user_opt *puo;
315
316 puo = g_new0(struct proto_user_opt, 1);
317 puo->label = _("Nick:");
318 puo->def = _("Gadu-Gadu User");
319 puo->pos = USEROPT_NICK;
320 m = g_list_append(m, puo);
321 303
322 return m; 304 return m;
323 } 305 }
324 306
325 static void main_callback(gpointer data, gint source, GaimInputCondition cond) 307 static void main_callback(gpointer data, gint source, GaimInputCondition cond)
1239 1221
1240 static struct prpl *my_protocol = NULL; 1222 static struct prpl *my_protocol = NULL;
1241 1223
1242 void gg_init(struct prpl *ret) 1224 void gg_init(struct prpl *ret)
1243 { 1225 {
1226 struct proto_user_opt *puo;
1244 ret->protocol = PROTO_GADUGADU; 1227 ret->protocol = PROTO_GADUGADU;
1245 ret->options = 0; 1228 ret->options = 0;
1246 ret->name = agg_name; 1229 ret->name = g_strdup("Gadu-Gadu");
1247 ret->list_icon = agg_list_icon; 1230 ret->list_icon = agg_list_icon;
1248 ret->away_states = agg_away_states; 1231 ret->away_states = agg_away_states;
1249 ret->actions = agg_actions; 1232 ret->actions = agg_actions;
1250 ret->do_action = agg_do_action; 1233 ret->do_action = agg_do_action;
1251 ret->user_opts = agg_user_opts;
1252 ret->buddy_menu = agg_buddy_menu; 1234 ret->buddy_menu = agg_buddy_menu;
1253 ret->chat_info = NULL; 1235 ret->chat_info = NULL;
1254 ret->login = agg_login; 1236 ret->login = agg_login;
1255 ret->close = agg_close; 1237 ret->close = agg_close;
1256 ret->send_im = agg_send_im; 1238 ret->send_im = agg_send_im;
1276 ret->chat_leave = NULL; 1258 ret->chat_leave = NULL;
1277 ret->chat_whisper = NULL; 1259 ret->chat_whisper = NULL;
1278 ret->chat_send = NULL; 1260 ret->chat_send = NULL;
1279 ret->keepalive = agg_keepalive; 1261 ret->keepalive = agg_keepalive;
1280 ret->normalize = NULL; 1262 ret->normalize = NULL;
1263
1264 puo = g_new0(struct proto_user_opt, 1);
1265 puo->label = g_strdup(_("Nick:"));
1266 puo->def = g_strdup(_("Gadu-Gadu User"));
1267 puo->pos = USEROPT_NICK;
1268 ret->user_opts = g_list_append(ret->user_opts, puo);
1269
1281 my_protocol = ret; 1270 my_protocol = ret;
1282 } 1271 }
1283 1272
1284 #ifndef STATIC 1273 #ifndef STATIC
1285 1274
1286 char *gaim_plugin_init(GModule *handle) 1275 void *gaim_prpl_init(struct prpl *prpl)
1287 { 1276 {
1288 load_protocol(gg_init, sizeof(struct prpl)); 1277 gg_init(prpl);
1289 return NULL; 1278 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
1290 }
1291
1292 void gaim_plugin_remove()
1293 {
1294 struct prpl *p = find_prpl(PROTO_GADUGADU);
1295 if (p == my_protocol)
1296 unload_protocol(p);
1297 }
1298
1299 char *name()
1300 {
1301 return "Gadu-Gadu";
1302 }
1303
1304 char *description()
1305 {
1306 return PRPL_DESC("Gadu-Gadu");
1307 } 1279 }
1308 1280
1309 #endif 1281 #endif
1310 1282
1311 /* 1283 /*