comparison libpurple/protocols/silc/silc.c @ 32767:2ec94166be43

On the way to hiding the PurpleConnection struct. * Added purple_connection_get_flags() and purple_connection_set_flags() * Use purple_connection_ accessor functions.
author andrew.victor@mxit.com
date Tue, 18 Oct 2011 18:47:48 +0000
parents 10e5000326a5
children 6135b24cdc8a
comparison
equal deleted inserted replaced
32766:ea2b621fd3ba 32767:2ec94166be43
1059 "and your personal information. Please fill the information " 1059 "and your personal information. Please fill the information "
1060 "you would like other users to see about yourself."), 1060 "you would like other users to see about yourself."),
1061 fields, 1061 fields,
1062 _("OK"), G_CALLBACK(silcpurple_attrs_cb), 1062 _("OK"), G_CALLBACK(silcpurple_attrs_cb),
1063 _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), 1063 _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel),
1064 gc->account, NULL, NULL, gc); 1064 purple_connection_get_account(gc), NULL, NULL, gc);
1065 } 1065 }
1066 1066
1067 static void 1067 static void
1068 silcpurple_detach(PurplePluginAction *action) 1068 silcpurple_detach(PurplePluginAction *action)
1069 { 1069 {
1224 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); 1224 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname);
1225 1225
1226 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); 1226 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir());
1227 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); 1227 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir());
1228 g_snprintf(pkd, sizeof(pkd) - 1, "%s", 1228 g_snprintf(pkd, sizeof(pkd) - 1, "%s",
1229 purple_account_get_string(gc->account, "public-key", pkd2)); 1229 purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2));
1230 g_snprintf(prd, sizeof(prd) - 1, "%s", 1230 g_snprintf(prd, sizeof(prd) - 1, "%s",
1231 purple_account_get_string(gc->account, "private-key", prd2)); 1231 purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2));
1232 1232
1233 fields = purple_request_fields_new(); 1233 fields = purple_request_fields_new();
1234 1234
1235 g = purple_request_field_group_new(NULL); 1235 g = purple_request_field_group_new(NULL);
1236 f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); 1236 f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE);
1267 1267
1268 purple_request_fields(gc, _("Create New SILC Key Pair"), 1268 purple_request_fields(gc, _("Create New SILC Key Pair"),
1269 _("Create New SILC Key Pair"), NULL, fields, 1269 _("Create New SILC Key Pair"), NULL, fields,
1270 _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), 1270 _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb),
1271 _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), 1271 _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel),
1272 gc->account, NULL, NULL, gc); 1272 purple_connection_get_account(gc), NULL, NULL, gc);
1273 1273
1274 g_strfreev(u); 1274 g_strfreev(u);
1275 silc_free(hostname); 1275 silc_free(hostname);
1276 } 1276 }
1277 1277
1285 static void 1285 static void
1286 silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) 1286 silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new)
1287 { 1287 {
1288 char prd[256]; 1288 char prd[256];
1289 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); 1289 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir());
1290 silc_change_private_key_passphrase(purple_account_get_string(gc->account, 1290 silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc),
1291 "private-key", 1291 "private-key",
1292 prd), old ? old : "", new ? new : ""); 1292 prd), old ? old : "", new ? new : "");
1293 } 1293 }
1294 1294
1295 static void 1295 static void
1553 if (gc == NULL) 1553 if (gc == NULL)
1554 return PURPLE_CMD_RET_FAILED; 1554 return PURPLE_CMD_RET_FAILED;
1555 1555
1556 if(args && args[0]) 1556 if(args && args[0])
1557 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], 1557 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0],
1558 gc->account); 1558 purple_connection_get_account(gc));
1559 1559
1560 if (convo != NULL) 1560 if (convo != NULL)
1561 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); 1561 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo));
1562 1562
1563 if (id == 0) 1563 if (id == 0)
1591 buf = g_strdup_printf(_("current topic is: %s"), tmp2); 1591 buf = g_strdup_printf(_("current topic is: %s"), tmp2);
1592 g_free(tmp); 1592 g_free(tmp);
1593 g_free(tmp2); 1593 g_free(tmp2);
1594 } else 1594 } else
1595 buf = g_strdup(_("No topic is set")); 1595 buf = g_strdup(_("No topic is set"));
1596 purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(gc->account), buf, 1596 purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(purple_connection_get_account(gc)), buf,
1597 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); 1597 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
1598 g_free(buf); 1598 g_free(buf);
1599 1599
1600 } 1600 }
1601 1601