I explained how I use Dropbox and Pidgin in combination in the Synchronicity post. That works pretty well, but the trouble is that it syncs EVERYTHING. There are some things I don’t want want to sync. For example, when I am at work, I filter all of my browser traffic and IM connections through an SSH tunnel, so my knuckle-head IT guy can’t see what I am doing. This means that the global proxy setting in Pidgin is set to use SOCKS v5. I don’t want that at home. Also, I have Pidgin configured with my company’s IM server, which I DEFINITELY don’t want at home. I have actually gotten stuck working on a weekend before, because I opened up Pidgin on my home PC, it auto-logged me in to the work IM server and my boss was online.
There might be more elegant ways to resolve this, like sym-links or something, but I decided to resolve this with a batch script. The script uses environment variables heavily. The most important one %computername% does not need to be configured. It’s a Windows standard variable. Two of the others I already had configured for the syncing in the previously mentioned post. I had to add a new one, however. I created %pidgin% on my work and home computers to point to the pidgin install directory. Use this guide, if you don’t know how to set up environment variables in Windows.
Here is a list of all the variables:
- %computername% – name of the computer the script is running on
- %dropbox% – path to my dropbox files %purplehome% path to pidgin’s config and log files
- %pidgin% – path to the pidgin install
The script does 3 things. First, it changes to the “%purplehome%.purple” directory, and recursively deletes any files with the word ‘conflict’ in the file name. If %purplehome% was set to “C:” then the actual Pidgin config would be in “C:.purple” The conflict files are files that Dropbox tried to sync, but detected a conflict between the version on the server and the version on the computer, and couldn’t figure out which one should be kept. With Pidgin, this almost always means that Pidgin was running on two or more machines at once. Dropbox would rather create a backup then overwrite one of the files. For just about anything else, this is what I would want. For Pidgin, the likelihood of the differences in the files being meaningful is about 0%. I would rather just blow them all away, and save the space. Especially since Dropbox is limited to 2GB.
Next, the script copies the “accounts.xml” and “prefs.xml” files from a backup folder into the “%purplehome%.purple” folder. The “accounts.xml” folder is where all of the account information is stored. For example: the IM servers you use and your username and password for each. It also contains information on whether or not these different accounts should be connected when Pidgin launches. By keeping two copies of this file, I can have my work PC auto-connect to the work IM server, and my home PC not. The “prefs.xml” file contains all of the global preferences in Pidgin. Including the proxy config. By copying the work “prefs.xml” into the “.purple” directory, it will use my SSH tunnel proxy to connect all of the non-work IM servers. The home “prefs.xml” file will leave the proxy off when connecting. The trick here, is that for each of the files I am copying, the %computername% is tacked on to the front of the file name. So, if my computer’s name at home was “crthomas_home” then it would actually copy “crthomas_home_accounts.xml” and “crthomas_home_prefs.xml” to “%purplehome%.purpleaccounts.xml” and “%purplehome%.purpleprefs.xml” Since I am using the %computername% environment variable, I can have an infinite number of configs for an infinite number of computers, as long as the other environment variables are also set up, and each computer has “%computername%_accounts.xml” and “%computername%_prefs.xml” files.
Finally, the script launches Pidgin. This should be pretty straightforward. As I mentioned above, the %pidgin% variable points to the Pidgin install directory. The start “” stuff is to prevent Microsoft wonkyness when launching the program.
Now, whenever I want to start Pidgin, I just run the script, instead of the normal Pidgin link. The script does the work for me. And since it is also synced in my Dropbox, I will always have it with me.
Here is the full script:
del conflicted /Q /S
start “” %pidgin%pidgin.exe