comparison src/protocols/toc/toc.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 16f4776742af
children 9682c0e022c6
comparison
equal deleted inserted replaced
3571:a88c62c5b7da 3572:bdd0bebd2d04
925 } else { 925 } else {
926 debug_printf("don't know what to do with %s\n", c); 926 debug_printf("don't know what to do with %s\n", c);
927 } 927 }
928 } 928 }
929 929
930 static char *toc_name()
931 {
932 return "TOC";
933 }
934
935 static int toc_send_im(struct gaim_connection *gc, char *name, char *message, int len, int flags) 930 static int toc_send_im(struct gaim_connection *gc, char *name, char *message, int len, int flags)
936 { 931 {
937 char buf[BUF_LEN * 2]; 932 char buf[BUF_LEN * 2];
938 char *tmp = g_malloc(strlen(message) * 4 + 1); /* 4 because \n gets replaced with <BR> */ 933 char *tmp = g_malloc(strlen(message) * 4 + 1); /* 4 because \n gets replaced with <BR> */
939 934
1224 pbm = g_new0(struct proto_buddy_menu, 1); 1219 pbm = g_new0(struct proto_buddy_menu, 1);
1225 pbm->label = _("Get Dir Info"); 1220 pbm->label = _("Get Dir Info");
1226 pbm->callback = toc_get_dir; 1221 pbm->callback = toc_get_dir;
1227 pbm->gc = gc; 1222 pbm->gc = gc;
1228 m = g_list_append(m, pbm); 1223 m = g_list_append(m, pbm);
1229
1230 return m;
1231 }
1232
1233 static GList *toc_user_opts()
1234 {
1235 GList *m = NULL;
1236 struct proto_user_opt *puo;
1237
1238 puo = g_new0(struct proto_user_opt, 1);
1239 puo->label = "TOC Host:";
1240 puo->def = "toc.oscar.aol.com";
1241 puo->pos = USEROPT_AUTH;
1242 m = g_list_append(m, puo);
1243
1244 puo = g_new0(struct proto_user_opt, 1);
1245 puo->label = "TOC Port:";
1246 puo->def = "9898";
1247 puo->pos = USEROPT_AUTHPORT;
1248 m = g_list_append(m, puo);
1249 1224
1250 return m; 1225 return m;
1251 } 1226 }
1252 1227
1253 static void toc_add_permit(struct gaim_connection *gc, char *who) 1228 static void toc_add_permit(struct gaim_connection *gc, char *who)
1380 } 1355 }
1381 1356
1382 static struct prpl *my_protocol = NULL; 1357 static struct prpl *my_protocol = NULL;
1383 1358
1384 void toc_init(struct prpl *ret) 1359 void toc_init(struct prpl *ret)
1385 { 1360 {
1361 struct proto_user_opt *puo;
1386 ret->protocol = PROTO_TOC; 1362 ret->protocol = PROTO_TOC;
1387 ret->options = OPT_PROTO_CORRECT_TIME; 1363 ret->options = OPT_PROTO_CORRECT_TIME;
1388 ret->name = toc_name; 1364 ret->name = g_strdup("TOC");
1389 ret->list_icon = toc_list_icon; 1365 ret->list_icon = toc_list_icon;
1390 ret->away_states = toc_away_states; 1366 ret->away_states = toc_away_states;
1391 ret->actions = toc_actions; 1367 ret->actions = toc_actions;
1392 ret->do_action = toc_do_action; 1368 ret->do_action = toc_do_action;
1393 ret->buddy_menu = toc_buddy_menu; 1369 ret->buddy_menu = toc_buddy_menu;
1394 ret->user_opts = toc_user_opts;
1395 ret->login = toc_login; 1370 ret->login = toc_login;
1396 ret->close = toc_close; 1371 ret->close = toc_close;
1397 ret->send_im = toc_send_im; 1372 ret->send_im = toc_send_im;
1398 ret->set_info = toc_set_info; 1373 ret->set_info = toc_set_info;
1399 ret->get_info = toc_get_info; 1374 ret->get_info = toc_get_info;
1419 ret->chat_leave = toc_chat_leave; 1394 ret->chat_leave = toc_chat_leave;
1420 ret->chat_whisper = toc_chat_whisper; 1395 ret->chat_whisper = toc_chat_whisper;
1421 ret->chat_send = toc_chat_send; 1396 ret->chat_send = toc_chat_send;
1422 ret->keepalive = toc_keepalive; 1397 ret->keepalive = toc_keepalive;
1423 1398
1399 puo = g_new0(struct proto_user_opt, 1);
1400 puo->label = g_strdup("TOC Host:");
1401 puo->def = g_strdup("toc.oscar.aol.com");
1402 puo->pos = USEROPT_AUTH;
1403 ret->user_opts = g_list_append(ret->user_opts, puo);
1404
1405 puo = g_new0(struct proto_user_opt, 1);
1406 puo->label = g_strdup("TOC Port:");
1407 puo->def = g_strdup("9898");
1408 puo->pos = USEROPT_AUTHPORT;
1409 ret->user_opts = g_list_append(ret->user_opts, puo);
1410
1424 my_protocol = ret; 1411 my_protocol = ret;
1425 } 1412 }
1426 1413
1427 #ifndef STATIC 1414 #ifndef STATIC
1428 1415
1429 char *gaim_plugin_init(GModule *handle) 1416 void *gaim_prpl_init(struct prpl *prpl)
1430 { 1417 {
1431 load_protocol(toc_init, sizeof(struct prpl)); 1418 toc_init(prpl);
1432 return NULL; 1419 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
1433 }
1434
1435 void gaim_plugin_remove()
1436 {
1437 struct prpl *p = find_prpl(PROTO_TOC);
1438 if (p == my_protocol)
1439 unload_protocol(p);
1440 }
1441
1442 char *name()
1443 {
1444 return "TOC";
1445 }
1446
1447 char *description()
1448 {
1449 return PRPL_DESC("TOC");
1450 } 1420 }
1451 1421
1452 #endif 1422 #endif
1453 1423
1454 /********* 1424 /*********