summaryrefslogtreecommitdiff
path: root/libpurple
diff options
context:
space:
mode:
authorTim Ringenbach <marv@pidgin.im>2007-04-25 01:12:47 +0000
committerTim Ringenbach <marv@pidgin.im>2007-04-25 01:12:47 +0000
commit2fd1b4f0f3a12d07ee351ac9b861d35e25a0abd4 (patch)
treeae885e93f88fe6f82ff5b169c5f595f864dd1d41 /libpurple
parente3a9334bcb5159d02d30cbbeca1cb87b023d9db4 (diff)
parentf49d3d8a3bc55e6e0c5e5d22351c3a29aef8c8c3 (diff)
downloadpidgin-2fd1b4f0f3a12d07ee351ac9b861d35e25a0abd4.tar.gz
merge of '4a6965178aa67220d5ee9ae05a2563bb665b6dd2'
and 'ee84a282735614b43941363a49cd7abf9198d100'
Diffstat (limited to 'libpurple')
-rw-r--r--libpurple/Makefile.am4
-rw-r--r--libpurple/Makefile.mingw2
-rw-r--r--libpurple/account.c2
-rw-r--r--libpurple/blist.c2
-rw-r--r--libpurple/buddyicon.c59
-rw-r--r--libpurple/buddyicon.h13
-rw-r--r--libpurple/core.c7
-rw-r--r--libpurple/dnsquery.c4
-rw-r--r--libpurple/dnssrv.c2
-rw-r--r--libpurple/gaim-compat.h7
-rw-r--r--libpurple/internal.h6
-rw-r--r--libpurple/notify.c1
-rw-r--r--libpurple/plugins/psychic.c6
-rw-r--r--libpurple/protocols/jabber/auth.c2
-rw-r--r--libpurple/protocols/msn/slp.c2
-rw-r--r--libpurple/protocols/oscar/oscar.c7
-rw-r--r--libpurple/protocols/silc/buddy.c2
-rw-r--r--libpurple/savedstatuses.c2
-rw-r--r--libpurple/win32/global.mak1
-rw-r--r--libpurple/win32/targets.mak9
20 files changed, 104 insertions, 36 deletions
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
index a50cffd1f0..541ced233e 100644
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -173,7 +173,7 @@ $(libpurple_la_OBJECTS): dbus-types.h
libpurple_client_lib = libpurple-client.la
libpurple_client_la_SOURCES = purple-client.c purple-client.h
-
+libpurple_client_la_LDFLAGS = -version-info $(PURPLE_LT_VERSION_INFO) -no-undefined
libpurple_client_la_LIBADD = $(DBUS_LIBS)
purple-client-bindings.c: dbus-analyze-functions.py $(dbus_exported)
@@ -221,7 +221,7 @@ libpurpleinclude_HEADERS = \
$(dbus_headers)
libpurple_la_DEPENDENCIES = $(STATIC_LINK_LIBS)
-libpurple_la_LDFLAGS = -export-dynamic -version-info $(LT_VERSION_INFO) -no-undefined
+libpurple_la_LDFLAGS = -export-dynamic -version-info $(PURPLE_LT_VERSION_INFO) -no-undefined
libpurple_la_LIBADD = \
$(DBUS_LIBS) \
$(GLIB_LIBS) \
diff --git a/libpurple/Makefile.mingw b/libpurple/Makefile.mingw
index 0f805d2a29..d737017c37 100644
--- a/libpurple/Makefile.mingw
+++ b/libpurple/Makefile.mingw
@@ -117,7 +117,7 @@ install: install_shallow all
sed -e 's/@PURPLE_VERSION@/$(PURPLE_VERSION)/g' \
$@.in > $@
-$(OBJECTS): $(PURPLE_CONFIG_H)
+$(OBJECTS): $(PURPLE_CONFIG_H) $(PURPLE_VERSION_H)
$(TARGET).dll $(TARGET).dll.a: $(OBJECTS)
$(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll
diff --git a/libpurple/account.c b/libpurple/account.c
index 3586812b8d..addee7d78b 100644
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -802,7 +802,7 @@ load_accounts(void)
xmlnode_free(node);
- purple_buddy_icons_account_loaded_cb();
+ _purple_buddy_icons_account_loaded_cb();
}
diff --git a/libpurple/blist.c b/libpurple/blist.c
index cc2146c6b0..13c199bbc0 100644
--- a/libpurple/blist.c
+++ b/libpurple/blist.c
@@ -607,7 +607,7 @@ purple_blist_load()
xmlnode_free(purple);
/* This tells the buddy icon code to do its thing. */
- purple_buddy_icons_blist_loaded_cb();
+ _purple_buddy_icons_blist_loaded_cb();
}
diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c
index 412da428ac..0212cd64cf 100644
--- a/libpurple/buddyicon.c
+++ b/libpurple/buddyicon.c
@@ -212,6 +212,10 @@ image_deleting_cb(PurpleStoredImage *img, gpointer data)
{
const char *filename = purple_imgstore_get_filename(img);
+ /* If there's no filename, it can't be one of our images. */
+ if (filename == NULL)
+ return;
+
if (img == g_hash_table_lookup(icon_data_cache, filename))
{
purple_buddy_icon_data_uncache_file(filename);
@@ -694,11 +698,13 @@ purple_buddy_icons_set_account_icon(PurpleAccount *account,
{
const char *filename = purple_imgstore_get_filename(img);
purple_account_set_string(account, "buddy_icon", filename);
+ purple_account_set_int(account, "buddy_icon_timestamp", time(NULL));
ref_filename(filename);
}
else
{
purple_account_set_string(account, "buddy_icon", NULL);
+ purple_account_set_int(account, "buddy_icon_timestamp", 0);
}
unref_filename(old_icon);
@@ -721,7 +727,7 @@ purple_buddy_icons_set_account_icon(PurpleAccount *account,
if (old_img)
purple_imgstore_unref(old_img);
- else
+ else if (old_icon)
{
/* The old icon may not have been loaded into memory. In that
* case, we'll need to uncache the filename. The filenames
@@ -733,6 +739,25 @@ purple_buddy_icons_set_account_icon(PurpleAccount *account,
return img;
}
+time_t
+purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account)
+{
+ time_t ret;
+
+ g_return_val_if_fail(account != NULL, 0);
+
+ ret = purple_account_get_int(account, "buddy_icon_timestamp", 0);
+
+ /* This deals with migration cases. */
+ if (ret == 0 && purple_account_get_string(account, "buddy_icon", NULL) != NULL)
+ {
+ ret = time(NULL);
+ purple_account_set_int(account, "buddy_icon_timestamp", ret);
+ }
+
+ return ret;
+}
+
PurpleStoredImage *
purple_buddy_icons_find_custom_icon(PurpleContact *contact)
{
@@ -829,7 +854,7 @@ purple_buddy_icons_set_custom_icon(PurpleContact *contact,
if (old_img)
purple_imgstore_unref(old_img);
- else
+ else if (old_icon)
{
/* The old icon may not have been loaded into memory. In that
* case, we'll need to uncache the filename. The filenames
@@ -842,7 +867,7 @@ purple_buddy_icons_set_custom_icon(PurpleContact *contact,
}
void
-purple_buddy_icon_set_old_icons_dir(const char *dirname)
+_purple_buddy_icon_set_old_icons_dir(const char *dirname)
{
old_icons_dir = g_strdup(dirname);
}
@@ -887,9 +912,19 @@ migrate_buddy_icon(PurpleBlistNode *node, const char *setting_name,
FILE *file;
char *new_filename;
- if (!read_icon_file(path, &icon_data, &icon_len) ||
- icon_data == NULL || icon_len > 0)
+ if (!read_icon_file(path, &icon_data, &icon_len))
{
+ g_free(path);
+ delete_buddy_icon_settings(node, setting_name);
+ return;
+ }
+
+ if (icon_data == NULL || icon_len <= 0)
+ {
+ /* This really applies to the icon_len check.
+ * icon_data should never be NULL if
+ * read_icon_file() returns TRUE. */
+ purple_debug_error("buddyicon", "Empty buddy icon file: %s\n", path);
delete_buddy_icon_settings(node, setting_name);
g_free(path);
return;
@@ -900,8 +935,11 @@ migrate_buddy_icon(PurpleBlistNode *node, const char *setting_name,
new_filename = purple_buddy_icon_data_calculate_filename(icon_data, icon_len);
if (new_filename == NULL)
{
+ purple_debug_error("buddyicon",
+ "New icon filename is NULL. This should never happen! "
+ "The old filename was: %s\n", path);
delete_buddy_icon_settings(node, setting_name);
- return;
+ g_return_if_reached();
}
path = g_build_filename(dirname, new_filename, NULL);
@@ -967,14 +1005,14 @@ migrate_buddy_icon(PurpleBlistNode *node, const char *setting_name,
}
else
{
- /* If the icon is gone, drop the setting... */
+ purple_debug_error("buddyicon", "Old icon file doesn't exist: %s\n", path);
delete_buddy_icon_settings(node, setting_name);
g_free(path);
}
}
void
-purple_buddy_icons_account_loaded_cb()
+_purple_buddy_icons_account_loaded_cb()
{
const char *dirname = purple_buddy_icons_get_cache_dir();
GList *cur;
@@ -999,7 +1037,7 @@ purple_buddy_icons_account_loaded_cb()
}
void
-purple_buddy_icons_blist_loaded_cb()
+_purple_buddy_icons_blist_loaded_cb()
{
PurpleBlistNode *node = purple_blist_get_root();
const char *dirname = purple_buddy_icons_get_cache_dir();
@@ -1124,7 +1162,8 @@ purple_buddy_icons_init()
g_direct_hash, g_direct_equal,
NULL, (GFreeFunc)g_hash_table_destroy);
- icon_data_cache = g_hash_table_new(g_str_hash, g_str_equal);
+ icon_data_cache = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, NULL);
icon_file_cache = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, NULL);
pointer_icon_cache = g_hash_table_new(g_direct_hash, g_direct_equal);
diff --git a/libpurple/buddyicon.h b/libpurple/buddyicon.h
index a78fdd3fdc..33e4f8e7ab 100644
--- a/libpurple/buddyicon.h
+++ b/libpurple/buddyicon.h
@@ -261,6 +261,19 @@ purple_buddy_icons_set_account_icon(PurpleAccount *account,
guchar *icon_data, size_t icon_len);
/**
+ * Returns the timestamp of when the icon was set.
+ *
+ * This is intended for use in protocols that require a timestamp for
+ * buddy icon update reasons.
+ *
+ * @param account The account
+ *
+ * @return The time the icon was set, or 0 if an error occurred.
+ */
+time_t
+purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account);
+
+/**
* Returns the custom buddy icon image for a contact.
*
* The caller owns a reference to the image in the store, and must dereference
diff --git a/libpurple/core.c b/libpurple/core.c
index 76d0ff5eae..457ba6e331 100644
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -401,8 +401,9 @@ purple_core_migrate(void)
if (!strcmp(entry, "logs"))
{
char buf[MAXPATHLEN];
+ size_t linklen;
- if (readlink(name, buf, sizeof(buf) - 1) == -1)
+ if ((linklen = readlink(name, buf, sizeof(buf) - 1) == -1))
{
purple_debug_error("core", "Error reading symlink %s: %s\n",
name, strerror(errno));
@@ -412,7 +413,7 @@ purple_core_migrate(void)
g_free(old_user_dir);
return FALSE;
}
- buf[sizeof(buf) - 1] = '\0';
+ buf[linklen] = '\0';
logs_dir = g_strconcat(user_dir, G_DIR_SEPARATOR_S "logs", NULL);
@@ -640,7 +641,7 @@ purple_core_migrate(void)
}
old_icons_dir = g_build_filename(old_user_dir, "icons", NULL);
- purple_buddy_icon_set_old_icons_dir(old_icons_dir);
+ _purple_buddy_icon_set_old_icons_dir(old_icons_dir);
g_free(old_icons_dir);
g_free(old_user_dir);
diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c
index 6d78cdd094..4b8d606f18 100644
--- a/libpurple/dnsquery.c
+++ b/libpurple/dnsquery.c
@@ -140,7 +140,7 @@ purple_dnsquery_ui_resolve(PurpleDnsQueryData *query_data)
* Begin the DNS resolver child process functions.
*/
#ifdef HAVE_SIGNAL_H
-static void
+G_GNUC_NORETURN static void
trap_gdb_bug()
{
const char *message =
@@ -158,7 +158,7 @@ trap_gdb_bug()
}
#endif
-static void
+G_GNUC_NORETURN static void
purple_dnsquery_resolver_run(int child_out, int child_in, gboolean show_debug)
{
dns_params_t dns_params;
diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c
index aaaa6fb732..7d294a08ed 100644
--- a/libpurple/dnssrv.c
+++ b/libpurple/dnssrv.c
@@ -92,7 +92,7 @@ responsecompare(gconstpointer ar, gconstpointer br)
#ifndef _WIN32
-static void
+G_GNUC_NORETURN static void
resolve(int in, int out)
{
GList *ret = NULL;
diff --git a/libpurple/gaim-compat.h b/libpurple/gaim-compat.h
index ec5270ef04..66c8e8d9f9 100644
--- a/libpurple/gaim-compat.h
+++ b/libpurple/gaim-compat.h
@@ -345,7 +345,7 @@
#define gaim_buddy_icon_update purple_buddy_icon_update
#define gaim_buddy_icon_set_data(icon, data, len) \
- purple_buddy_icon_set_protocol_data(icon, g_memdup(data, len), len, NULL);
+ purple_buddy_icon_set_data(icon, g_memdup(data, len), len, NULL);
#define gaim_buddy_icon_get_account purple_buddy_icon_get_account
#define gaim_buddy_icon_get_username purple_buddy_icon_get_username
@@ -353,7 +353,7 @@
#define gaim_buddy_icon_get_type purple_buddy_icon_get_extension
#define gaim_buddy_icons_set_for_user(icon, data, len) \
- purple_buddy_icons_set_for_user(icon, g_memdup(data, len), len)
+ purple_buddy_icons_set_for_user(icon, g_memdup(data, len), len, NULL)
#define gaim_buddy_icons_find purple_buddy_icons_find
#define gaim_buddy_icons_set_caching purple_buddy_icons_set_caching
#define gaim_buddy_icons_is_caching purple_buddy_icons_is_caching
@@ -961,7 +961,8 @@
#define GaimStoredImage PurpleStoredImage
-#define gaim_imgstore_add(data, size, filename) purple_imgstore_add_with_id(g_memdup(data, size), size, filename)
+#define gaim_imgstore_add(data, size, filename) \
+ purple_imgstore_add_with_id(g_memdup(data, size), size, filename)
#define gaim_imgstore_get purple_imgstore_find_by_id
#define gaim_imgstore_get_data purple_imgstore_get_data
#define gaim_imgstore_get_size purple_imgstore_get_size
diff --git a/libpurple/internal.h b/libpurple/internal.h
index 8c6d7ef1fd..9448c73771 100644
--- a/libpurple/internal.h
+++ b/libpurple/internal.h
@@ -187,17 +187,17 @@
/* This is for the accounts code to notify the buddy icon code that
* it's done loading. We may want to replace this with a signal. */
void
-purple_buddy_icons_account_loaded_cb(void);
+_purple_buddy_icons_account_loaded_cb(void);
/* This is for the buddy list to notify the buddy icon code that
* it's done loading. We may want to replace this with a signal. */
void
-purple_buddy_icons_blist_loaded_cb(void);
+_purple_buddy_icons_blist_loaded_cb(void);
/* This is for the purple_core_migrate() code to tell the buddy
* icon subsystem about the old icons directory so it can
* migrate any icons in use. */
void
-purple_buddy_icon_set_old_icons_dir(const char *dirname);
+_purple_buddy_icon_set_old_icons_dir(const char *dirname);
#endif /* _PURPLE_INTERNAL_H_ */
diff --git a/libpurple/notify.c b/libpurple/notify.c
index cde2c3ca60..6454dff6ac 100644
--- a/libpurple/notify.c
+++ b/libpurple/notify.c
@@ -521,6 +521,7 @@ purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info)
}
g_list_free(user_info->user_info_entries);
+ g_free(user_info);
}
GList *
diff --git a/libpurple/plugins/psychic.c b/libpurple/plugins/psychic.c
index 16c1645977..8ce1510580 100644
--- a/libpurple/plugins/psychic.c
+++ b/libpurple/plugins/psychic.c
@@ -9,6 +9,7 @@
#include "signals.h"
#include "status.h"
#include "version.h"
+#include "privacy.h"
#include "plugin.h"
#include "pluginpref.h"
@@ -47,6 +48,11 @@ buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) {
return;
}
+ if(FALSE == purple_privacy_check(acct, name)) {
+ purple_debug_info("psychic", "user %s is blocked", name);
+ return;
+ }
+
gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, acct);
if(! gconv) {
purple_debug_info("psychic", "no previous conversation exists\n");
diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c
index 2c8e93c2ae..1d00d0d9eb 100644
--- a/libpurple/protocols/jabber/auth.c
+++ b/libpurple/protocols/jabber/auth.c
@@ -819,7 +819,7 @@ jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet)
} else {
response = xmlnode_new("response");
xmlnode_set_namespace(response, "urn:ietf:params:xml:ns:xmpp-sasl");
- if (c_out) {
+ if (clen > 0) {
enc_out = purple_base64_encode((unsigned char*)c_out, clen);
xmlnode_insert_data(response, enc_out, -1);
g_free(enc_out);
diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c
index 22dedc77b5..3f2e5ab01b 100644
--- a/libpurple/protocols/msn/slp.c
+++ b/libpurple/protocols/msn/slp.c
@@ -955,7 +955,7 @@ msn_queue_buddy_icon_request(MsnUser *user)
if (obj == NULL)
{
-/* purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL); */
+ purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL);
return;
}
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
index e633c8246b..4c4faf7a03 100644
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -1941,9 +1941,9 @@ static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t
purple_debug_info("oscar",
"Sending buddy icon to %s (%d bytes)\n",
userinfo->sn, len);
- /* TODO: XXX: FIXME: Does this actually need the mtime of the file? */
aim_im_sendch2_icon(od, userinfo->sn, data, len,
- time(NULL), aimutil_iconsum(data, len));
+ purple_buddy_icons_get_account_icon_timestamp(account),
+ aimutil_iconsum(data, len));
}
purple_imgstore_unref(img);
@@ -4232,8 +4232,7 @@ oscar_send_im(PurpleConnection *gc, const char *name, const char *message, Purpl
gconstpointer data = purple_imgstore_get_data(img);
args.iconlen = purple_imgstore_get_size(img);
args.iconsum = aimutil_iconsum(data, args.iconlen);
- /* TODO: XXX: FIXME: Deal with the timestamp issue. */
- args.iconstamp = time(NULL);
+ args.iconstamp = purple_buddy_icons_get_account_icon_timestamp(account);
if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) {
bi->ico_informed = FALSE;
diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c
index 0db527e6ef..dcde59b420 100644
--- a/libpurple/protocols/silc/buddy.c
+++ b/libpurple/protocols/silc/buddy.c
@@ -1706,7 +1706,7 @@ void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img)
if (!mime)
return;
- t = purple_util_get_image_extension(purple_imgstore_get_data(img), purple_imgstore_get_size(img));
+ t = purple_imgstore_get_extension(img);
if (!t || !strcmp(t, "icon")) {
silc_mime_free(mime);
return;
diff --git a/libpurple/savedstatuses.c b/libpurple/savedstatuses.c
index e662b26cfa..5ef94d6343 100644
--- a/libpurple/savedstatuses.c
+++ b/libpurple/savedstatuses.c
@@ -154,7 +154,7 @@ set_creation_time(PurpleSavedStatus *status, time_t creation_time)
}
/**
- * A magic number is calcuated for each status, and then the
+ * A magic number is calculated for each status, and then the
* statuses are ordered by the magic number. The magic number
* is the date the status was last used offset by one day for
* each time the status has been used (but only by 10 days at
diff --git a/libpurple/win32/global.mak b/libpurple/win32/global.mak
index 002057d3dc..1e5abc7322 100644
--- a/libpurple/win32/global.mak
+++ b/libpurple/win32/global.mak
@@ -48,6 +48,7 @@ PURPLE_PROTOS_TOP := $(PURPLE_TOP)/protocols
PIDGIN_CONFIG_H := $(PIDGIN_TREE_TOP)/config.h
PURPLE_CONFIG_H := $(PIDGIN_TREE_TOP)/config.h
PIDGIN_IDLETRACK_DLL := $(PIDGIN_IDLETRACK_TOP)/idletrack.dll
+PURPLE_VERSION_H := $(PURPLE_TOP)/version.h
PURPLE_DLL := $(PURPLE_TOP)/libpurple.dll
PURPLE_PERL_DLL := $(PURPLE_PERL_TOP)/perl.dll
PIDGIN_DLL := $(PIDGIN_TOP)/pidgin.dll
diff --git a/libpurple/win32/targets.mak b/libpurple/win32/targets.mak
index 91c251da48..197bc801b0 100644
--- a/libpurple/win32/targets.mak
+++ b/libpurple/win32/targets.mak
@@ -8,7 +8,14 @@
$(PIDGIN_CONFIG_H): $(PIDGIN_TREE_TOP)/config.h.mingw
cp $(PIDGIN_TREE_TOP)/config.h.mingw $(PIDGIN_CONFIG_H)
-$(PURPLE_DLL) $(PURPLE_DLL).a:
+$(PURPLE_VERSION_H): $(PURPLE_VERSION_H).in $(PIDGIN_TREE_TOP)/configure.ac
+ cp $(PURPLE_VERSION_H).in $(PURPLE_VERSION_H)
+ awk 'BEGIN {FS="[\\(\\)\\[\\]]"} \
+ /^m4_define..purple_major_version/ {system("sed -i -e s/@PURPLE_MAJOR_VERSION@/"$$5"/ $(PURPLE_VERSION_H)");} \
+ /^m4_define..purple_minor_version/ {system("sed -i -e s/@PURPLE_MINOR_VERSION@/"$$5"/ $(PURPLE_VERSION_H)");} \
+ /^m4_define..purple_micro_version/ {system("sed -i -e s/@PURPLE_MICRO_VERSION@/"$$5"/ $(PURPLE_VERSION_H)"); exit}' $(PIDGIN_TREE_TOP)/configure.ac
+
+$(PURPLE_DLL) $(PURPLE_DLL).a: $(PURPLE_VERSION_H)
$(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE) libpurple.dll
$(PURPLE_PERL_DLL) $(PURPLE_PERL_DLL).a: