1

Being notified whether a contact appears online/offline or not can be changed via the Skype Options or via the ~/.skype/your_skype_id/config.xml. In this file, depending on what you chose, on can find the following lines:

<Notify>
  <Chat>0</Chat>
  <Offline>1</Offline>
  <Online>1</Online>
</Notify>

where <Offline>n</Offline> (resp. <Online>n</Online>) corresponds to the "Contact came offline" (resp. "Contact came online") option and where n obviously states whether it's on or not.

Thus my question is the following: Can one toggle the notifications on/off automatically?

It's important to note that Offline and Online appear only once on the XML file.

So far all I can do is:

sed -i config.xml -e '197s!<Online>1</Online>!<Online>0</Online>!'

where 197 is the line number (which is case dependant, so it's pretty bad), and where I don't check the existing status of the notification, I only turn it off.


In short, what I would like to do is to change 0 to 1 (or 1 to 0) automatically to both lines.

1 Answer 1

2

This sounds like a job for a bash/shell script.

What I would is create a simple if statement using grep to search the file for 1 or 0 and then replace them using the command you have. Say:

if grep -q "<Online>1</Online>" "config.xml"; then
        echo "Statement Returned True, Will now execute"
        sed -i config.xml -e '197s!<Online>1</Online>!<Online>0</Online>!'

elif grep -q "<Online>0</Online>" "config.xml"; then
        echo "Statement Returned True, Will now execute"
        sed -i config.xml -e '197s!<Online>0</Online>!<Online>1</Online>!'
fi

if grep -q "<Offline>1</Offline>" "config.xml"; then
        echo "Statement Returned True, Will now execute"
        sed -i config.xml -e '197s!<Online>1</Online>!<Online>0</Online>!'

elif grep -q "<Offline>0</Offline>" "config.xml"; then
        echo "Statement Returned True, Will now execute"
        sed -i config.xml -e '197s!<Online>0</Online>!<Online>1</Online>!'
fi

And put that in a run.sh or something.

2
  • I'm afraid that the problem here is that the line (197) can change from one file to an other.
    – Öskå
    Sep 22, 2014 at 15:55
  • Grep should still be able to return a line number that it found the information on, I think that taking that line number and placing back into the 'sed' function should work. Sep 22, 2014 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .