now we can get status of remote user
authorHarvie <tomas@mudrunka.cz>
Wed, 4 May 2011 11:15:45 +0000 (13:15 +0200)
committerHarvie <tomas@mudrunka.cz>
Wed, 4 May 2011 11:15:45 +0000 (13:15 +0200)
README.md
answerscripts.c

index 57921952dcbd76f96669caf6f342664b2fdb6905..33fe650faa507bb3f8ae88f7eec68ecd0b33b738 100644 (file)
--- a/README.md
+++ b/README.md
@@ -32,6 +32,8 @@ There are lot of hacks that you can do with this simple framework if you know so
       * ANSW\_R\_NAME  (ID of remote user - "buddy")
       * ANSW\_R\_GROUP (group which contains that buddy OR empty string)
       * ANSW\_R\_ALIAS (buddy's alias, server alias, contact alias, username OR empty string)
       * ANSW\_R\_NAME  (ID of remote user - "buddy")
       * ANSW\_R\_GROUP (group which contains that buddy OR empty string)
       * ANSW\_R\_ALIAS (buddy's alias, server alias, contact alias, username OR empty string)
+      * ANSW\_R\_STATUS        (unique ID of remote user's status. eg.: available, away,...)
+      * ANSW\_R\_STATUS\_MSG   (status message set by your buddy)
       * ANSW\_L\_NAME  (ID of local user)
       * ANSW\_L\_ALIAS (Alias of local user OR empty string)
       * ANSW\_L\_STATUS        (unique ID of local user's status. eg.: available, away,...)
       * ANSW\_L\_NAME  (ID of local user)
       * ANSW\_L\_ALIAS (Alias of local user OR empty string)
       * ANSW\_L\_STATUS        (unique ID of local user's status. eg.: available, away,...)
index 022a44024e8f88eb00e3796fc6c1ead2ca3867fc..0162e309d3c3941b443e06605e32eafb9c71ba76 100755 (executable)
@@ -88,10 +88,16 @@ static void received_im_msg_cb(PurpleAccount *account, char *who, char *buffer,
        //Get status
        PurpleStatus *status = purple_account_get_active_status(account);
        PurpleStatusType *type = purple_status_get_type(status);
        //Get status
        PurpleStatus *status = purple_account_get_active_status(account);
        PurpleStatusType *type = purple_status_get_type(status);
+       //remote
+       PurpleStatus *r_status = purple_presence_get_active_status(presence);
+       PurpleStatusType *r_status_type =       purple_status_get_type(r_status);
 
        //Get status id
        const char *status_id = NULL;
        status_id = purple_primitive_get_id_from_type(purple_status_type_get_primitive(type));
 
        //Get status id
        const char *status_id = NULL;
        status_id = purple_primitive_get_id_from_type(purple_status_type_get_primitive(type));
+       //remote
+       const char *r_status_id = NULL;
+       r_status_id = purple_primitive_get_id_from_type(purple_status_type_get_primitive(r_status_type));
 
        //Get status message
        const char *status_msg = NULL;
 
        //Get status message
        const char *status_msg = NULL;
@@ -100,6 +106,13 @@ static void received_im_msg_cb(PurpleAccount *account, char *who, char *buffer,
        } else {
                status_msg = (char *) purple_savedstatus_get_message(purple_savedstatus_get_current());
        }
        } else {
                status_msg = (char *) purple_savedstatus_get_message(purple_savedstatus_get_current());
        }
+       //remote
+       const char *r_status_msg = NULL;
+       if (purple_status_type_get_attr(r_status_type, "message") != NULL) {
+               r_status_msg = purple_status_get_attr_string(r_status, "message");
+       } else {
+               r_status_msg = "";
+       }
 
        //Export variables to environment
        setenv(ENV_PREFIX "ACTION", "IM", 1);   //what happend: im, chat, show setting dialog, event, etc...
 
        //Export variables to environment
        setenv(ENV_PREFIX "ACTION", "IM", 1);   //what happend: im, chat, show setting dialog, event, etc...
@@ -108,6 +121,8 @@ static void received_im_msg_cb(PurpleAccount *account, char *who, char *buffer,
        setenv(ENV_PREFIX "R_NAME", who, 1);    //ID of remote user - "buddy"
        setenv(ENV_PREFIX "R_GROUP", from_group, 1);    //group which contains that buddy OR empty string
        setenv(ENV_PREFIX "R_ALIAS", remote_alias, 1);  //buddy's alias, server alias, contact alias, username OR empty string
        setenv(ENV_PREFIX "R_NAME", who, 1);    //ID of remote user - "buddy"
        setenv(ENV_PREFIX "R_GROUP", from_group, 1);    //group which contains that buddy OR empty string
        setenv(ENV_PREFIX "R_ALIAS", remote_alias, 1);  //buddy's alias, server alias, contact alias, username OR empty string
+       setenv(ENV_PREFIX "R_STATUS", r_status_id, 1);  //unique ID of remote user's status. eg.: available, away,...
+       setenv(ENV_PREFIX "R_STATUS_MSG", r_status_msg, 1);     //status message set by your buddy
        setenv(ENV_PREFIX "L_NAME", local_name, 1);     //ID of local user
        setenv(ENV_PREFIX "L_ALIAS", local_alias, 1);   //Alias of local user OR empty string
        setenv(ENV_PREFIX "L_STATUS", status_id, 1);    //unique ID of local user's status. eg.: available, away,...
        setenv(ENV_PREFIX "L_NAME", local_name, 1);     //ID of local user
        setenv(ENV_PREFIX "L_ALIAS", local_alias, 1);   //Alias of local user OR empty string
        setenv(ENV_PREFIX "L_STATUS", status_id, 1);    //unique ID of local user's status. eg.: available, away,...
This page took 0.187377 seconds and 4 git commands to generate.