# HG changeset patch # User Thomas Butter # Date 1125014457 0 # Node ID 03d9507f05a92adefca02e5bf0eb310f7ec104b2 # Parent 45a0c48c33a685ba2d9d5d59a71c9c7e11e1f799 [gaim-migrate @ 13562] privacy enhancements committer: Tailor Script diff -r 45a0c48c33a6 -r 03d9507f05a9 src/protocols/simple/simple.c --- a/src/protocols/simple/simple.c Thu Aug 25 21:00:11 2005 +0000 +++ b/src/protocols/simple/simple.c Fri Aug 26 00:00:57 2005 +0000 @@ -4,6 +4,10 @@ * gaim * * Copyright (C) 2005 Thomas Butter + * + * *** + * Thanks to Google's Summer of Code Program and the helpful mentors + * *** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +31,7 @@ #include "conversation.h" #include "debug.h" #include "notify.h" +#include "privacy.h" #include "prpl.h" #include "plugin.h" #include "util.h" @@ -86,8 +91,11 @@ static void do_notifies(struct simple_account_data *sip) { GSList *tmp = sip->watcher; gaim_debug_info("simple", "do_notifies()\n"); - if((sip->republish != -1) || sip->republish < time(NULL)) - send_publish(sip); + if((sip->republish != -1) || sip->republish < time(NULL)) { + if(gaim_account_get_bool(sip->account, "dopublish", TRUE)) { + send_publish(sip); + } + } while(tmp) { gaim_debug_info("simple", "notifying %s\n", ((struct simple_watcher*)tmp->data)->name); @@ -697,7 +705,9 @@ switch (msg->response) { case 200: if(sip->registerstatus<3) { /* registered */ - send_publish(sip); + if(gaim_account_get_bool(sip->account, "dopublish", TRUE)) { + send_publish(sip); + } } sip->registerstatus=3; gaim_connection_set_state(sip->gc, GAIM_CONNECTED); @@ -831,7 +841,7 @@ } static gboolean process_publish_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - if(msg->response != 200) { + if(msg->response != 200 && msg->response != 408) { /* never send again */ sip->republish = -1; } @@ -860,6 +870,10 @@ ourtag = gentag(); } if(!watcher) { /* new subscription */ + if(!gaim_privacy_check(sip->account, from)) { + send_sip_response(sip->gc, msg, 202, "Ok", NULL); + goto privend; + } watcher = watcher_create(sip, from, callid, ourtag, theirtag); } if(tagadded) { @@ -878,6 +892,12 @@ send_sip_response(sip->gc, msg, 200, "Ok", NULL); g_free(tmp); send_notify(sip, watcher); +privend: + g_free(from); + g_free(theirtag); + g_free(ourtag); + g_free(callid); + g_free(expire); } static void process_input_message(struct simple_account_data *sip, struct sipmsg *msg) { @@ -1213,6 +1233,13 @@ /* TODO free connections */ } +/* not needed since privacy is checked for every subscribe */ +static void dummy_add_deny(GaimConnection *gc, const char *name) { +} + +static void dummy_permit_deny(GaimConnection *gc) { +} + static GaimPluginProtocolInfo prpl_info = { 0, @@ -1240,11 +1267,11 @@ NULL, /* add_buddies */ simple_remove_buddy, /* remove_buddy */ NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ + dummy_add_deny, /* add_permit */ + dummy_add_deny, /* add_deny */ + dummy_add_deny, /* rem_permit */ + dummy_add_deny, /* rem_deny */ + dummy_permit_deny, /* set_permit_deny */ NULL, /* join_chat */ NULL, /* reject_chat */ NULL, /* get_chat_name */ @@ -1312,6 +1339,9 @@ split = gaim_account_user_split_new(_("Server"), "", '@'); prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); + option = gaim_account_option_bool_new(_("Publish Status (note: everyone may watch you)"), "dopublish", TRUE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_bool_new(_("Use UDP"), "udp", FALSE); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); option = gaim_account_option_bool_new(_("Use Proxy"), "useproxy", FALSE);