예제 #1
0
t_HWindow	call_LoadOutgoing(gu8 sim, const char *phone, t_CSessionID sid)
{
	t_HWindow handle = NULL;

	if(prod_get_sim_count() == 0){
		msgbox_show(NULL, _CSK(OK), 0, 0, "No SIM inserted!");
		return NULL;
	}
	if(sim == 0xff || sim >= prod_get_sim_slots()){
		int i;
		sim = 0xff;
		for(i = 0; i < prod_get_sim_slots(); i++){
			if(prod_sim_status(i) == SIM_CARD_NORMAL){
				sim = i;
				break;
			}
		}
		if(sim == 0xff){
			msgbox_show(NULL, _CSK(OK), 0, 0, "No valid SIM cards!");
			return NULL;
		}
	}
	if(phone && phone[0]){
		int cid;
		cid = call_setup(sim, phone);
		g_printf("call(%s) id=%d", phone, cid);
		if(cid >= 0){
			handle = wnd_create_by_resid(call_WndMsgHandler, cid, sid, brd_get(PACK_GUID_SELF), RESID_WIN_CALL);
			call_notifier(cid, CallNotificationCB, handle);
			wnd_show(handle);
		}else{
		}
	}
	return handle;
}
예제 #2
0
static int	_AppEntry(t_AmsModuleId id, t_sparam sparam, t_lparam lparam)
{
	int ret = EBADPARM;
	call_glob_t *glob;
	switch(id){
		case MOD_CALL_DIALER:
			{
				t_HWindow h;

				glob = call_glob_new(MOD_CALL_DIALER);
				app_set_data(glob);

				h = wnd_create_by_resid(call_PanelWndMsgHandler, sparam, lparam, brd_get(PACK_GUID_SELF), RESID_WIN_PANEL);
				if(wnd_show(h))
					ret = app_loop(NULL);
				call_glob_destroy(glob);
			}
			break;
		case MOD_CALL_INCOMING:
			{
				int cid = *((int *)lparam);

				glob = call_glob_new(MOD_CALL_INCOMING);
				app_set_data(glob);

				if(call_LoadIncoming(cid))
					ret = app_loop(NULL);
				call_glob_destroy(glob);
			}
			break;
		case MOD_CALL_SEND:
			{
				t_MSArgContact *param = (t_MSArgContact *)lparam;
				t_ContactInfo *cinfo = contact_get_info(param->sid);
				
				glob = call_glob_new(MOD_CALL_SEND);
				app_set_data(glob);

				if(cinfo == NULL && param->number[0] == 0){
					ret = msgbox_show("Call", _RSK(BACK), 0, 0, "No cell number provided!");
				}else{
					if(cinfo)
						strcpy(glob->strPhone, cinfo->number);
					else
						strcpy(glob->strPhone, param->number);
					contact_free_info(cinfo);
					if(call_LoadOutgoing(0xFF, glob->strPhone, param->sid))
						ret = app_loop(NULL);
				}
				call_glob_destroy(glob);
				ret = SUCCESS;
			}
			break;
	}
	return ret;
}
예제 #3
0
static void	dtmf_callback(int timer, void *userdata)
{
	t_CallWindowData *wdata = userdata;
	gu8 flag = TRUE;
	char *p = &wdata->info->dtmf[1];
	if(*(p-1) == 'w'){
		//3 notify user to determine whether to start dtmf or not.
		if(msgbox_show(NULL, MBB_YES_NO, 0, 0, "%s %s?", brd_get_string(BRD_HANDLE_SELF, RESID_STR_PROMPT_DTMF, ""), p) == MBB_NO)
			flag = FALSE;
	}
	if(flag){
		while(*p){
			call_send_dtmf(wdata->info->cid, *p++);
			call_stop_dtmf(wdata->info->cid);
		}
	}

	timer_release(timer);
}
예제 #4
0
static int	audioplayer_AppEntry(t_AmsModuleId id, t_sparam sparam, t_lparam lparam)
{
	int ret = EBADPARM;
	audioplayer_glob_t *glob;
	switch(id){
		case MOD_ID_MAIN:
			glob = audioplayer_glob_new(sparam, lparam);
			app_set_data(glob);
			
			if(wnd_show(wnd_create_by_resid(audioplayer_MainWndMsgHandler, 0, 0, brd_get(PACK_GUID_SELF), RESID_WIN_MAIN)))
				ret = app_loop(NULL);
			
			audioplayer_glob_destroy(glob);
			break;
		case MOD_ID_FILE_OPEN:
			{
				const char *fname = (const char *)lparam;
				t_HWindow h;
				int result;
				t_HMedia codec;
				t_DBRecordID rid_playlist, rid_filelist;

				//2 Check codec
				if((codec = g_media_new_for_file(fname)) == NULL){
					msgbox_show(NULL, _CSK(OK), 0, 0, "Invalid format");
					task_exit(0);
					return SUCCESS;
				}
				g_object_unref_0(codec);
				
				glob = audioplayer_glob_new(sparam, lparam);
				app_set_data(glob);
				
				h = wnd_create_by_resid(audioplayer_OpenFileWndMsgHandler, 0, 0, brd_get(PACK_GUID_SELF), RESID_WIN_AUDIO_OPEN);
				result = wnd_modal(h);
				
				if(result < 0){
					//2 Cancel
					ret = 0;
				}else if(result == 0){
					//2 Play it!
					h = wnd_create_by_resid(audioplayer_PlayerWndMsgHandler, sparam, lparam, brd_get(PACK_GUID_SELF), RESID_WIN_PLAYER);
					wnd_show(h);
					ret = app_loop(NULL);
				}else{
					//2 Add to playlist(result)
					rid_playlist = result;
					rid_filelist = db_add_file_to_playlist(glob->hdb_filelist, (char*)fname, glob->hdb_playlist, rid_playlist);
					if(rid_filelist == DB_RID_NULL){
						msgbox_show(NULL, _CSK(OK), 0, 0, "Error to add to playlist");
						ret = 0;
					}else{
						glob->ap_view = AP_VIEW_FILELIST;
						h = wnd_create_by_resid(audioplayer_MainWndMsgHandler, rid_playlist, rid_filelist, brd_get(PACK_GUID_SELF), RESID_WIN_MAIN);
						wnd_show(h);
						ret = app_loop(NULL);
					}
				}
				audioplayer_glob_destroy(glob);
			}
			break;
	}
	return ret;
}
예제 #5
0
/* Tribuneshot : un chouette plateau de fruits de mer ;) */
int
pp_boardshot_kikoooo(Dock *dock, int save_all, int overwrite, int use_js) 
{
  Pinnipede *pp = dock->pinnipede;
  Boards *boards = dock->sites->boards;
  char *file_name;
  FILE *file;
  time_t time_shot;
  int file_exist,j;
  board_msg_info *msg;
  char *cssfname, *shortcssfname;

  file_name = str_substitute(Prefs.board_scrinechote, "~", getenv("HOME"));
  if (strlen(file_name)==0) return 1;
  file = fopen( file_name, "r");
  file_exist = (file!=NULL);
  if ( file_exist ) fclose( file ); 
  

  file = fopen( file_name, overwrite ? "w" : "a");
  if ( ! file ) {
    char errmsg[512];
    snprintf(errmsg, 512, _("Error while opening %s\n"), file_name);
    msgbox_show(dock, errmsg);
    free(file_name);
    return -1;
  }

  cssfname = strdup(file_name);
  {
    char *tmp;
    char *p = cssfname + strlen(cssfname)-1;
    while (p > cssfname && *p != '.' && *p != '/') p--;
    if (*p == '.') *p = 0;
    tmp = str_printf("%s.css", cssfname); free(cssfname);
    cssfname = tmp;
  }
  shortcssfname = strdup(cssfname);
  {
    char *pp;
    char *p = shortcssfname + strlen(shortcssfname)-1;
    while (p > shortcssfname && (*p == '/')) p--;
    pp = p;
    while (p > shortcssfname && *p != '/') p--;
    if (*p == '/') p++;
    if (strlen(p)) {
      *(pp+1) = 0;
      pp = shortcssfname;
      shortcssfname = strdup(p); free(pp);
    }
  }

  if (!file_exist || overwrite) {
    fprintf(file, 
	    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
	    "<html><head><title>Scrinechote tribune</title>"
	    "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" >"
	    "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-15\">"
	    "</head>", shortcssfname);
    fprintf(file, "<body>\n");
    if (use_js) { /* g honte */
      fprintf(file,
	      "<script language=\"JavaScript\" type=\"text/javascript\">\n"
	      "function h(id) {\n"
	      "document.getElementById(id).style.background=\"#%06x\";\n}\n"
	      "function u(id,c)\n{"
	      "document.getElementById(id).style.background=c;\n}\n"
	      "</script>\n", Prefs.pp_emph_color.opaque);
    }
  }
  
  time( &time_shot );
  fprintf( file, "<br><br><center><h2> *** Scrinechote - %s *** </h2></center><br>", ctime( &time_shot ) );
  // Légende des couleurs
  for (j = 0; j < MAX_SITES; j++) {
    if (Prefs.site[j] && Prefs.site[j]->check_board) {
      char *site_name = Prefs.site[j]->site_name;
      int i, in_tabs = 0;
      for (i=0; i < pp->nb_tabs; i++) 
	if (pp->tabs[i].site->prefs == Prefs.site[j])
	  in_tabs = pp->tabs[i].selected;
      if (save_all || in_tabs)
	fprintf( file, "<span class=\"%s-msg\"> %s </span>", site_name, site_name);
    }
  }
  fprintf( file, "<table>");
  
  if (save_all) {
    msg = boards->first;
  } else {
    id_type id = get_first_id_filtered(boards, &pp->filter);
    msg = boards_find_id(boards, id);
  }
  while ( msg ) {
    pp_boardshot_save_msg(boards, msg, file, use_js);
    if (save_all) { 
      msg = msg->g_next;
    } else {
      get_next_id_filtered(boards, msg->id, &msg, &pp->filter);
    }
  }
  
  fprintf( file, "</table><br>\n");
  fclose( file);
  
  {
    char infomsg[512];
    snprintf(infomsg,512,"Scrinechote of the board (%s and %s) saved at %s", file_name, cssfname, ctime(&time_shot));
    msgbox_show(dock, infomsg);
  }
  // NEWSHIFT On créé le css
  pp_boardshot_css_file(cssfname);

  free(file_name);
  free(cssfname);
  return 0;
}