From: <ev...@us...> - 2006-08-19 01:17:39
|
Revision: 16856 Author: evands Date: 2006-08-18 18:13:25 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16856&view=rev Log Message: ----------- ** Part 2 of a 4 part commit ** Restructured the tree and the build files for the core/UI split. libgaim is now built as a library against which gtkgaim and gntgaim link and can be built separately from them by configuring with them disable d (--disable-gtkgaim and --disable-gntgaim). Each of the three source trees (gtk, console, and core) has its own plugins folder. This works nicely on my system; hopefully it won't cause too much chaos for others. If you have local changes, an easy way to merge them to the new layout should be along the lines of svn diff -r version_before_move > myChanges.diff patch -p1 < myChanges.diff where svn diff is done from the gaim checkout root but patch is done from gtk or core (or both). This changeset combines work by Sadrul Chowdhury, Gary Kramlich (grim), and me. Known issues: * On my system, at least, something's not quite right with the gtkgaim build process; it imports gtkgaim.h (as can be seen by adding a #warning) but <gtk/gtk.h> doesn't seem to be used. The GTK_STOCK_XXX defi nes claim to be undeclared. I was going to make this work before committing, but I strongly suspect someone with more autotools experience will be able to fix it easily whereas I've already glared at it for a n hour. * The gnt console UI depends on libgnt, which is not yet automatically built. Either autogen.sh && make && make install libgnt (in console/libgnt) or configure with --disable-gnt for now. * The Windows build process has not been touched yet so still needs updating. * There's an stray "rm: core: is a directory" warning after autogen.sh is compl te. I'm not sure where that's coming from. Modified Paths: -------------- trunk/core/plugins/mono/loader/Makefile.am trunk/core/protocols/bonjour/Makefile.am trunk/core/protocols/gg/Makefile.am trunk/core/protocols/irc/Makefile.am trunk/core/protocols/jabber/Makefile.am trunk/core/protocols/msn/Makefile.am trunk/core/protocols/novell/Makefile.am trunk/core/protocols/oscar/Makefile.am trunk/core/protocols/qq/Makefile.am trunk/core/protocols/sametime/Makefile.am trunk/core/protocols/silc/Makefile.am trunk/core/protocols/simple/Makefile.am trunk/core/protocols/toc/Makefile.am trunk/core/protocols/yahoo/Makefile.am trunk/core/protocols/zephyr/Makefile.am trunk/core/protocols/zephyr/zephyr.c trunk/core/protocols/zephyr/zephyr.h Added Paths: ----------- trunk/core/ trunk/core/Makefile.am trunk/core/account.c trunk/core/account.h trunk/core/accountopt.c trunk/core/accountopt.h trunk/core/blist.c trunk/core/blist.h trunk/core/buddyicon.c trunk/core/buddyicon.h trunk/core/cipher.c trunk/core/cipher.h trunk/core/circbuffer.c trunk/core/circbuffer.h trunk/core/cmds.c trunk/core/cmds.h trunk/core/connection.c trunk/core/connection.h trunk/core/conversation.c trunk/core/conversation.h trunk/core/core.c trunk/core/core.h trunk/core/dbus-analyze-functions.py trunk/core/dbus-analyze-types.py trunk/core/dbus-bindings.h trunk/core/dbus-define-api.h trunk/core/dbus-gaim.h trunk/core/dbus-gaim.service trunk/core/dbus-maybe.h trunk/core/dbus-server.c trunk/core/dbus-server.h trunk/core/dbus-useful.c trunk/core/dbus-useful.h trunk/core/debug.c trunk/core/debug.h trunk/core/desktopitem.c trunk/core/desktopitem.h trunk/core/dnsquery.c trunk/core/dnsquery.h trunk/core/dnssrv.c trunk/core/dnssrv.h trunk/core/eventloop.c trunk/core/eventloop.h trunk/core/ft.c trunk/core/ft.h trunk/core/gaim-client-example.c trunk/core/gaim-client.c trunk/core/gaim-client.h trunk/core/gaim-notifications-example trunk/core/gaim-remote trunk/core/gaim-send trunk/core/gaim-send-async trunk/core/gaim.h trunk/core/getopt.c trunk/core/getopt.h trunk/core/getopt1.c trunk/core/idle.c trunk/core/idle.h trunk/core/imgstore.c trunk/core/imgstore.h trunk/core/internal.h trunk/core/log.c trunk/core/log.h trunk/core/mime.c trunk/core/mime.h trunk/core/network.c trunk/core/network.h trunk/core/notify.c trunk/core/notify.h trunk/core/ntlm.c trunk/core/ntlm.h trunk/core/plugin.c trunk/core/plugin.h trunk/core/pluginpref.c trunk/core/pluginpref.h trunk/core/plugins/ trunk/core/plugins/Makefile.am trunk/core/plugins/ciphertest.c trunk/core/plugins/codeinline.c trunk/core/plugins/dbus-buddyicons-example.py trunk/core/plugins/dbus-example.c trunk/core/plugins/filectl.c trunk/core/plugins/fortuneprofile.pl trunk/core/plugins/gaim.pl trunk/core/plugins/idle.c trunk/core/plugins/ipc-test-client.c trunk/core/plugins/ipc-test-server.c trunk/core/plugins/mono/ trunk/core/plugins/mono/BooPlugin.boo trunk/core/plugins/mono/GetBuddyBack.cs trunk/core/plugins/mono/MPlugin.cs trunk/core/plugins/mono/Makefile.am trunk/core/plugins/mono/api/ trunk/core/plugins/mono/loader/ trunk/core/plugins/perl/ trunk/core/plugins/perl/Makefile.am trunk/core/plugins/perl/Makefile.mingw trunk/core/plugins/perl/common/ trunk/core/plugins/perl/libgaimperl.c trunk/core/plugins/perl/perl-common.c trunk/core/plugins/perl/perl-common.h trunk/core/plugins/perl/perl-handlers.c trunk/core/plugins/perl/perl-handlers.h trunk/core/plugins/perl/perl.c trunk/core/plugins/perl/scripts/ trunk/core/plugins/pluginpref_example.c trunk/core/plugins/psychic.c trunk/core/plugins/signals-test.c trunk/core/plugins/simple.c trunk/core/plugins/ssl/ trunk/core/plugins/ssl/Makefile.am trunk/core/plugins/ssl/Makefile.mingw trunk/core/plugins/ssl/ssl-gnutls.c trunk/core/plugins/ssl/ssl-nss.c trunk/core/plugins/ssl/ssl.c trunk/core/plugins/statenotify.c trunk/core/plugins/tcl/ trunk/core/plugins/tcl/Makefile.am trunk/core/plugins/tcl/Makefile.mingw trunk/core/plugins/tcl/signal-test.tcl trunk/core/plugins/tcl/tcl.c trunk/core/plugins/tcl/tcl_cmd.c trunk/core/plugins/tcl/tcl_cmds.c trunk/core/plugins/tcl/tcl_gaim.h trunk/core/plugins/tcl/tcl_glib.c trunk/core/plugins/tcl/tcl_glib.h trunk/core/plugins/tcl/tcl_ref.c trunk/core/plugins/tcl/tcl_signals.c trunk/core/plugins/test.pl trunk/core/pounce.c trunk/core/pounce.h trunk/core/prefix.c trunk/core/prefix.h trunk/core/prefs.c trunk/core/prefs.h trunk/core/privacy.c trunk/core/privacy.h trunk/core/protocols/ trunk/core/protocols/Makefile.am trunk/core/protocols/bonjour/ trunk/core/protocols/gg/ trunk/core/protocols/irc/ trunk/core/protocols/jabber/ trunk/core/protocols/msn/ trunk/core/protocols/novell/ trunk/core/protocols/oscar/ trunk/core/protocols/qq/ trunk/core/protocols/sametime/ trunk/core/protocols/silc/ trunk/core/protocols/simple/ trunk/core/protocols/toc/ trunk/core/protocols/yahoo/ trunk/core/protocols/zephyr/ trunk/core/proxy.c trunk/core/proxy.h trunk/core/prpl.c trunk/core/prpl.h trunk/core/request.c trunk/core/request.h trunk/core/roomlist.c trunk/core/roomlist.h trunk/core/savedstatuses.c trunk/core/savedstatuses.h trunk/core/server.c trunk/core/server.h trunk/core/signals.c trunk/core/signals.h trunk/core/sound.c trunk/core/sound.h trunk/core/sslconn.c trunk/core/sslconn.h trunk/core/status.c trunk/core/status.h trunk/core/stringref.c trunk/core/stringref.h trunk/core/stun.c trunk/core/stun.h trunk/core/upnp.c trunk/core/upnp.h trunk/core/util.c trunk/core/util.h trunk/core/value.c trunk/core/value.h trunk/core/version.h trunk/core/whiteboard.c trunk/core/whiteboard.h trunk/core/xmlnode.c trunk/core/xmlnode.h Removed Paths: ------------- trunk/core/plugins/mono/BooPlugin.boo trunk/core/plugins/mono/GetBuddyBack.cs trunk/core/plugins/mono/MPlugin.cs trunk/core/plugins/mono/Makefile.am trunk/core/plugins/mono/api/ trunk/core/plugins/mono/loader/ trunk/core/plugins/perl/Makefile.am trunk/core/plugins/perl/Makefile.mingw trunk/core/plugins/perl/common/ trunk/core/plugins/perl/libgaimperl.c trunk/core/plugins/perl/perl-common.c trunk/core/plugins/perl/perl-common.h trunk/core/plugins/perl/perl-handlers.c trunk/core/plugins/perl/perl-handlers.h trunk/core/plugins/perl/perl.c trunk/core/plugins/perl/scripts/ trunk/core/plugins/ssl/Makefile.am trunk/core/plugins/ssl/Makefile.mingw trunk/core/plugins/ssl/ssl-gnutls.c trunk/core/plugins/ssl/ssl-nss.c trunk/core/plugins/ssl/ssl.c trunk/core/plugins/tcl/Makefile.am trunk/core/plugins/tcl/Makefile.mingw trunk/core/plugins/tcl/signal-test.tcl trunk/core/plugins/tcl/tcl.c trunk/core/plugins/tcl/tcl_cmd.c trunk/core/plugins/tcl/tcl_cmds.c trunk/core/plugins/tcl/tcl_gaim.h trunk/core/plugins/tcl/tcl_glib.c trunk/core/plugins/tcl/tcl_glib.h trunk/core/plugins/tcl/tcl_ref.c trunk/core/plugins/tcl/tcl_signals.c trunk/core/protocols/Makefile.am trunk/core/protocols/bonjour/ trunk/core/protocols/gg/ trunk/core/protocols/irc/ trunk/core/protocols/jabber/ trunk/core/protocols/msn/ trunk/core/protocols/novell/ trunk/core/protocols/oscar/ trunk/core/protocols/qq/ trunk/core/protocols/sametime/ trunk/core/protocols/silc/ trunk/core/protocols/simple/ trunk/core/protocols/toc/ trunk/core/protocols/yahoo/ trunk/core/protocols/zephyr/ Property Changed: ---------------- trunk/core/plugins/mono/api/Buddy.cs trunk/core/plugins/mono/api/BuddyList.cs trunk/core/plugins/mono/api/Debug.cs trunk/core/plugins/mono/api/Event.cs trunk/core/plugins/mono/api/GaimPlugin.cs trunk/core/plugins/mono/api/Makefile.am trunk/core/plugins/mono/api/Signal.cs trunk/core/plugins/mono/api/Status.cs trunk/core/plugins/mono/loader/Makefile.am trunk/core/plugins/mono/loader/blist-glue.c trunk/core/plugins/mono/loader/debug-glue.c trunk/core/plugins/mono/loader/mono-glue.h trunk/core/plugins/mono/loader/mono-helper.c trunk/core/plugins/mono/loader/mono-helper.h trunk/core/plugins/mono/loader/mono.c trunk/core/plugins/mono/loader/signal-glue.c trunk/core/plugins/mono/loader/status-glue.c trunk/core/plugins/perl/common/Makefile.mingw trunk/core/plugins/perl/common/module.h trunk/core/plugins/perl/scripts/account.pl trunk/core/plugins/perl/scripts/buddy_list.pl trunk/core/plugins/perl/scripts/conversation.pl trunk/core/plugins/perl/scripts/count_down.pl trunk/core/plugins/perl/scripts/gtk_frame_test.pl trunk/core/plugins/perl/scripts/plugin_action.pl trunk/core/plugins/perl/scripts/plugin_pref.pl trunk/core/plugins/perl/scripts/request.pl trunk/core/protocols/bonjour/Makefile.am trunk/core/protocols/bonjour/Makefile.mingw trunk/core/protocols/bonjour/bonjour.c trunk/core/protocols/bonjour/bonjour.h trunk/core/protocols/bonjour/buddy.c trunk/core/protocols/bonjour/buddy.h trunk/core/protocols/bonjour/dns_sd.c trunk/core/protocols/bonjour/dns_sd.h trunk/core/protocols/bonjour/jabber.c trunk/core/protocols/bonjour/jabber.h trunk/core/protocols/gg/Makefile.am trunk/core/protocols/gg/Makefile.mingw trunk/core/protocols/gg/buddylist.c trunk/core/protocols/gg/buddylist.h trunk/core/protocols/gg/confer.c trunk/core/protocols/gg/confer.h trunk/core/protocols/gg/gg.c trunk/core/protocols/gg/gg.h trunk/core/protocols/gg/lib/common.c trunk/core/protocols/gg/lib/compat.h trunk/core/protocols/gg/lib/dcc.c trunk/core/protocols/gg/lib/events.c trunk/core/protocols/gg/lib/http.c trunk/core/protocols/gg/lib/libgadu-config.h trunk/core/protocols/gg/lib/libgadu.c trunk/core/protocols/gg/lib/libgadu.h trunk/core/protocols/gg/lib/obsolete.c trunk/core/protocols/gg/lib/pubdir.c trunk/core/protocols/gg/lib/pubdir50.c trunk/core/protocols/gg/search.c trunk/core/protocols/gg/search.h trunk/core/protocols/irc/Makefile.am trunk/core/protocols/irc/Makefile.mingw trunk/core/protocols/irc/cmds.c trunk/core/protocols/irc/dcc_send.c trunk/core/protocols/irc/irc.c trunk/core/protocols/irc/irc.h trunk/core/protocols/irc/msgs.c trunk/core/protocols/irc/parse.c trunk/core/protocols/jabber/Makefile.am trunk/core/protocols/jabber/Makefile.mingw trunk/core/protocols/jabber/auth.c trunk/core/protocols/jabber/auth.h trunk/core/protocols/jabber/buddy.c trunk/core/protocols/jabber/buddy.h trunk/core/protocols/jabber/chat.c trunk/core/protocols/jabber/chat.h trunk/core/protocols/jabber/disco.c trunk/core/protocols/jabber/disco.h trunk/core/protocols/jabber/iq.c trunk/core/protocols/jabber/iq.h trunk/core/protocols/jabber/jabber.c trunk/core/protocols/jabber/jabber.h trunk/core/protocols/jabber/jutil.c trunk/core/protocols/jabber/jutil.h trunk/core/protocols/jabber/message.c trunk/core/protocols/jabber/message.h trunk/core/protocols/jabber/oob.c trunk/core/protocols/jabber/oob.h trunk/core/protocols/jabber/parser.c trunk/core/protocols/jabber/parser.h trunk/core/protocols/jabber/presence.c trunk/core/protocols/jabber/presence.h trunk/core/protocols/jabber/roster.c trunk/core/protocols/jabber/roster.h trunk/core/protocols/jabber/si.c trunk/core/protocols/jabber/si.h trunk/core/protocols/jabber/win32/posix.uname.c trunk/core/protocols/jabber/win32/utsname.h trunk/core/protocols/jabber/xdata.c trunk/core/protocols/jabber/xdata.h trunk/core/protocols/msn/Makefile.am trunk/core/protocols/msn/Makefile.mingw trunk/core/protocols/msn/cmdproc.c trunk/core/protocols/msn/cmdproc.h trunk/core/protocols/msn/command.c trunk/core/protocols/msn/command.h trunk/core/protocols/msn/dialog.c trunk/core/protocols/msn/dialog.h trunk/core/protocols/msn/directconn.c trunk/core/protocols/msn/directconn.h trunk/core/protocols/msn/error.c trunk/core/protocols/msn/error.h trunk/core/protocols/msn/group.c trunk/core/protocols/msn/group.h trunk/core/protocols/msn/history.c trunk/core/protocols/msn/history.h trunk/core/protocols/msn/httpconn.c trunk/core/protocols/msn/httpconn.h trunk/core/protocols/msn/msg.c trunk/core/protocols/msn/msg.h trunk/core/protocols/msn/msn.c trunk/core/protocols/msn/msn.h trunk/core/protocols/msn/nexus.c trunk/core/protocols/msn/nexus.h trunk/core/protocols/msn/notification.c trunk/core/protocols/msn/notification.h trunk/core/protocols/msn/object.c trunk/core/protocols/msn/object.h trunk/core/protocols/msn/page.c trunk/core/protocols/msn/page.h trunk/core/protocols/msn/servconn.c trunk/core/protocols/msn/servconn.h trunk/core/protocols/msn/session.c trunk/core/protocols/msn/session.h trunk/core/protocols/msn/slp.c trunk/core/protocols/msn/slp.h trunk/core/protocols/msn/slpcall.c trunk/core/protocols/msn/slpcall.h trunk/core/protocols/msn/slplink.c trunk/core/protocols/msn/slplink.h trunk/core/protocols/msn/slpmsg.c trunk/core/protocols/msn/slpmsg.h trunk/core/protocols/msn/slpsession.c trunk/core/protocols/msn/slpsession.h trunk/core/protocols/msn/state.c trunk/core/protocols/msn/state.h trunk/core/protocols/msn/switchboard.c trunk/core/protocols/msn/switchboard.h trunk/core/protocols/msn/sync.c trunk/core/protocols/msn/sync.h trunk/core/protocols/msn/table.c trunk/core/protocols/msn/table.h trunk/core/protocols/msn/transaction.c trunk/core/protocols/msn/transaction.h trunk/core/protocols/msn/user.c trunk/core/protocols/msn/user.h trunk/core/protocols/msn/userlist.c trunk/core/protocols/msn/userlist.h trunk/core/protocols/novell/Makefile.am trunk/core/protocols/novell/Makefile.mingw trunk/core/protocols/novell/nmconference.c trunk/core/protocols/novell/nmconference.h trunk/core/protocols/novell/nmconn.c trunk/core/protocols/novell/nmconn.h trunk/core/protocols/novell/nmcontact.c trunk/core/protocols/novell/nmcontact.h trunk/core/protocols/novell/nmevent.c trunk/core/protocols/novell/nmevent.h trunk/core/protocols/novell/nmfield.c trunk/core/protocols/novell/nmfield.h trunk/core/protocols/novell/nmmessage.c trunk/core/protocols/novell/nmmessage.h trunk/core/protocols/novell/nmrequest.c trunk/core/protocols/novell/nmrequest.h trunk/core/protocols/novell/nmrtf.c trunk/core/protocols/novell/nmrtf.h trunk/core/protocols/novell/nmuser.c trunk/core/protocols/novell/nmuser.h trunk/core/protocols/novell/nmuserrecord.c trunk/core/protocols/novell/nmuserrecord.h trunk/core/protocols/novell/novell.c trunk/core/protocols/oscar/Makefile.am trunk/core/protocols/oscar/Makefile.mingw trunk/core/protocols/oscar/bstream.c trunk/core/protocols/oscar/family_admin.c trunk/core/protocols/oscar/family_advert.c trunk/core/protocols/oscar/family_alert.c trunk/core/protocols/oscar/family_auth.c trunk/core/protocols/oscar/family_bart.c trunk/core/protocols/oscar/family_bos.c trunk/core/protocols/oscar/family_buddy.c trunk/core/protocols/oscar/family_chat.c trunk/core/protocols/oscar/family_chatnav.c trunk/core/protocols/oscar/family_feedbag.c trunk/core/protocols/oscar/family_icbm.c trunk/core/protocols/oscar/family_icq.c trunk/core/protocols/oscar/family_invite.c trunk/core/protocols/oscar/family_locate.c trunk/core/protocols/oscar/family_odir.c trunk/core/protocols/oscar/family_oservice.c trunk/core/protocols/oscar/family_popup.c trunk/core/protocols/oscar/family_stats.c trunk/core/protocols/oscar/family_translate.c trunk/core/protocols/oscar/family_userlookup.c trunk/core/protocols/oscar/flap_connection.c trunk/core/protocols/oscar/misc.c trunk/core/protocols/oscar/msgcookie.c trunk/core/protocols/oscar/odc.c trunk/core/protocols/oscar/oft.c trunk/core/protocols/oscar/oscar.c trunk/core/protocols/oscar/oscar.h trunk/core/protocols/oscar/oscar_data.c trunk/core/protocols/oscar/peer.c trunk/core/protocols/oscar/peer.h trunk/core/protocols/oscar/peer_proxy.c trunk/core/protocols/oscar/rxhandlers.c trunk/core/protocols/oscar/snac.c trunk/core/protocols/oscar/snactypes.h trunk/core/protocols/oscar/tlv.c trunk/core/protocols/oscar/util.c trunk/core/protocols/sametime/Makefile.am trunk/core/protocols/sametime/Makefile.mingw trunk/core/protocols/sametime/sametime.c trunk/core/protocols/sametime/sametime.h trunk/core/protocols/silc/Makefile.am trunk/core/protocols/silc/Makefile.mingw trunk/core/protocols/silc/buddy.c trunk/core/protocols/silc/chat.c trunk/core/protocols/silc/ft.c trunk/core/protocols/silc/ops.c trunk/core/protocols/silc/pk.c trunk/core/protocols/silc/silc.c trunk/core/protocols/silc/silcgaim.h trunk/core/protocols/silc/util.c trunk/core/protocols/silc/wb.c trunk/core/protocols/silc/wb.h trunk/core/protocols/simple/Makefile.am trunk/core/protocols/simple/Makefile.mingw trunk/core/protocols/simple/simple.c trunk/core/protocols/simple/simple.h trunk/core/protocols/simple/sipmsg.c trunk/core/protocols/simple/sipmsg.h trunk/core/protocols/toc/Makefile.am trunk/core/protocols/toc/Makefile.mingw trunk/core/protocols/toc/toc.c trunk/core/protocols/yahoo/Makefile.am trunk/core/protocols/yahoo/Makefile.mingw trunk/core/protocols/yahoo/util.c trunk/core/protocols/yahoo/yahoo.c trunk/core/protocols/yahoo/yahoo.h trunk/core/protocols/yahoo/yahoo_auth.c trunk/core/protocols/yahoo/yahoo_auth.h trunk/core/protocols/yahoo/yahoo_crypt.c trunk/core/protocols/yahoo/yahoo_crypt.h trunk/core/protocols/yahoo/yahoo_doodle.c trunk/core/protocols/yahoo/yahoo_doodle.h trunk/core/protocols/yahoo/yahoo_filexfer.c trunk/core/protocols/yahoo/yahoo_filexfer.h trunk/core/protocols/yahoo/yahoo_friend.c trunk/core/protocols/yahoo/yahoo_friend.h trunk/core/protocols/yahoo/yahoo_packet.c trunk/core/protocols/yahoo/yahoo_packet.h trunk/core/protocols/yahoo/yahoo_picture.c trunk/core/protocols/yahoo/yahoo_picture.h trunk/core/protocols/yahoo/yahoo_profile.c trunk/core/protocols/yahoo/yahoochat.c trunk/core/protocols/yahoo/yahoochat.h trunk/core/protocols/yahoo/ycht.c trunk/core/protocols/yahoo/ycht.h trunk/core/protocols/zephyr/Makefile.am trunk/core/protocols/zephyr/Makefile.mingw trunk/core/protocols/zephyr/ZAsyncLocate.c trunk/core/protocols/zephyr/ZCkAuth.c trunk/core/protocols/zephyr/ZCkIfNot.c trunk/core/protocols/zephyr/ZClosePort.c trunk/core/protocols/zephyr/ZCmpUID.c trunk/core/protocols/zephyr/ZCmpUIDP.c trunk/core/protocols/zephyr/ZFlsLocs.c trunk/core/protocols/zephyr/ZFlsSubs.c trunk/core/protocols/zephyr/ZFmtAuth.c trunk/core/protocols/zephyr/ZFmtList.c trunk/core/protocols/zephyr/ZFmtNotice.c trunk/core/protocols/zephyr/ZFmtRaw.c trunk/core/protocols/zephyr/ZFmtRawLst.c trunk/core/protocols/zephyr/ZFmtSmRLst.c trunk/core/protocols/zephyr/ZFmtSmRaw.c trunk/core/protocols/zephyr/ZFreeNot.c trunk/core/protocols/zephyr/ZGetLocs.c trunk/core/protocols/zephyr/ZGetSender.c trunk/core/protocols/zephyr/ZGetSubs.c trunk/core/protocols/zephyr/ZGetWGPort.c trunk/core/protocols/zephyr/ZIfNotice.c trunk/core/protocols/zephyr/ZInit.c trunk/core/protocols/zephyr/ZLocations.c trunk/core/protocols/zephyr/ZMakeAscii.c trunk/core/protocols/zephyr/ZMkAuth.c trunk/core/protocols/zephyr/ZNewLocU.c trunk/core/protocols/zephyr/ZOpenPort.c trunk/core/protocols/zephyr/ZParseNot.c trunk/core/protocols/zephyr/ZPeekIfNot.c trunk/core/protocols/zephyr/ZPeekNot.c trunk/core/protocols/zephyr/ZPeekPkt.c trunk/core/protocols/zephyr/ZPending.c trunk/core/protocols/zephyr/ZReadAscii.c trunk/core/protocols/zephyr/ZRecvNot.c trunk/core/protocols/zephyr/ZRecvPkt.c trunk/core/protocols/zephyr/ZRetSubs.c trunk/core/protocols/zephyr/ZSendList.c trunk/core/protocols/zephyr/ZSendNot.c trunk/core/protocols/zephyr/ZSendPkt.c trunk/core/protocols/zephyr/ZSendRLst.c trunk/core/protocols/zephyr/ZSendRaw.c trunk/core/protocols/zephyr/ZSetDest.c trunk/core/protocols/zephyr/ZSetFD.c trunk/core/protocols/zephyr/ZSetSrv.c trunk/core/protocols/zephyr/ZSubs.c trunk/core/protocols/zephyr/ZVariables.c trunk/core/protocols/zephyr/ZWait4Not.c trunk/core/protocols/zephyr/ZhmStat.c trunk/core/protocols/zephyr/Zinternal.c trunk/core/protocols/zephyr/com_err.h trunk/core/protocols/zephyr/error_message.c trunk/core/protocols/zephyr/error_table.h trunk/core/protocols/zephyr/et_name.c trunk/core/protocols/zephyr/init_et.c trunk/core/protocols/zephyr/internal.h trunk/core/protocols/zephyr/mit-copyright.h trunk/core/protocols/zephyr/mit-sipb-copyright.h trunk/core/protocols/zephyr/sysdep.h trunk/core/protocols/zephyr/zephyr.c trunk/core/protocols/zephyr/zephyr.h trunk/core/protocols/zephyr/zephyr_err.c trunk/core/protocols/zephyr/zephyr_err.h Added: trunk/core/Makefile.am =================================================================== --- trunk/core/Makefile.am (rev 0) +++ trunk/core/Makefile.am 2006-08-19 01:13:25 UTC (rev 16856) @@ -0,0 +1,274 @@ +EXTRA_DIST = \ + dbus-analyze-functions.py \ + dbus-analyze-types.py \ + gaim-notifications-example \ + gaim-remote \ + gaim-send \ + gaim-send-async \ + Makefile.mingw \ + win_gaim.c \ + win32/IdleTracker/Makefile.mingw \ + win32/IdleTracker/idletrack.c \ + win32/IdleTracker/idletrack.h \ + win32/gaimrc.rc \ + win32/global.mak \ + win32/libc_interface.c \ + win32/libc_interface.h \ + win32/libc_internal.h \ + win32/resource.h \ + win32/untar.c \ + win32/untar.h \ + win32/wgaimerror.h \ + win32/win32dep.c \ + win32/win32dep.h \ + win32/wspell.c \ + win32/wspell.h \ + win32/nsis/gaim-header.bmp \ + win32/nsis/gaim-intro.bmp \ + win32/nsis/gaim-plugin.nsh \ + win32/nsis/langmacros.nsh \ + win32/nsis/translations/albanian.nsh \ + win32/nsis/translations/bulgarian.nsh \ + win32/nsis/translations/catalan.nsh \ + win32/nsis/translations/czech.nsh \ + win32/nsis/translations/danish.nsh \ + win32/nsis/translations/dutch.nsh \ + win32/nsis/translations/english.nsh \ + win32/nsis/translations/finnish.nsh \ + win32/nsis/translations/french.nsh \ + win32/nsis/translations/german.nsh \ + win32/nsis/translations/hebrew.nsh \ + win32/nsis/translations/hungarian.nsh \ + win32/nsis/translations/italian.nsh \ + win32/nsis/translations/japanese.nsh \ + win32/nsis/translations/korean.nsh \ + win32/nsis/translations/kurdish.nsh \ + win32/nsis/translations/lithuanian.nsh \ + win32/nsis/translations/norwegian.nsh \ + win32/nsis/translations/polish.nsh \ + win32/nsis/translations/portuguese.nsh \ + win32/nsis/translations/portuguese-br.nsh \ + win32/nsis/translations/romanian.nsh \ + win32/nsis/translations/russian.nsh \ + win32/nsis/translations/serbian-latin.nsh \ + win32/nsis/translations/simp-chinese.nsh \ + win32/nsis/translations/slovak.nsh \ + win32/nsis/translations/slovenian.nsh \ + win32/nsis/translations/spanish.nsh \ + win32/nsis/translations/swedish.nsh \ + win32/nsis/translations/trad-chinese.nsh \ + win32/nsis/translations/vietnamese.nsh + +SUBDIRS = plugins protocols + +gaim_coresources = \ + account.c \ + accountopt.c \ + blist.c \ + buddyicon.c \ + cipher.c \ + circbuffer.c \ + cmds.c \ + connection.c \ + conversation.c \ + core.c \ + debug.c \ + desktopitem.c \ + eventloop.c \ + ft.c \ + idle.c \ + imgstore.c \ + log.c \ + mime.c \ + network.c \ + ntlm.c \ + notify.c \ + plugin.c \ + pluginpref.c \ + pounce.c \ + prefix.c \ + prefs.c \ + privacy.c \ + proxy.c \ + prpl.c \ + request.c \ + roomlist.c \ + savedstatuses.c \ + server.c \ + signals.c \ + dnssrv.c\ + status.c \ + stringref.c \ + stun.c \ + sound.c \ + sslconn.c \ + upnp.c \ + util.c \ + value.c \ + xmlnode.c \ + whiteboard.c + +gaim_coreheaders = \ + account.h \ + accountopt.h \ + blist.h \ + buddyicon.h \ + cipher.h \ + circbuffer.h \ + cmds.h \ + connection.h \ + conversation.h \ + core.h \ + dbus-maybe.h \ + debug.h \ + desktopitem.h \ + eventloop.h \ + ft.h \ + idle.h \ + imgstore.h \ + log.h \ + mime.h \ + network.h \ + notify.h \ + ntlm.h \ + plugin.h \ + pluginpref.h \ + pounce.h \ + prefs.h \ + privacy.h \ + proxy.h \ + prpl.h \ + request.h \ + roomlist.h \ + savedstatuses.h \ + server.h \ + signals.h \ + dnssrv.h \ + status.h \ + stringref.h \ + stun.h \ + sound.h \ + sslconn.h \ + upnp.h \ + util.h \ + value.h \ + version.h \ + xmlnode.h \ + whiteboard.h + +if ENABLE_DBUS + +CLEANFILES = \ + dbus-bindings.c \ + dbus-client-binding.c \ + dbus-client-binding.h \ + dbus-types.c \ + dbus-types.h \ + gaim-client-bindings.c \ + gaim-client-bindings.h \ + gaim.service + +# gaim dbus server + +dbus_sources = dbus-server.c dbus-useful.c +dbus_headers = dbus-bindings.h dbus-gaim.h dbus-server.h dbus-useful.h dbus-define-api.h + +dbus_exported = dbus-useful.h dbus-define-api.h account.h blist.h buddyicon.h connection.h conversation.h core.h log.h roomlist.h savedstatuses.h status.h server.h + +gaim_build_coreheaders = $(addprefix $(srcdir)/, $(gaim_coreheaders)) +dbus_build_exported = $(addprefix $(srcdir)/, $(dbus_exported)) + +dbus-types.c: dbus-analyze-types.py $(gaim_coreheaders) + cat $(gaim_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=GAIM_DBUS_DEFINE_TYPE\(%s\) > $@ + +dbus-types.h: dbus-analyze-types.py $(dbus_coreheaders) + cat $(gaim_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=GAIM_DBUS_DECLARE_TYPE\(%s\) > $@ + +dbus-bindings.c: dbus-analyze-functions.py $(dbus_exported) + cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py > $@ + +dbus-server.$(OBJEXT): dbus-bindings.c dbus-types.c dbus-types.h +dbus-server.lo: dbus-bindings.c dbus-types.c dbus-types.h +$(libgaim_la_OBJECTS): dbus-types.h + +# libgaim-client + +libgaim_client_lib = libgaim-client.la + +libgaim_client_la_SOURCES = gaim-client.c gaim-client.h + +libgaim_client_la_LIBADD = $(DBUS_LIBS) + +gaim-client-bindings.c: dbus-analyze-functions.py $(dbus_exported) + cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py --client > $@ + +gaim-client-bindings.h: dbus-analyze-types.py dbus-analyze-functions.py $(gaim_coreheaders) $(dbus_exported) + cat $(gaim_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --keyword=enum --verbatim > $@ + cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py --client --headers >> $@ + +$(libgaim_client_la_OBJECTS): gaim-client-bindings.h gaim-client-bindings.c + +# gaim-client-example + +gaim_client_example_SOURCES = gaim-client-example.c + +gaim_client_example_DEPENDENCIES = @LIBOBJS@ libgaim-client.la + +gaim_client_example_LDADD = \ + @LIBOBJS@ \ + libgaim-client.la \ + $(GLIB_LIBS) \ + $(DBUS_LIBS) + +bin_PROGRAMS = gaim-client-example + +gaim-client-example.$(OBJEXT): gaim-client-bindings.h + +# scripts + +bin_SCRIPTS = gaim-remote gaim-send gaim-send-async + +exampledir = $(datadir)/doc/@PACKAGE@/examples +example_DATA = gaim-notifications-example + +endif + +lib_LTLIBRARIES = libgaim.la $(libgaim_client_lib) + +libgaim_la_SOURCES = \ + $(gaim_coresources) \ + $(dbus_sources) + +noinst_HEADERS= \ + internal.h \ + prefix.h + +libgaimincludedir=$(includedir)/gaim +libgaiminclude_HEADERS = \ + $(gaim_coreheaders) \ + $(dbus_headers) + +libgaim_la_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) $(MS_LIBS) +libgaim_la_LDFLAGS = -export-dynamic +libgaim_la_LIBADD = \ + @LIBOBJS@ \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) \ + $(GMODULE_LIBS) \ + $(GOBJECT_LIBS) \ + $(GSTREAMER_LIBS) \ + $(STATIC_LINK_LIBS) \ + $(INTLLIBS) \ + -lm + +AM_CPPFLAGS = \ + -DBR_PTHREADS=0 \ + -DDATADIR=\"$(datadir)\" \ + -DLIBDIR=\"$(libdir)/gaim/\" \ + -DLOCALEDIR=\"$(datadir)/locale\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -I$(top_srcdir)/plugins \ + $(GSTREAMER_CFLAGS) \ + $(DEBUG_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(LIBXML_CFLAGS) Property changes on: trunk/core/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Copied: trunk/core/account.c (from rev 16843, trunk/src/account.c) =================================================================== --- trunk/core/account.c (rev 0) +++ trunk/core/account.c 2006-08-19 01:13:25 UTC (rev 16856) @@ -0,0 +1,2364 @@ +/** + * @file account.c Account API + * @ingroup core + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "internal.h" +#include "account.h" +#include "core.h" +#include "dbus-maybe.h" +#include "debug.h" +#include "notify.h" +#include "pounce.h" +#include "prefs.h" +#include "privacy.h" +#include "prpl.h" +#include "request.h" +#include "server.h" +#include "signals.h" +#include "status.h" +#include "util.h" +#include "xmlnode.h" + +/* TODO: Should use GaimValue instead of this? What about "ui"? */ +typedef struct +{ + GaimPrefType type; + + char *ui; + + union + { + int integer; + char *string; + gboolean bool; + + } value; + +} GaimAccountSetting; + + +static GaimAccountUiOps *account_ui_ops = NULL; + +static GList *accounts = NULL; +static guint save_timer = 0; +static gboolean accounts_loaded = FALSE; + + +/********************************************************************* + * Writing to disk * + *********************************************************************/ + +static void +setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) +{ + const char *name; + GaimAccountSetting *setting; + xmlnode *node, *child; + char buf[20]; + + name = (const char *)key; + setting = (GaimAccountSetting *)value; + node = (xmlnode *)user_data; + + child = xmlnode_new_child(node, "setting"); + xmlnode_set_attrib(child, "name", name); + + if (setting->type == GAIM_PREF_INT) { + xmlnode_set_attrib(child, "type", "int"); + snprintf(buf, sizeof(buf), "%d", setting->value.integer); + xmlnode_insert_data(child, buf, -1); + } + else if (setting->type == GAIM_PREF_STRING && setting->value.string != NULL) { + xmlnode_set_attrib(child, "type", "string"); + xmlnode_insert_data(child, setting->value.string, -1); + } + else if (setting->type == GAIM_PREF_BOOLEAN) { + xmlnode_set_attrib(child, "type", "bool"); + snprintf(buf, sizeof(buf), "%d", setting->value.bool); + xmlnode_insert_data(child, buf, -1); + } +} + +static void +ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) +{ + const char *ui; + GHashTable *table; + xmlnode *node, *child; + + ui = (const char *)key; + table = (GHashTable *)value; + node = (xmlnode *)user_data; + + if (g_hash_table_size(table) > 0) + { + child = xmlnode_new_child(node, "settings"); + xmlnode_set_attrib(child, "ui", ui); + g_hash_table_foreach(table, setting_to_xmlnode, child); + } +} + +static xmlnode * +status_attr_to_xmlnode(const GaimStatus *status, const GaimStatusType *type, const GaimStatusAttr *attr) +{ + xmlnode *node; + const char *id; + char *value = NULL; + GaimStatusAttr *default_attr; + GaimValue *default_value; + GaimType attr_type; + GaimValue *attr_value; + + id = gaim_status_attr_get_id(attr); + g_return_val_if_fail(id, NULL); + + attr_value = gaim_status_get_attr_value(status, id); + g_return_val_if_fail(attr_value, NULL); + attr_type = gaim_value_get_type(attr_value); + + /* + * If attr_value is a different type than it should be + * then don't write it to the file. + */ + default_attr = gaim_status_type_get_attr(type, id); + default_value = gaim_status_attr_get_value(default_attr); + if (attr_type != gaim_value_get_type(default_value)) + return NULL; + + /* + * If attr_value is the same as the default for this status + * then there is no need to write it to the file. + */ + if (attr_type == GAIM_TYPE_STRING) + { + const char *string_value = gaim_value_get_string(attr_value); + const char *default_string_value = gaim_value_get_string(default_value); + if (((string_value == NULL) && (default_string_value == NULL)) || + ((string_value != NULL) && (default_string_value != NULL) && + !strcmp(string_value, default_string_value))) + return NULL; + value = g_strdup(gaim_value_get_string(attr_value)); + } + else if (attr_type == GAIM_TYPE_INT) + { + int int_value = gaim_value_get_int(attr_value); + if (int_value == gaim_value_get_int(default_value)) + return NULL; + value = g_strdup_printf("%d", int_value); + } + else if (attr_type == GAIM_TYPE_BOOLEAN) + { + gboolean boolean_value = gaim_value_get_boolean(attr_value); + if (boolean_value == gaim_value_get_boolean(default_value)) + return NULL; + value = g_strdup(boolean_value ? + "true" : "false"); + } + else + { + return NULL; + } + + g_return_val_if_fail(value, NULL); + + node = xmlnode_new("attribute"); + + xmlnode_set_attrib(node, "id", id); + xmlnode_set_attrib(node, "value", value); + + g_free(value); + + return node; +} + +static xmlnode * +status_attrs_to_xmlnode(const GaimStatus *status) +{ + GaimStatusType *type = gaim_status_get_type(status); + xmlnode *node, *child; + const GList *attrs, *attr; + + node = xmlnode_new("attributes"); + + attrs = gaim_status_type_get_attrs(type); + for (attr = attrs; attr != NULL; attr = attr->next) + { + child = status_attr_to_xmlnode(status, type, (const GaimStatusAttr *)attr->data); + if (child) + xmlnode_insert_child(node, child); + } + + return node; +} + +static xmlnode * +status_to_xmlnode(const GaimStatus *status) +{ + xmlnode *node, *child; + + node = xmlnode_new("status"); + xmlnode_set_attrib(node, "type", gaim_status_get_id(status)); + if (gaim_status_get_name(status) != NULL) + xmlnode_set_attrib(node, "name", gaim_status_get_name(status)); + xmlnode_set_attrib(node, "active", gaim_status_is_active(status) ? "true" : "false"); + + child = status_attrs_to_xmlnode(status); + xmlnode_insert_child(node, child); + + return node; +} + +static xmlnode * +statuses_to_xmlnode(const GaimPresence *presence) +{ + xmlnode *node, *child; + const GList *statuses, *status; + + node = xmlnode_new("statuses"); + + statuses = gaim_presence_get_statuses(presence); + for (status = statuses; status != NULL; status = status->next) + { + child = status_to_xmlnode((GaimStatus *)status->data); + xmlnode_insert_child(node, child); + } + + return node; +} + +static xmlnode * +proxy_settings_to_xmlnode(GaimProxyInfo *proxy_info) +{ + xmlnode *node, *child; + GaimProxyType proxy_type; + const char *value; + int int_value; + char buf[20]; + + proxy_type = gaim_proxy_info_get_type(proxy_info); + + node = xmlnode_new("proxy"); + + child = xmlnode_new_child(node, "type"); + xmlnode_insert_data(child, + (proxy_type == GAIM_PROXY_USE_GLOBAL ? "global" : + proxy_type == GAIM_PROXY_NONE ? "none" : + proxy_type == GAIM_PROXY_HTTP ? "http" : + proxy_type == GAIM_PROXY_SOCKS4 ? "socks4" : + proxy_type == GAIM_PROXY_SOCKS5 ? "socks5" : + proxy_type == GAIM_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1); + + if (proxy_type != GAIM_PROXY_USE_GLOBAL && + proxy_type != GAIM_PROXY_NONE && + proxy_type != GAIM_PROXY_USE_ENVVAR) + { + if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL) + { + child = xmlnode_new_child(node, "host"); + xmlnode_insert_data(child, value, -1); + } + + if ((int_value = gaim_proxy_info_get_port(proxy_info)) != 0) + { + snprintf(buf, sizeof(buf), "%d", int_value); + child = xmlnode_new_child(node, "port"); + xmlnode_insert_data(child, buf, -1); + } + + if ((value = gaim_proxy_info_get_username(proxy_info)) != NULL) + { + child = xmlnode_new_child(node, "username"); + xmlnode_insert_data(child, value, -1); + } + + if ((value = gaim_proxy_info_get_password(proxy_info)) != NULL) + { + child = xmlnode_new_child(node, "password"); + xmlnode_insert_data(child, value, -1); + } + } + + return node; +} + +static xmlnode * +account_to_xmlnode(GaimAccount *account) +{ + xmlnode *node, *child; + const char *tmp; + GaimPresence *presence; + GaimProxyInfo *proxy_info; + + node = xmlnode_new("account"); + + child = xmlnode_new_child(node, "protocol"); + xmlnode_insert_data(child, gaim_account_get_protocol_id(account), -1); + + child = xmlnode_new_child(node, "name"); + xmlnode_insert_data(child, gaim_account_get_username(account), -1); + + if (gaim_account_get_remember_password(account) && + ((tmp = gaim_account_get_password(account)) != NULL)) + { + child = xmlnode_new_child(node, "password"); + xmlnode_insert_data(child, tmp, -1); + } + + if ((tmp = gaim_account_get_alias(account)) != NULL) + { + child = xmlnode_new_child(node, "alias"); + xmlnode_insert_data(child, tmp, -1); + } + + if ((presence = gaim_account_get_presence(account)) != NULL) + { + child = statuses_to_xmlnode(presence); + xmlnode_insert_child(node, child); + } + + if ((tmp = gaim_account_get_user_info(account)) != NULL) + { + /* TODO: Do we need to call gaim_str_strip_char(tmp, '\r') here? */ + child = xmlnode_new_child(node, "userinfo"); + xmlnode_insert_data(child, tmp, -1); + } + + if ((tmp = gaim_account_get_buddy_icon(account)) != NULL) + { + child = xmlnode_new_child(node, "buddyicon"); + xmlnode_insert_data(child, tmp, -1); + } + + if (g_hash_table_size(account->settings) > 0) + { + child = xmlnode_new_child(node, "settings"); + g_hash_table_foreach(account->settings, setting_to_xmlnode, child); + } + + if (g_hash_table_size(account->ui_settings) > 0) + { + g_hash_table_foreach(account->ui_settings, ui_setting_to_xmlnode, node); + } + + if ((proxy_info = gaim_account_get_proxy_info(account)) != NULL) + { + child = proxy_settings_to_xmlnode(proxy_info); + xmlnode_insert_child(node, child); + } + + return node; +} + +static xmlnode * +accounts_to_xmlnode(void) +{ + xmlnode *node, *child; + GList *cur; + + node = xmlnode_new("account"); + xmlnode_set_attrib(node, "version", "1.0"); + + for (cur = gaim_accounts_get_all(); cur != NULL; cur = cur->next) + { + child = account_to_xmlnode(cur->data); + xmlnode_insert_child(node, child); + } + + return node; +} + +static void +sync_accounts(void) +{ + xmlnode *node; + char *data; + + if (!accounts_loaded) + { + gaim_debug_error("account", "Attempted to save accounts before " + "they were read!\n"); + return; + } + + node = accounts_to_xmlnode(); + data = xmlnode_to_formatted_str(node, NULL); + gaim_util_write_data_to_file("accounts.xml", data, -1); + g_free(data); + xmlnode_free(node); +} + +static gboolean +save_cb(gpointer data) +{ + sync_accounts(); + save_timer = 0; + return FALSE; +} + +static void +schedule_accounts_save() +{ + if (save_timer == 0) + save_timer = gaim_timeout_add(5000, save_cb, NULL); +} + + +/********************************************************************* + * Reading from disk * + *********************************************************************/ + +static void +parse_settings(xmlnode *node, GaimAccount *account) +{ + const char *ui; + xmlnode *child; + + /* Get the UI string, if these are UI settings */ + ui = xmlnode_get_attrib(node, "ui"); + + /* Read settings, one by one */ + for (child = xmlnode_get_child(node, "setting"); child != NULL; + child = xmlnode_get_next_twin(child)) + { + const char *name, *str_type; + GaimPrefType type; + char *data; + + name = xmlnode_get_attrib(child, "name"); + if (name == NULL) + /* Ignore this setting */ + continue; + + str_type = xmlnode_get_attrib(child, "type"); + if (str_type == NULL) + /* Ignore this setting */ + continue; + + if (!strcmp(str_type, "string")) + type = GAIM_PREF_STRING; + else if (!strcmp(str_type, "int")) + type = GAIM_PREF_INT; + else if (!strcmp(str_type, "bool")) + type = GAIM_PREF_BOOLEAN; + else + /* Ignore this setting */ + continue; + + data = xmlnode_get_data(child); + if (data == NULL) + /* Ignore this setting */ + continue; + + if (ui == NULL) + { + if (type == GAIM_PREF_STRING) + gaim_account_set_string(account, name, data); + else if (type == GAIM_PREF_INT) + gaim_account_set_int(account, name, atoi(data)); + else if (type == GAIM_PREF_BOOLEAN) + gaim_account_set_bool(account, name, + (*data == '0' ? FALSE : TRUE)); + } else { + if (type == GAIM_PREF_STRING) + gaim_account_set_ui_string(account, ui, name, data); + else if (type == GAIM_PREF_INT) + gaim_account_set_ui_int(account, ui, name, atoi(data)); + else if (type == GAIM_PREF_BOOLEAN) + gaim_account_set_ui_bool(account, ui, name, + (*data == '0' ? FALSE : TRUE)); + } + + g_free(data); + } +} + +static GList * +parse_status_attrs(xmlnode *node, GaimStatus *status) +{ + GList *list = NULL; + xmlnode *child; + GaimValue *attr_value; + + for (child = xmlnode_get_child(node, "attribute"); child != NULL; + child = xmlnode_get_next_twin(child)) + { + const char *id = xmlnode_get_attrib(child, "id"); + const char *value = xmlnode_get_attrib(child, "value"); + + if (!id || !*id || !value || !*value) + continue; + + attr_value = gaim_status_get_attr_value(status, id); + if (!attr_value) + continue; + + list = g_list_append(list, (char *)id); + + switch (gaim_value_get_type(attr_value)) + { + case GAIM_TYPE_STRING: + list = g_list_append(list, (char *)value); + break; + case GAIM_TYPE_INT: + case GAIM_TYPE_BOOLEAN: + { + int v; + if (sscanf(value, "%d", &v) == 1) + list = g_list_append(list, GINT_TO_POINTER(v)); + else + list = g_list_remove(list, id); + break; + } + default: + break; + } + } + + return list; +} + +static void +parse_status(xmlnode *node, GaimAccount *account) +{ + gboolean active = FALSE; + const char *data; + const char *type; + xmlnode *child; + GList *attrs = NULL; + + /* Get the active/inactive state */ + data = xmlnode_get_attrib(node, "active"); + if (data == NULL) + return; + if (strcasecmp(data, "true") == 0) + active = TRUE; + else if (strcasecmp(data, "false") == 0) + active = FALSE; + else + return; + + /* Get the type of the status */ + type = xmlnode_get_attrib(node, "type"); + if (type == NULL) + return; + + /* Read attributes into a GList */ + child = xmlnode_get_child(node, "attributes"); + if (child != NULL) + { + attrs = parse_status_attrs(child, + gaim_account_get_status(account, type)); + } + + gaim_account_set_status_list(account, type, active, attrs); + + g_list_free(attrs); +} + +static void +parse_statuses(xmlnode *node, GaimAccount *account) +{ + xmlnode *child; + + for (child = xmlnode_get_child(node, "status"); child != NULL; + child = xmlnode_get_next_twin(child)) + { + parse_status(child, account); + } +} + +static void +parse_proxy_info(xmlnode *node, GaimAccount *account) +{ + GaimProxyInfo *proxy_info; + xmlnode *child; + char *data; + + proxy_info = gaim_proxy_info_new(); + + /* Use the global proxy settings, by default */ + gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_GLOBAL); + + /* Read proxy type */ + child = xmlnode_get_child(node, "type"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + if (!strcmp(data, "global")) + gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_GLOBAL); + else if (!strcmp(data, "none")) + gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_NONE); + else if (!strcmp(data, "http")) + gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_HTTP); + else if (!strcmp(data, "socks4")) + gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_SOCKS4); + else if (!strcmp(data, "socks5")) + gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_SOCKS5); + else if (!strcmp(data, "envvar")) + gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_ENVVAR); + else + { + gaim_debug_error("account", "Invalid proxy type found when " + "loading account information for %s\n", + gaim_account_get_username(account)); + } + g_free(data); + } + + /* Read proxy host */ + child = xmlnode_get_child(node, "host"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + gaim_proxy_info_set_host(proxy_info, data); + g_free(data); + } + + /* Read proxy port */ + child = xmlnode_get_child(node, "port"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + gaim_proxy_info_set_port(proxy_info, atoi(data)); + g_free(data); + } + + /* Read proxy username */ + child = xmlnode_get_child(node, "username"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + gaim_proxy_info_set_username(proxy_info, data); + g_free(data); + } + + /* Read proxy password */ + child = xmlnode_get_child(node, "password"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + gaim_proxy_info_set_password(proxy_info, data); + g_free(data); + } + + /* If there are no values set then proxy_infourn NULL */ + if ((gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_GLOBAL) && + (gaim_proxy_info_get_host(proxy_info) == NULL) && + (gaim_proxy_info_get_port(proxy_info) == 0) && + (gaim_proxy_info_get_username(proxy_info) == NULL) && + (gaim_proxy_info_get_password(proxy_info) == NULL)) + { + gaim_proxy_info_destroy(proxy_info); + return; + } + + gaim_account_set_proxy_info(account, proxy_info); +} + +static GaimAccount * +parse_account(xmlnode *node) +{ + GaimAccount *ret; + xmlnode *child; + char *protocol_id = NULL; + char *name = NULL; + char *data; + + child = xmlnode_get_child(node, "protocol"); + if (child != NULL) + protocol_id = xmlnode_get_data(child); + + child = xmlnode_get_child(node, "name"); + if (child != NULL) + name = xmlnode_get_data(child); + if (name == NULL) + { + /* Do we really need to do this? */ + child = xmlnode_get_child(node, "username"); + if (child != NULL) + name = xmlnode_get_data(child); + } + + if ((protocol_id == NULL) || (name == NULL)) + { + g_free(protocol_id); + g_free(name); + return NULL; + } + + ret = gaim_account_new(name, protocol_id); + g_free(name); + g_free(protocol_id); + + /* Read the password */ + child = xmlnode_get_child(node, "password"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + gaim_account_set_remember_password(ret, TRUE); + gaim_account_set_password(ret, data); + g_free(data); + } + + /* Read the alias */ + child = xmlnode_get_child(node, "alias"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + if (*data != '\0') + gaim_account_set_alias(ret, data); + g_free(data); + } + + /* Read the statuses */ + child = xmlnode_get_child(node, "statuses"); + if (child != NULL) + { + parse_statuses(child, ret); + } + + /* Read the userinfo */ + child = xmlnode_get_child(node, "userinfo"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + gaim_account_set_user_info(ret, data); + g_free(data); + } + + /* Read the buddyicon */ + child = xmlnode_get_child(node, "buddyicon"); + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + { + gaim_account_set_buddy_icon(ret, data); + g_free(data); + } + + /* Read settings (both core and UI) */ + for (child = xmlnode_get_child(node, "settings"); child != NULL; + child = xmlnode_get_next_twin(child)) + { + parse_settings(child, ret); + } + + /* Read proxy */ + child = xmlnode_get_child(node, "proxy"); + if (child != NULL) + { + parse_proxy_info(child, ret); + } + + return ret; +} + +static void +load_accounts(void) +{ + xmlnode *node, *child; + + accounts_loaded = TRUE; + + node = gaim_util_read_xml_from_file("accounts.xml", _("accounts")); + + if (node == NULL) + return; + + for (child = xmlnode_get_child(node, "account"); child != NULL; + child = xmlnode_get_next_twin(child)) + { + GaimAccount *new_acct; + new_acct = parse_account(child); + gaim_accounts_add(new_acct); + } + + xmlnode_free(node); +} + + +static void +delete_setting(void *data) +{ + GaimAccountSetting *setting = (GaimAccountSetting *)data; + + g_free(setting->ui); + + if (setting->type == GAIM_PREF_STRING) + g_free(setting->value.string); + + g_free(setting); +} + +GaimAccount * +gaim_account_new(const char *username, const char *protocol_id) +{ + GaimAccount *account = NULL; + GaimPlugin *prpl = NULL; + GaimPluginProtocolInfo *prpl_info = NULL; + GaimStatusType *status_type; + + g_return_val_if_fail(username != NULL, NULL); + g_return_val_if_fail(protocol_id != NULL, NULL); + + account = gaim_accounts_find(username, protocol_id); + + if (account != NULL) + return account; + + account = g_new0(GaimAccount, 1); + GAIM_DBUS_REGISTER_POINTER(account, GaimAccount); + + gaim_account_set_username(account, username); + + gaim_account_set_protocol_id(account, protocol_id); + + account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, delete_setting); + account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, (GDestroyNotify)g_hash_table_destroy); + account->system_log = NULL; + /* 0 is not a valid privacy setting */ + account->perm_deny = GAIM_PRIVACY_ALLOW_ALL; + + account->presence = gaim_presence_new_for_account(account); + + prpl = gaim_find_prpl(protocol_id); + + if (prpl == NULL) + return account; + + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); + if (prpl_info != NULL && prpl_info->status_types != NULL) + gaim_account_set_status_types(account, prpl_info->status_types(account)); + + status_type = gaim_account_get_status_type_with_primitive(account, GAIM_STATUS_AVAILABLE); + if (status_type != NULL) + gaim_presence_set_status_active(account->presence, + gaim_status_type_get_id(status_type), + TRUE); + else + gaim_presence_set_status_active(account->presence, + "offline", + TRUE); + + return account; +} + +void +gaim_account_destroy(GaimAccount *account) +{ + GList *l; + + g_return_if_fail(account != NULL); + + gaim_debug_info("account", "Destroying account %p\n", account); + + for (l = gaim_get_conversations(); l != NULL; l = l->next) + { + GaimConversation *conv = (GaimConversation *)l->data; + + if (gaim_conversation_get_account(conv) == account) + gaim_conversation_set_account(conv, NULL); + } + + g_free(account->username); + g_free(account->alias); + g_free(account->password); + g_free(account->user_info); + g_free(account->protocol_id); + + g_hash_table_destroy(account->settings); + g_hash_table_destroy(account->ui_settings); + + gaim_account_set_status_types(account, NULL); + + gaim_presence_destroy(account->presence); + + if(account->system_log) + gaim_log_free(account->system_log); + + GAIM_DBUS_UNREGISTER_POINTER(account); + g_free(account); +} + +void +gaim_account_register(GaimAccount *account) +{ + g_return_if_fail(account != NULL); + + gaim_debug_info("account", "Registering account %s\n", + gaim_account_get_username(account)); + + gaim_connection_new(account, TRUE, NULL); +} + +static void +request_password_ok_cb(GaimAccount *account, GaimRequestFields *fields) +{ + const char *entry; + gboolean remember; + + entry = gaim_request_fields_get_string(fields, "password"); + remember = gaim_request_fields_get_bool(fields, "remember"); + + if (!entry || !*entry) + { + gaim_notify_error(account, NULL, _("Password is required to sign on."), NULL); + return; + } + + if(remember) + gaim_account_set_remember_password(account, TRUE); + + gaim_account_set_password(account, entry); + + gaim_connection_new(account, FALSE, entry); +} + +static void +request_password(GaimAccount *account) +{ + gchar *primary; + const gchar *username; + GaimRequestFieldGroup *group; + GaimRequestField *field; + GaimRequestFields *fields; + + /* Close any previous password request windows */ + gaim_request_close_with_handle(account); + + username = gaim_account_get_username(account); + primary = g_strdup_printf(_("Enter password for %s (%s)"), username, + gaim_account_get_protocol_name(account)); + + fields = gaim_request_fields_new(); + group = gaim_request_field_group_new(NULL); + gaim_request_fields_add_group(fields, group); + + field = gaim_request_field_string_new("password", _("Enter Password"), NULL, FALSE); + gaim_request_field_string_set_masked(field, TRUE); + gaim_request_field_set_required(field, TRUE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_bool_new("remember", _("Save password"), FALSE); + gaim_request_field_group_add_field(group, field); + + gaim_request_fields(account, + NULL, + primary, + NULL, + fields, + _("OK"), G_CALLBACK(request_password_ok_cb), + _("Cancel"), NULL, + account); + g_free(primary); +} + +void +gaim_account_connect(GaimAccount *account) +{ + GaimPlugin *prpl; + GaimPluginProtocolInfo *prpl_info; + const char *password; + + g_return_if_fail(account != NULL); + + gaim_debug_info("account", "Connecting to account %s\n", + gaim_account_get_username(account)); + + if (!gaim_account_get_enabled(account, gaim_core_get_ui())) + return; + + prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); + if (prpl == NULL) + { + gchar *message; + + message = g_strdup_printf(_("Missing protocol plugin for %s"), + gaim_account_get_username(account)); + gaim_notify_error(account, _("Connection Error"), message, NULL); + g_free(message); + return; + } + + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); + password = gaim_account_get_password(account); + if ((password == NULL) && + !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && + !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) + request_password(account); + else + gaim_connection_new(account, FALSE, password); +} + +void +gaim_account_disconnect(GaimAccount *account) +{ + GaimConnection *gc; + + g_return_if_fail(account != NULL); + g_return_if_fail(!gaim_account_is_disconnected(account)); + + gaim_debug_info("account", "Disconnecting account %p\n", account); + + account->disconnecting = TRUE; + + gc = gaim_account_get_connection(account); + gaim_connection_destroy(gc); + if (!gaim_account_get_remember_password(account)) + gaim_account_set_password(account, NULL); + gaim_account_set_connection(account, NULL); + + account->disconnecting = FALSE; +} + +void +gaim_account_notify_added(GaimAccount *account, const char *remote_user, + const char *id, const char *alias, + const char *message) +{ + GaimAccountUiOps *ui_ops; + + g_return_if_fail(account != NULL); + g_return_if_fail(remote_user != NULL); + + ui_ops = gaim_accounts_get_ui_ops(); + + if (ui_ops != NULL && ui_ops->notify_added != NULL) + ui_ops->notify_added(account, remote_user, id, alias, message); +} + +void +gaim_account_request_add(GaimAccount *account, const char *remote_user, + const char *id, const char *alias, + const char *message) +{ + GaimAccountUiOps *ui_ops; + + g_return_if_fail(account != NULL); + g_return_if_fail(remote_user != NULL); + + ui_ops = gaim_accounts_get_ui_ops(); + + if (ui_ops != NULL && ui_ops->request_add != NULL) + ui_ops->request_add(account, remote_user, id, alias, message); +} + +static void +change_password_cb(GaimAccount *account, GaimRequestFields *fields) +{ + const char *orig_pass, *new_pass_1, *new_pass_2; + + orig_pass = gaim_request_fields_get_string(fields, "password"); + new_pass_1 = gaim_request_fields_get_string(fields, "new_password_1"); + new_pass_2 = gaim_request_fields_get_string(fields, "new_password_2"); + + if (g_utf8_collate(new_pass_1, new_pass_2)) + { + gaim_notify_error(account, NULL, + _("New passwords do not match."), NULL); + + return; + } + + if (orig_pass == NULL || new_pass_1 == NULL || new_pass_2 == NULL || + *orig_pass == '\0' || *new_pass_1 == '\0' || *new_pass_2 == '\0') + { + gaim_notify_error(account, NULL, + _("Fill out all fields completely."), NULL); + return; + } + + gaim_account_change_password(account, orig_pass, new_pass_1); +} + +void +gaim_account_request_change_password(GaimAccount *account) +{ + GaimRequestFields *fields; + GaimRequestFieldGroup *group; + GaimRequestField *field; + char primary[256]; + + g_return_if_fail(account != NULL); + g_return_if_fail(gaim_account_is_connected(account)); + + fields = gaim_request_fields_new(); + + group = gaim_request_field_group_new(NULL); + gaim_request_fields_add_group(fields, group); + + field = gaim_request_field_string_new("password", _("Original password"), + NULL, FALSE); + gaim_request_field_string_set_masked(field, TRUE); + gaim_request_field_set_required(field, TRUE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("new_password_1", + _("New password"), + NULL, FALSE); + gaim_request_field_string_set_masked(field, TRUE); + gaim_request_field_set_required(field, TRUE); + gaim_... [truncated message content] |