diff libpurple/protocols/jabber/jabber.c @ 17566:0370da969e8a

Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
author Andreas Monitzer <pidgin@monitzer.com>
date Wed, 06 Jun 2007 02:07:53 +0000
parents 95affacf6f82
children df5bb342b10e
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Wed Jun 06 01:37:28 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Wed Jun 06 02:07:53 2007 +0000
@@ -59,6 +59,7 @@
 #define JABBER_CONNECT_STEPS (js->gsc ? 8 : 5)
 
 static PurplePlugin *my_protocol = NULL;
+GList *jabber_features;
 
 static void jabber_stream_init(JabberStream *js)
 {
@@ -1024,12 +1025,6 @@
 #endif
 	if(js->serverFQDN)
 		g_free(js->serverFQDN);
-	while(js->features) {
-        g_free(((JabberFeature*)js->features->data)->shortname);
-        g_free(((JabberFeature*)js->features->data)->namespace);
-		g_free(js->features->data);
-		js->features = g_list_delete_link(js->features, js->features);
-	}
 	g_free(js->server_name);
 	g_free(js->gmail_last_time);
 	g_free(js->gmail_last_tid);
@@ -1099,20 +1094,20 @@
 	js->idle = idle ? time(NULL) - idle : idle;
 }
 
-void jabber_add_feature(JabberStream *js, const char *shortname, const char *namespace) {
+void jabber_add_feature(const char *shortname, const char *namespace) {
     JabberFeature *feat = g_new0(JabberFeature,1);
     feat->shortname = g_strdup(shortname);
     feat->namespace = g_strdup(namespace);
     
     /* try to remove just in case it already exists in the list */
-    jabber_remove_feature(js, shortname);
+    jabber_remove_feature(shortname);
     
-    js->features = g_list_append(js->features, feat);
+    jabber_features = g_list_append(jabber_features, feat);
 }
 
-void jabber_remove_feature(JabberStream *js, const char *shortname) {
+void jabber_remove_feature(const char *shortname) {
     GList *feature;
-    for(feature = js->features; feature; feature = feature->next) {
+    for(feature = jabber_features; feature; feature = feature->next) {
         JabberFeature *feat = (JabberFeature*)feature->data;
         if(!strcmp(feat->shortname, shortname)) {
             g_free(feat->shortname);