ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/modules/yahoo2/libyahoo2 libyahoo2.c,1.7,1.8


From: Philip S Tellis <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/yahoo2/libyahoo2 libyahoo2.c,1.7,1.8 yahoo2.h,1.5,1.6 yahoo_httplib.c,1.5,1.6
Date: Wed, 29 Jan 2003 10:25:57 -0500

Update of /cvsroot/ayttm/ayttm/modules/yahoo2/libyahoo2
In directory subversions:/tmp/cvs-serv29638/modules/yahoo2/libyahoo2

Modified Files:
        libyahoo2.c yahoo2.h yahoo_httplib.c 
Log Message:
set yahoo addressbook, implement change_user_name and free_account_data

Index: libyahoo2.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/yahoo2/libyahoo2/libyahoo2.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- libyahoo2.c 24 Jan 2003 13:34:41 -0000      1.7
+++ libyahoo2.c 29 Jan 2003 15:25:55 -0000      1.8
@@ -213,6 +213,17 @@
                FREE(bud->group);
                FREE(bud->id);
                FREE(bud->real_name);
+               if(bud->yab_entry) {
+                       FREE(bud->yab_entry->fname);
+                       FREE(bud->yab_entry->lname);
+                       FREE(bud->yab_entry->nname);
+                       FREE(bud->yab_entry->id);
+                       FREE(bud->yab_entry->email);
+                       FREE(bud->yab_entry->hphone);
+                       FREE(bud->yab_entry->wphone);
+                       FREE(bud->yab_entry->mphone);
+                       FREE(bud->yab_entry);
+               }
                FREE(bud);
                l->data = bud = NULL;
        }
@@ -1644,8 +1655,10 @@
 {
        struct yab *yab;
        YList *buds;
+       int changed=0;
 
        while((yab = yahoo_getyab(yd)) != NULL) {
+               changed=1;
                for(buds = yd->buddies; buds; buds=buds->next) {
                        struct yahoo_buddy * bud = buds->data;
                        if(!strcmp(bud->id, yab->id)) {
@@ -1667,7 +1680,8 @@
                }
        }
 
-       YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);
+       if(changed)
+               YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, 
yd->buddies);
 }
 
 static void (*yahoo_process_connection[])(struct yahoo_data *) = {
@@ -1698,6 +1712,9 @@
                yd->current_status = -1;
                YAHOO_CALLBACK(ext_yahoo_remove_handler)(id, fd);
 
+               if(yd->client_id == last_id)
+                       last_id--;
+
                close(fd);
 
                /* no need to return an error, because we've already fixed it */
@@ -1930,6 +1947,83 @@
 
        YAHOO_CALLBACK(ext_yahoo_add_handler)(nyd->client_id, nyd->fd, 
YAHOO_INPUT_READ);
 
+}
+
+void yahoo_add_yab(int id, struct yab * yab)
+{
+       struct yahoo_data *yd = find_conn_by_id(id);
+       struct yahoo_data *nyd;
+       char url[1024];
+       char buff[1024];
+       char *temp;
+
+       if(!yd)
+               return;
+
+       nyd = y_new0(struct yahoo_data, 1);
+       nyd->id = yd->id;
+       nyd->client_id = ++last_id;
+       nyd->type = YAHOO_CONNECTION_YAB;
+       nyd->buddies = yd->buddies;
+
+       strncpy(url, "http://insider.msg.yahoo.com/ycontent/?addab2=0";, 
sizeof(url));
+
+       if(yab->fname) {
+               strncat(url, "&fn=", sizeof(url) - strlen(url));
+               temp = yahoo_urlencode(yab->fname);
+               strncat(url, temp, sizeof(url) - strlen(url));
+               free(temp);
+       }
+       if(yab->lname) {
+               strncat(url, "&ln=", sizeof(url) - strlen(url));
+               temp = yahoo_urlencode(yab->lname);
+               strncat(url, temp, sizeof(url) - strlen(url));
+               free(temp);
+       }
+       strncat(url, "&yid=", sizeof(url) - strlen(url));
+       temp = yahoo_urlencode(yab->id);
+       strncat(url, temp, sizeof(url) - strlen(url));
+       free(temp);
+       if(yab->nname) {
+               strncat(url, "&nn=", sizeof(url) - strlen(url));
+               temp = yahoo_urlencode(yab->nname);
+               strncat(url, temp, sizeof(url) - strlen(url));
+               free(temp);
+       }
+       if(yab->email) {
+               strncat(url, "&e=", sizeof(url) - strlen(url));
+               temp = yahoo_urlencode(yab->email);
+               strncat(url, temp, sizeof(url) - strlen(url));
+               free(temp);
+       }
+       if(yab->hphone) {
+               strncat(url, "&hp=", sizeof(url) - strlen(url));
+               temp = yahoo_urlencode(yab->hphone);
+               strncat(url, temp, sizeof(url) - strlen(url));
+               free(temp);
+       }
+       if(yab->wphone) {
+               strncat(url, "&wp=", sizeof(url) - strlen(url));
+               temp = yahoo_urlencode(yab->wphone);
+               strncat(url, temp, sizeof(url) - strlen(url));
+               free(temp);
+       }
+       if(yab->mphone) {
+               strncat(url, "&mp=", sizeof(url) - strlen(url));
+               temp = yahoo_urlencode(yab->mphone);
+               strncat(url, temp, sizeof(url) - strlen(url));
+               free(temp);
+       }
+       strncat(url, "&pp=0", sizeof(url) - strlen(url));
+
+       snprintf(buff, sizeof(buff), "Y=%s; T=%s",
+                       yd->cookie_y, yd->cookie_t);
+
+       nyd->fd = yahoo_http_get(url, buff);
+
+       add_to_list(nyd, nyd->fd);
+
+       YAHOO_CALLBACK(ext_yahoo_add_handler)(nyd->client_id, nyd->fd, 
YAHOO_INPUT_READ);
 }
 
 void yahoo_set_identity_status(int id, const char * identity, int active)

Index: yahoo2.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/yahoo2/libyahoo2/yahoo2.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- yahoo2.h    24 Jan 2003 13:34:41 -0000      1.5
+++ yahoo2.h    29 Jan 2003 15:25:55 -0000      1.6
@@ -53,6 +53,7 @@
 void yahoo_get_list(int id);
 /* download buddy contact information from your yahoo addressbook */
 void yahoo_get_yab(int id);
+void yahoo_add_yab(int id, struct yab * yab);
 void yahoo_keepalive(int id);
 
 /* from is the identity you're sending from.  if NULL, the default is used */

Index: yahoo_httplib.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/yahoo2/libyahoo2/yahoo_httplib.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- yahoo_httplib.c     26 Jan 2003 11:27:35 -0000      1.5
+++ yahoo_httplib.c     29 Jan 2003 15:25:55 -0000      1.6
@@ -154,7 +154,7 @@
                if(!instr[ipos])
                        break;
                
-               snprintf(&str[bpos], 3, "%%%.2x", instr[ipos]);
+               snprintf(&str[bpos], 4, "%%%.2x", instr[ipos]);
                bpos+=3;
                ipos++;
        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]