Opened 10 years ago

Last modified 5 years ago

#2224 new enhancement

automagic merging of same contacts from different transports

Reported by: maclag Owned by: asterix
Priority: low Milestone: Plugins Welcome
Component: roster Version:
Severity: trivial Keywords:
Cc: Blocked By:
Blocking: OS: All


I'm not sure this title is enough... In fact, I though about this just after having add a new msn transport beside of my main server one(because it's down for the moment). And now I have to merge all new transport contacts with the old transport ones. Euh... not clear, isn't it? For example:……

It cannot be a different person, nor even a different account for the same person. Would it be possible to have a script that automagically merge these kind of contacts?

It is particularly useful to keep the group classifications, etc.

Attachments (1) (528 bytes) - added by dkirov 10 years ago.
same as script

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by dkirov

Even with equal jabber contacts there is no automatic merge.

Doing it with script is not easy, because metacontacts are stored on server and there need to be an established connection to do the merge. I think that if you remove the first transport '' all the contacts that belong to it will be automatically removed and this will solve your problem.

comment:2 Changed 10 years ago by maclag

Err, not, in fact, I think I've not correctly explained the case.

Main account:

Previous msn gateway on, not working anymore (but maybe will work again one day or another, so no delete)

New msn gateway on, but still connected to jabber network with

This means that when I display disconnected contacts, I have twice the same: one for, one for

That's right, that if I first had deleted the jabber1 msn transport, I would not have twice all of my contacts.

But this also implies to lose every groups informations, or metacontacts informations for those who use several accounts and/or protocols, that is not fun to realize when you have more than 40 msn contacts...

Anyway, merging all the "clones" didnt' harm me, and I still think that gajim rocks! ;) This is a suggestion, and I think sometimes it can be really useful!

comment:3 Changed 10 years ago by dkirov

Maybe you need something like this:


echo '<iq type="set">
        <query xmlns="jabber:iq:private">
                <storage xmlns="storage:metacontacts">' > $FILE

LIST=`gajim-remote list_contacts|grep -P "jid\s*:\s*.+@$GW1"|grep -E
"@$GW1" |sed -e 's/^jid\s*\:\s*//' -e "s/@$GW1\$//"`
echo $LIST
for jid in $LIST; do
        echo "<meta jid=\"${jid}@${GW1}\" tag=\"${jid}@${GW1}\" />" >>
        echo "<meta jid=\"${jid}@${GW2}\" tag=\"${jid}@${GW1}\" />" >>

echo '          </storage>
</iq>' >> $FILE

set GW1 and GW2 as appropriate. Then open /tmp/stanza_to_send and send it to account1, using XML Console (Menu Actions -> Advanced -> account1 -> Xml Console). This will break your current metacontacts and you'll have to recreate them.

comment:4 Changed 10 years ago by dkirov

additional note: Just after you send the stanza, restart Gajim, because it

is not aware of the new metacontacts and may override them with old values.

Changed 10 years ago by dkirov

same as script

comment:5 Changed 10 years ago by asterix

I'm not sure automatically merge contacts is a good thing: users may not

know what a metacontact is and would be very confused, no ?

comment:6 Changed 10 years ago by maclag

Maybe they would be confused, but in this case it should also be possible

to merge contact via a menu entry?

On the other side, wouldn't this be even more confusing for a user: all his contacts suddenly "un-grouped" and loosing all their aliases?

At least, merging contacts from transport should not be confusing, since for the end-user, it is still, for example, blabla at truc dot very-warm- mailbox.

Thanks for the script anyway!!

comment:7 Changed 5 years ago by asterix

  • Milestone set to Plugins Welcome
  • OS set to All

That very rare to have 2 transport of the same protocol. You can write a plugin now to do that if you really want

Note: See TracTickets for help on using tickets.