I am trying to write a Perl API plugin to change my Away message automatically.
I created a new Saved Status (using the menu in Gaim), and gave it the title MyAwayStatus. Then I placed the following lines in a perl plugin:
$status = Gaim::SavedStatus::find("MyAwayStatus");
$status -> set_message("My new Away message");
I then selected MyAwayStatus as my current Away status in Gaim, and loaded my plugin. However, my Away message did not change. Other users still see my old Away message in their Buddy List, and Gaim still auto-replies with my old message when it received incoming IMs. However, when I looked in the Saved Statuses, I found that the saved message for my current status had indeed changed. If I manually change to another status (e.g. Available) and back to MyAwayStatus, my Away message gets changed to the new one, as expected. How can I make this happen automatically?
In the C API there is a function gaim_savedstatus_activate(GaimSavedStatus *saved_status), to activate a saved status, but I can't find any analogous function in the Perl API. I'm confused, as the SavedStatus part of the Perl API is effectively useless if there's no way to activate a new/modified status.
Matthew.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found a solution. It was very easy to add the missing function to the Perl API. I just inserted the following lines into libgaim/plugins/perl/common/SavedStatuses.xs (underneath "PROTOTYPES: ENABLE" at the top):
then put "$status->activate();" into my perl plugin.
After recompiling Gaim with the above modification, my plugin works perfectly.
One other question, though... it seems I cannot use this plugin to activate the "Available" status. The function Gaim::SavedStatus::find("Available") does not return a valid SavedStatus. Is there some other way?
Matthew.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From my understanding, the default statuses, such as Available, are Status and not SavedStatus. Gaim::SavedStatus::find will only return the statuses that you create.
All you have to do is create a SavedStatus named Available of type Available.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to write a Perl API plugin to change my Away message automatically.
I created a new Saved Status (using the menu in Gaim), and gave it the title MyAwayStatus. Then I placed the following lines in a perl plugin:
$status = Gaim::SavedStatus::find("MyAwayStatus");
$status -> set_message("My new Away message");
I then selected MyAwayStatus as my current Away status in Gaim, and loaded my plugin. However, my Away message did not change. Other users still see my old Away message in their Buddy List, and Gaim still auto-replies with my old message when it received incoming IMs. However, when I looked in the Saved Statuses, I found that the saved message for my current status had indeed changed. If I manually change to another status (e.g. Available) and back to MyAwayStatus, my Away message gets changed to the new one, as expected. How can I make this happen automatically?
In the C API there is a function gaim_savedstatus_activate(GaimSavedStatus *saved_status), to activate a saved status, but I can't find any analogous function in the Perl API. I'm confused, as the SavedStatus part of the Perl API is effectively useless if there's no way to activate a new/modified status.
Matthew.
I found a solution. It was very easy to add the missing function to the Perl API. I just inserted the following lines into libgaim/plugins/perl/common/SavedStatuses.xs (underneath "PROTOTYPES: ENABLE" at the top):
void
gaim_savedstatus_activate(saved_status)
Gaim::SavedStatus saved_status
then put "$status->activate();" into my perl plugin.
After recompiling Gaim with the above modification, my plugin works perfectly.
One other question, though... it seems I cannot use this plugin to activate the "Available" status. The function Gaim::SavedStatus::find("Available") does not return a valid SavedStatus. Is there some other way?
Matthew.
From my understanding, the default statuses, such as Available, are Status and not SavedStatus. Gaim::SavedStatus::find will only return the statuses that you create.
All you have to do is create a SavedStatus named Available of type Available.