[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.78,1.79
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.78,1.79 |
Date: |
Fri, 21 Mar 2003 05:00:20 -0500 |
Update of /cvsroot/ayttm/ayttm/modules/msn2
In directory subversions:/tmp/cvs-serv22220/modules/msn2
Modified Files:
msn.C
Log Message:
gnomemeeting inviting
Index: msn.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/msn.C,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- msn.C 20 Mar 2003 09:10:12 -0000 1.78
+++ msn.C 21 Mar 2003 10:00:18 -0000 1.79
@@ -133,6 +133,7 @@
void close_conn(msnconn *conn);
void eb_msn_change_group(eb_account * ea, const char *new_group);
void eb_msn_real_change_group(eb_account * ea, const char *old_group, const
char *new_group);
+static void invite_gnomemeeting(ebmCallbackData * data);
LList *eb_msn_get_smileys(void) { return psmileys; }
}
@@ -183,6 +184,10 @@
struct service SERVICE_INFO = { "MSN", -1, FALSE, TRUE, TRUE, FALSE, NULL };
/* End Module Exports */
+static void *mi1, *mi2;
+
+
+
int plugin_init()
{
int count=0;
@@ -410,6 +415,20 @@
psmileys=add_protocol_smiley(psmileys, "(R)", "rainbow");
psmileys=add_protocol_smiley(psmileys, "(r)", "rainbow");
+ if ((mi1 = eb_add_menu_item(_("Invite to Gnomemeeting"),
EB_CHAT_WINDOW_MENU,
+ invite_gnomemeeting, ebmCONTACTDATA, NULL)) ==
NULL) {
+ return (-1);
+ }
+
+ if ((mi2 = eb_add_menu_item(_("Invite to Gnomemeeting"),
EB_CONTACT_MENU,
+ invite_gnomemeeting, ebmCONTACTDATA, NULL)) ==
NULL) {
+ eb_remove_menu_item(EB_CHAT_WINDOW_MENU, mi2);
+ eb_debug(DBG_MOD, "Error! Unable to add Language menu to
contact menu\n");
+ return (-1);
+ }
+ eb_menu_item_set_protocol(mi1, "MSN");
+ eb_menu_item_set_protocol(mi2, "MSN");
+
return(0);
}
@@ -493,18 +512,18 @@
static eb_local_account *msn_local_account;
-class pending_file_send : public llist_data
+class pending_invitation : public llist_data
{
public:
char * dest; // destination user
char * path;
unsigned long size;
-
- pending_file_send() { dest=path=NULL;size=0; }
- ~pending_file_send() { if(dest!=NULL) { delete dest; } if(path!=NULL) {
delete path; } }
+ int app;
+ pending_invitation() { dest=path=NULL;size=0;app=0; }
+ ~pending_invitation() { if(dest!=NULL) { delete dest; } if(path!=NULL) {
delete path; } }
};
-llist * pending_file_sends=NULL;
+llist * pending_invitations=NULL;
void eb_msn_terminate_chat( eb_account * account );
void eb_msn_add_user( eb_account * account );
@@ -767,11 +786,12 @@
list=list->next;
}
- pending_file_send * pfs=new pending_file_send;
+ pending_invitation * pfs=new pending_invitation;
pfs->dest=msn_permstring(to->handle);
pfs->path=msn_permstring(file);
pfs->size=stats.st_size;
- msn_add_to_llist(pending_file_sends, pfs);
+ pfs->app=APP_FTP;
+ msn_add_to_llist(pending_invitations, pfs);
msn_new_SB(mlad->mc, NULL);
}
@@ -1768,9 +1788,9 @@
{
// OK, this means it's a filetrans invite
- if(pending_file_sends==NULL) { return; } // WTF is this SB FOR??!
+ if(pending_invitations==NULL) { return; } // WTF is this SB FOR??!
- pending_file_send * pfs=(pending_file_send *)pending_file_sends->data;
+ pending_invitation * pfs=(pending_invitation *)pending_invitations->data;
msn_invite_user(conn, pfs->dest);
@@ -1839,16 +1859,16 @@
eb_chat_room_buddy_arrive(ecr,
fname_pref[0]!=0?fname_pref:((authdata_SB *)conn->auth)->username,
((authdata_SB *)conn->auth)->username);
} else {
- llist * l=pending_file_sends;
+ llist * l=pending_invitations;
while(1)
{
if(l==NULL) { return; }
- pending_file_send * pfs=(pending_file_send *)l->data;
+ pending_invitation * pfs=(pending_invitation *)l->data;
eb_debug(DBG_MSN, "Checking %s against %s\n", pfs->dest, username);
- if(!strcmp(pfs->dest, username))
+ if(pfs->app == APP_FTP && !strcmp(pfs->dest, username))
{
invitation_ftp * inv = msn_filetrans_send(conn, pfs->path);
#ifdef __MINGW32__
@@ -1861,10 +1881,15 @@
t_win->inv = inv;
t_win->window_tag = tag;
msn_add_to_llist(transfer_windows, t_win);
- msn_del_from_llist(pending_file_sends, pfs);
+ msn_del_from_llist(pending_invitations, pfs);
delete pfs;
break;
- }
+ } else if (pfs->app == APP_NETMEETING && !strcmp(pfs->dest, username))
{
+ invitation_voice * inv = msn_invite_netmeeting(conn);
+ msn_del_from_llist(pending_invitations, pfs);
+ delete pfs;
+ break;
+ }
l=l->next;
}
@@ -2007,8 +2032,6 @@
char buf[1024];
int callto_supported = 0;
- if(!ip)
- return;
test=popen("gnomemeeting --version 2>&1","r");
if (test==NULL) {
do_error_dialog(_("Cannot run gnomemeeting: presence test
failed."),_("Cannot run gnomemeeting"));
@@ -2039,7 +2062,10 @@
/* wait for three seconds because official clients starting
netmeeting get their stupid splashscreen */
- snprintf(buf,1024,"(sleep 3; gnomemeeting -c callto://%s) &",ip);
+ if (ip)
+ snprintf(buf,1024,"(sleep 3; gnomemeeting -c callto://%s)
&",ip);
+ else /* ??? */
+ snprintf(buf,1024,"gnomemeeting &");
/* should check version... 0.85, for example doesn't handle -c without
my patch (bugzilla.gnome.org #108767) */
system(buf);
@@ -2416,3 +2442,63 @@
return retval;
}
+static void invite_gnomemeeting(ebmCallbackData * data)
+{
+ ebmContactData *ecd = (ebmContactData *) data;
+ struct contact *cont;
+ eb_account *acc;
+ eb_local_account *from;
+
+ from =
find_local_account_by_handle(ecd->local_account,SERVICE_INFO.protocol_id);
+ if (!from) {
+ do_error_dialog(_("Cannot find a valid local account to invite
your contact."), _("MSN Error"));
+ return;
+ }
+
+ eb_msn_local_account_data *mlad =
+ (eb_msn_local_account_data *)from->protocol_local_account_data;
+
+ acc = find_account_by_handle(ecd->remote_account,
SERVICE_INFO.protocol_id);
+ if (!acc) {
+ cont = find_contact_by_nick(ecd->contact);
+ if (!cont)
+ return;
+ acc = find_account_for_protocol(cont, SERVICE_INFO.protocol_id);
+ }
+ if(!acc) {
+ do_error_dialog(_("Cannot find a valid remote account to invite
your contact."), _("MSN Error"));
+ return;
+ }
+ eb_debug(DBG_MSN,"inviting %s to GnomeMeeting via %s\n", acc->handle,
ecd->local_account);
+
+ llist * list;
+
+ list=connections;
+
+ while(1)
+ {
+ msnconn * c;
+ llist * users;
+
+ if(list==NULL) { break ; }
+ c=(msnconn *)list->data;
+ if(c->type==CONN_NS) { list=list->next; continue; }
+ users=c->users;
+ // the below sends an invitation into this session if the only other
participant is
+ // the user we want to talk to
+ if(users!=NULL && users->next==NULL && !strcmp(((char_data
*)users->data)->c, acc->handle))
+ {
+ invitation_voice * inv = msn_invite_netmeeting(c);
+
+ return;
+ }
+
+ list=list->next;
+ }
+ pending_invitation * pfs=new pending_invitation;
+ pfs->dest=msn_permstring(acc->handle);
+ pfs->app=APP_NETMEETING;
+ msn_add_to_llist(pending_invitations, pfs);
+
+ msn_new_SB(mlad->mc,NULL);
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.78,1.79,
Colin Leroy <address@hidden> <=
- Prev by Date:
Re: [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.73,1.74
- Next by Date:
[Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_core.C,1.38,1.39 msn_core.h,1.12,1.13
- Previous by thread:
[Ayttm-commits] CVS: ayttm/src chat_window.c,1.59,1.60 plugin_api.h,1.6,1.7 status.c,1.59,1.60
- Next by thread:
[Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_core.C,1.38,1.39 msn_core.h,1.12,1.13
- Index(es):