comparison src/protocols/jabber/jabber.c @ 8312:ba12d8b12ab0

[gaim-migrate @ 9036] I think this is preliminary jabber file sending support. I can't test it because the new network listening stuff is broken if you run both IPv4 and IPv6. If someone with a more "normal" setup can let me know if this works, I'd appreciate it. Note that it's not completely implemented yet, so sending via a proxy server doesn't work, cancelling transfers doesn't work, error handling isn't there, and it probably leaks memory. A sane person might even wonder why I'm committing this. Oh well. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 21 Feb 2004 23:59:49 +0000
parents dd6fe7d965aa
children 8d012c803411
comparison
equal deleted inserted replaced
8311:9e2b28acf1cd 8312:ba12d8b12ab0
32 #include "util.h" 32 #include "util.h"
33 33
34 #include "auth.h" 34 #include "auth.h"
35 #include "buddy.h" 35 #include "buddy.h"
36 #include "chat.h" 36 #include "chat.h"
37 #include "disco.h"
37 #include "iq.h" 38 #include "iq.h"
38 #include "jutil.h" 39 #include "jutil.h"
39 #include "message.h" 40 #include "message.h"
40 #include "parser.h" 41 #include "parser.h"
41 #include "presence.h" 42 #include "presence.h"
384 385
385 gc->flags |= GAIM_CONNECTION_HTML; 386 gc->flags |= GAIM_CONNECTION_HTML;
386 js = gc->proto_data = g_new0(JabberStream, 1); 387 js = gc->proto_data = g_new0(JabberStream, 1);
387 js->gc = gc; 388 js->gc = gc;
388 js->fd = -1; 389 js->fd = -1;
389 js->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, 390 js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
391 g_free, g_free);
392 js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
390 g_free, g_free); 393 g_free, g_free);
391 js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, 394 js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal,
392 g_free, (GDestroyNotify)jabber_buddy_free); 395 g_free, (GDestroyNotify)jabber_buddy_free);
393 js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, 396 js->chats = g_hash_table_new_full(g_str_hash, g_str_equal,
394 g_free, NULL); 397 g_free, NULL);
716 int rc; 719 int rc;
717 720
718 js = gc->proto_data = g_new0(JabberStream, 1); 721 js = gc->proto_data = g_new0(JabberStream, 1);
719 js->gc = gc; 722 js->gc = gc;
720 js->registration = TRUE; 723 js->registration = TRUE;
721 js->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, 724 js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
725 g_free, g_free);
726 js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
722 g_free, g_free); 727 g_free, g_free);
723 js->user = jabber_id_new(gaim_account_get_username(account)); 728 js->user = jabber_id_new(gaim_account_get_username(account));
724 js->next_id = g_random_int(); 729 js->next_id = g_random_int();
725 730
726 if(!js->user) { 731 if(!js->user) {
779 close(js->fd); 784 close(js->fd);
780 } 785 }
781 786
782 if(js->context) 787 if(js->context)
783 g_markup_parse_context_free(js->context); 788 g_markup_parse_context_free(js->context);
784 if(js->callbacks) 789 if(js->iq_callbacks)
785 g_hash_table_destroy(js->callbacks); 790 g_hash_table_destroy(js->iq_callbacks);
791 if(js->disco_callbacks)
792 g_hash_table_destroy(js->disco_callbacks);
786 if(js->buddies) 793 if(js->buddies)
787 g_hash_table_destroy(js->buddies); 794 g_hash_table_destroy(js->buddies);
788 if(js->chats) 795 if(js->chats)
789 g_hash_table_destroy(js->chats); 796 g_hash_table_destroy(js->chats);
790 while(js->chat_servers) { 797 while(js->chat_servers) {
830 break; 837 break;
831 case JABBER_STREAM_CONNECTED: 838 case JABBER_STREAM_CONNECTED:
832 gaim_connection_set_state(js->gc, GAIM_CONNECTED); 839 gaim_connection_set_state(js->gc, GAIM_CONNECTED);
833 jabber_roster_request(js); 840 jabber_roster_request(js);
834 jabber_presence_send(js->gc, js->gc->away_state, js->gc->away); 841 jabber_presence_send(js->gc, js->gc->away_state, js->gc->away);
835 jabber_iq_disco_server(js); 842 jabber_disco_items_server(js);
836 serv_finish_login(js->gc); 843 serv_finish_login(js->gc);
837 break; 844 break;
838 } 845 }
839 } 846 }
840 847