ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.35,1.36


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.35,1.36
Date: Fri, 17 Jan 2003 10:50:30 -0500

Update of /cvsroot/ayttm/ayttm/modules/msn2
In directory subversions:/tmp/cvs-serv7580/modules/msn2

Modified Files:
        msn.C 
Log Message:
More utf8 friendlynames fix
Less leaks


Index: msn.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/msn.C,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- msn.C       17 Jan 2003 15:16:59 -0000      1.35
+++ msn.C       17 Jan 2003 15:50:26 -0000      1.36
@@ -525,7 +525,9 @@
                return 1;
        }
        if(fname_pref[0]!='\0') {
-               status = msn_set_friendlyname(conn, StrToUtf8(fname_pref)); 
+               char *tmp = StrToUtf8(fname_pref);
+               status = msn_set_friendlyname(conn, tmp); 
+               free(tmp);
                waiting_ans++;
        }
        if (status == 0) {
@@ -648,7 +650,7 @@
                                         gchar * mess)
 {
        message * msg = new message;
-
+       char *tmp = StrToUtf8(mess);
        msg->header = NULL;
        msg->font = NULL;
        msg->colour = NULL;
@@ -659,8 +661,8 @@
           snprintf(buf, 1024, "Warning - your last message was too long for 
the MSN service. The last %d characters were not sent.", strlen(mess)-1100);
           do_error_dialog(buf, "MSN: Message truncated");
         }
-       msg->body = g_strndup(StrToUtf8(mess), 1098);
-
+       msg->body = g_strndup(tmp, 1098);
+       free(tmp);
         eb_msn_local_account_data * mlad;
        mlad = (eb_msn_local_account_data *)from->protocol_local_account_data;
 
@@ -1103,13 +1105,15 @@
 {
        message * msg=new message;
        msg->header=NULL;
+       char *tmp = StrToUtf8(mess);
         if(strlen(mess)>1100)
         {
           char buf[1024];
           snprintf(buf, 1024, "Warning - your last message was too long for 
the MSN service. The last %d characters were not sent.", strlen(mess)-1100);
           do_error_dialog(buf, "MSN: Message truncated");
         }
-       msg->body = g_strndup(StrToUtf8(mess), 1098);
+       
+       msg->body = g_strndup(tmp, 1098);
        msg->font=NULL;
        msg->content=strdup("text/plain; charset=UTF-8");
 
@@ -1162,9 +1166,11 @@
          return 0;
   }
   if(!is_waiting_auth(username)) {
+         char *tmp = Utf8ToStr(friendlyname);
          eb_debug(DBG_MOD, "** %s (%s) has added you to their list.\n", 
friendlyname, username);
-         sprintf(dialog_message, _("The MSN user %s (%s) would like to add you 
to their contact list.\nDo you want to allow them to see when you are 
online?"), friendlyname, username);
-
+         sprintf(dialog_message, _("The MSN user %s (%s) would like to add you 
to their contact list.\nDo you want to allow them to see when you are 
online?"), 
+                         tmp, username);
+         free(tmp);
          uname = strdup(username);
          msn_add_to_llist(waiting_auth_callbacks, (llist_data *)uname);
          eb_do_dialog(dialog_message, _("Authorize MSN User"), 
eb_msn_authorize_callback, (gpointer)uname );
@@ -1436,14 +1442,16 @@
 {
   eb_local_account * ela = NULL;
   char * local_account_name = NULL;
+  char * tmp = Utf8ToStr(friendlyname);
   eb_debug(DBG_MOD, "Your friendlyname is now: %s\n", friendlyname);
   local_account_name=((authdata_NS *)conn->auth)->username;
   ela = find_local_account_by_handle(local_account_name, 
SERVICE_INFO.protocol_id);
-  strncpy(ela->alias, Utf8ToStr(friendlyname), 255);
+  strncpy(ela->alias, tmp, 255);
   waiting_ans = 0;
   if(fname_pref[0]=='\0')
-  { strncpy(fname_pref, Utf8ToStr(friendlyname), MAX_PREF_LEN); }
-  
+  { strncpy(fname_pref, tmp, MAX_PREF_LEN); }
+  free(tmp);
+
   if(!ela->connected) {
          eb_debug(DBG_MOD,"not connected, shouldn't get it\n");
          ela->connected = 1;
@@ -1474,8 +1482,11 @@
         }
   }
 
-  if(fname_pref[0]!='\0')
-  { msn_set_friendlyname(conn, StrToUtf8(fname_pref)); }
+  if(fname_pref[0]!='\0') { 
+         char * tmp = StrToUtf8(fname_pref);
+         msn_set_friendlyname(conn, tmp); 
+         free(tmp);
+  }
 }
 
 void ext_latest_serial(msnconn * conn, int serial)
@@ -1530,15 +1541,15 @@
     eb_msn_account_data *mad;
     /* UNUSED char *newHandle = NULL; */
     int state=0;
-
+    char *tmp = Utf8ToStr(friendlyname);
     eb_debug(DBG_MOD, "Status change detected for %s\n", buddy);
     state=get_status_num(status);
     ea = find_account_by_handle(buddy, SERVICE_INFO.protocol_id);
     eb_debug(DBG_MOD, "First call to find_account_by_handle returned %p\n", 
ea);
     if (ea) {
         mad = (eb_msn_account_data *)ea->protocol_account_data;
-       if (!strcmp(buddy, ea->account_contact->nick)) {
-          rename_contact(ea->account_contact, Utf8ToStr(friendlyname));        
+       if (!strcmp(buddy, ea->account_contact->nick)) {        
+          rename_contact(ea->account_contact, tmp);    
        }
     } else {
            eb_debug(DBG_MOD, "ea not found, creating new account\n");
@@ -1546,7 +1557,7 @@
             mad = (eb_msn_account_data *)ea->protocol_account_data;
            if(!find_grouplist_by_name(_("Buddies")))
                    add_group(_("Buddies"));
-           add_unknown_with_name(ea, Utf8ToStr(friendlyname));
+           add_unknown_with_name(ea, tmp);
            move_contact(_("Buddies"), ea->account_contact);
            update_contact_list();
            write_contact_list();
@@ -1556,10 +1567,11 @@
     else if ((state == MSN_OFFLINE) && (mad->status != MSN_OFFLINE))
                buddy_logoff(ea);
 
-       mad->status = state;
-       buddy_update_status(ea);
-       eb_debug(DBG_MOD, "Buddy->online=%i\n", ea->online);
-       eb_debug(DBG_MOD, "%s (%s) is now %s\n", friendlyname, buddy, status);
+    mad->status = state;
+    buddy_update_status(ea);
+    eb_debug(DBG_MOD, "Buddy->online=%i\n", ea->online);
+    eb_debug(DBG_MOD, "%s (%s) is now %s\n", tmp, buddy, status);
+    free(tmp);
 }
 
 void ext_buddy_offline(msnconn * conn, char * buddy)
@@ -1744,7 +1756,7 @@
 
     /* handle utf8 */
     if (msg->content != NULL && !strcmp(msg->content, "text/plain; 
charset=UTF-8"))
-        lmess = strdup(Utf8ToStr(msg->body));
+        lmess = Utf8ToStr(msg->body);
     else 
         lmess = strdup(msg->body);
     /* The username element is always valid, even if it's not an SB */
@@ -1815,10 +1827,10 @@
 void ext_filetrans_invite(msnconn * conn, char * from, char * friendlyname, 
invitation_ftp * inv)
 {
   char dialog_message[1025];
-
+  char *tmp = Utf8ToStr(friendlyname);
   sprintf(dialog_message, _("The MSN user %s (%s) would like to send you\n %s 
(%lu bytes).\nDo you want to accept this file ?"),
-         friendlyname, from, inv->filename, inv->filesize);
-
+         tmp, from, inv->filename, inv->filesize);
+  free(tmp);
   eb_debug(DBG_MOD, "got invitation : inv->filename:%s, inv->filesize:%lu\n",
         inv->filename,
         inv->filesize);





reply via email to

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